%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
/* *
*
* Imports
*
* */
import RendererRegistry from '../../Core/Renderer/RendererRegistry.js';
/* *
*
* Composition
*
* */
var FlagsSymbols;
(function (FlagsSymbols) {
/* *
*
* Constants
*
* */
var modifiedMembers = [];
/* *
*
* Functions
*
* */
/* eslint-disable valid-jsdoc */
/**
* @private
*/
function compose(SVGRendererClass) {
if (modifiedMembers.indexOf(SVGRendererClass) === -1) {
modifiedMembers.push(SVGRendererClass);
var symbols = SVGRendererClass.prototype.symbols;
symbols.flag = flag;
createPinSymbol(symbols, 'circle');
createPinSymbol(symbols, 'square');
}
var RendererClass = RendererRegistry.getRendererType();
// The symbol callbacks are generated on the SVGRenderer object in all
// browsers. Even VML browsers need this in order to generate shapes in
// export. Now share them with the VMLRenderer.
if (modifiedMembers.indexOf(RendererClass)) {
modifiedMembers.push(RendererClass);
var symbols = SVGRendererClass.prototype.symbols, vmlSymbols = RendererClass.prototype.symbols;
vmlSymbols.circlepin = symbols.circlepin;
vmlSymbols.flag = symbols.flag.bind(symbols);
vmlSymbols.squarepin = symbols.squarepin;
}
}
FlagsSymbols.compose = compose;
/**
* Create the flag icon with anchor.
* @private
*/
function flag(x, y, w, h, options) {
var anchorX = (options && options.anchorX) || x, anchorY = (options && options.anchorY) || y;
// To do: unwanted any cast because symbols.circle has wrong type, it
// actually returns an SVGPathArray
var path = this.circle(anchorX - 1, anchorY - 1, 2, 2);
path.push(['M', anchorX, anchorY], ['L', x, y + h], ['L', x, y], ['L', x + w, y], ['L', x + w, y + h], ['L', x, y + h], ['Z']);
return path;
}
/**
* Create the circlepin and squarepin icons with anchor.
* @private
*/
function createPinSymbol(symbols, shape) {
symbols[(shape + 'pin')] = function (x, y, w, h, options) {
var anchorX = options && options.anchorX, anchorY = options && options.anchorY;
var path;
// For single-letter flags, make sure circular flags are not taller
// than their width
if (shape === 'circle' && h > w) {
x -= Math.round((h - w) / 2);
w = h;
}
path = (symbols[shape])(x, y, w, h);
if (anchorX && anchorY) {
/**
* If the label is below the anchor, draw the connecting line
* from the top edge of the label, otherwise start drawing from
* the bottom edge
*/
var labelX = anchorX;
if (shape === 'circle') {
labelX = x + w / 2;
}
else {
var startSeg = path[0];
var endSeg = path[1];
if (startSeg[0] === 'M' && endSeg[0] === 'L') {
labelX = (startSeg[1] + endSeg[1]) / 2;
}
}
var labelY = (y > anchorY) ? y : y + h;
path.push([
'M',
labelX,
labelY
], [
'L',
anchorX,
anchorY
]);
path = path.concat(symbols.circle(anchorX - 1, anchorY - 1, 2, 2));
}
return path;
};
}
})(FlagsSymbols || (FlagsSymbols = {}));
/* *
*
* Default Export
*
* */
export default FlagsSymbols;