react-spatial 1.3.2 → 1.4.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,6 +4,13 @@ import OLMap from "ol/Map";
|
|
|
4
4
|
import { getTopLeft, getBottomRight } from "ol/extent";
|
|
5
5
|
import NorthArrowSimple from "../../images/northArrow.url.svg";
|
|
6
6
|
import NorthArrowCircle from "../../images/northArrowCircle.url.svg";
|
|
7
|
+
const extraDataImgPropType = PropTypes.shape({
|
|
8
|
+
src: PropTypes.string,
|
|
9
|
+
width: PropTypes.number,
|
|
10
|
+
height: PropTypes.number,
|
|
11
|
+
rotation: PropTypes.oneOfType([PropTypes.number, PropTypes.func]),
|
|
12
|
+
circled: PropTypes.bool
|
|
13
|
+
});
|
|
7
14
|
const propTypes = {
|
|
8
15
|
autoDownload: PropTypes.bool,
|
|
9
16
|
children: PropTypes.node,
|
|
@@ -14,7 +21,21 @@ const propTypes = {
|
|
|
14
21
|
scale: PropTypes.number,
|
|
15
22
|
onSaveStart: PropTypes.func,
|
|
16
23
|
onSaveEnd: PropTypes.func,
|
|
17
|
-
extraData: PropTypes.
|
|
24
|
+
extraData: PropTypes.shape({
|
|
25
|
+
logo: extraDataImgPropType,
|
|
26
|
+
northArrow: extraDataImgPropType,
|
|
27
|
+
qrCode: extraDataImgPropType,
|
|
28
|
+
copyright: PropTypes.shape({
|
|
29
|
+
text: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
|
|
30
|
+
font: PropTypes.string,
|
|
31
|
+
fillStyle: PropTypes.oneOfType([
|
|
32
|
+
PropTypes.string,
|
|
33
|
+
PropTypes.instanceOf(CanvasGradient),
|
|
34
|
+
PropTypes.instanceOf(CanvasPattern)
|
|
35
|
+
]),
|
|
36
|
+
background: PropTypes.bool
|
|
37
|
+
})
|
|
38
|
+
})
|
|
18
39
|
};
|
|
19
40
|
const defaultProps = {
|
|
20
41
|
autoDownload: true,
|
|
@@ -38,6 +59,10 @@ class CanvasSaveButton extends PureComponent {
|
|
|
38
59
|
this.fileExt = format === "image/jpeg" ? "jpg" : "png";
|
|
39
60
|
this.padding = 5;
|
|
40
61
|
}
|
|
62
|
+
static getMargin(destCanvas) {
|
|
63
|
+
const newMargin = destCanvas.width / 100;
|
|
64
|
+
return newMargin;
|
|
65
|
+
}
|
|
41
66
|
onClick(evt) {
|
|
42
67
|
const { map, onSaveStart, onSaveEnd, autoDownload } = this.props;
|
|
43
68
|
if (window.navigator.msSaveBlob) {
|
|
@@ -124,7 +149,7 @@ class CanvasSaveButton extends PureComponent {
|
|
|
124
149
|
}
|
|
125
150
|
}
|
|
126
151
|
const secondLine = copyright.replace(firstLine, "");
|
|
127
|
-
const textX = this.
|
|
152
|
+
const textX = this.margin;
|
|
128
153
|
let textMeasure = destContext.measureText(firstLine);
|
|
129
154
|
textMeasure.height = textMeasure.actualBoundingBoxAscent + textMeasure.actualBoundingBoxDescent;
|
|
130
155
|
let firstLineY = destCanvas.height / scale - this.padding;
|
|
@@ -160,9 +185,14 @@ class CanvasSaveButton extends PureComponent {
|
|
|
160
185
|
}
|
|
161
186
|
destContext.fillText(secondLine, textX, secondLineY);
|
|
162
187
|
}
|
|
188
|
+
const firstLineMetrics = destContext.measureText(firstLine);
|
|
189
|
+
const secondLineMetrics = destContext.measureText(secondLine);
|
|
190
|
+
const heightFirstLine = firstLineMetrics.actualBoundingBoxAscent + firstLineMetrics.actualBoundingBoxDescent;
|
|
191
|
+
const heightSecondLine = secondLineMetrics.actualBoundingBoxAscent + secondLineMetrics.actualBoundingBoxDescent;
|
|
192
|
+
this.copyrightY = destCanvas.height - (heightFirstLine + paddingBetweenLines + heightSecondLine) / 2;
|
|
163
193
|
destContext.restore();
|
|
164
194
|
}
|
|
165
|
-
drawElement(data, destCanvas, previousItemSize = [0, 0]) {
|
|
195
|
+
drawElement(data, destCanvas, previousItemSize = [0, 0], side = "right") {
|
|
166
196
|
const destContext = destCanvas.getContext("2d");
|
|
167
197
|
const { scale } = this.props;
|
|
168
198
|
const { src, width, height, rotation } = data;
|
|
@@ -174,10 +204,9 @@ class CanvasSaveButton extends PureComponent {
|
|
|
174
204
|
destContext.save();
|
|
175
205
|
const elementWidth = (width || 80) * scale;
|
|
176
206
|
const elementHeight = (height || 80) * scale;
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
);
|
|
207
|
+
const left = side === "left" ? this.margin + elementWidth / 2 : destCanvas.width - this.margin - elementWidth / 2;
|
|
208
|
+
const top = (side === "left" && this.copyrightY ? this.copyrightY - 2 * this.padding : destCanvas.height) - this.margin - elementHeight / 2 - previousItemSize[1];
|
|
209
|
+
destContext.translate(left, top);
|
|
181
210
|
if (rotation) {
|
|
182
211
|
const angle = typeof rotation === "function" ? rotation() : rotation;
|
|
183
212
|
destContext.rotate(angle * (Math.PI / 180));
|
|
@@ -266,6 +295,7 @@ class CanvasSaveButton extends PureComponent {
|
|
|
266
295
|
destCanvas.height
|
|
267
296
|
);
|
|
268
297
|
}
|
|
298
|
+
this.margin = CanvasSaveButton.getMargin(destCanvas);
|
|
269
299
|
let logoPromise = Promise.resolve();
|
|
270
300
|
if (destContext && extraData && extraData.logo) {
|
|
271
301
|
logoPromise = this.drawElement(extraData.logo, destCanvas);
|
|
@@ -285,10 +315,21 @@ class CanvasSaveButton extends PureComponent {
|
|
|
285
315
|
arrowPromise.then((arrowSize = [0, 0]) => {
|
|
286
316
|
const widestElement = Math.max(logoSize[0], arrowSize[0]);
|
|
287
317
|
if (destContext && extraData && extraData.copyright && extraData.copyright.text) {
|
|
288
|
-
const maxWidth = widestElement ? destContext.canvas.width - widestElement : destContext.canvas.width;
|
|
318
|
+
const maxWidth = widestElement ? destContext.canvas.width - widestElement - this.margin : destContext.canvas.width;
|
|
289
319
|
this.drawCopyright(destContext, destCanvas, maxWidth);
|
|
290
320
|
}
|
|
291
|
-
resolve(
|
|
321
|
+
let qrCodePromise = Promise.resolve();
|
|
322
|
+
if (destContext && extraData && extraData.qrCode) {
|
|
323
|
+
qrCodePromise = this.drawElement(
|
|
324
|
+
extraData.qrCode,
|
|
325
|
+
destCanvas,
|
|
326
|
+
void 0,
|
|
327
|
+
"left"
|
|
328
|
+
);
|
|
329
|
+
}
|
|
330
|
+
qrCodePromise.then(() => {
|
|
331
|
+
return resolve(destCanvas);
|
|
332
|
+
});
|
|
292
333
|
});
|
|
293
334
|
});
|
|
294
335
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/CanvasSaveButton/CanvasSaveButton.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable no-param-reassign */\nimport React, { PureComponent } from 'react';\nimport PropTypes from 'prop-types';\nimport OLMap from 'ol/Map';\nimport { getTopLeft, getBottomRight } from 'ol/extent';\nimport NorthArrowSimple from '../../images/northArrow.url.svg';\nimport NorthArrowCircle from '../../images/northArrowCircle.url.svg';\n\nconst propTypes = {\n /**\n * Automatically download the image saved.\n */\n autoDownload: PropTypes.bool,\n\n /**\n * Children content of the button.\n */\n children: PropTypes.node,\n\n /**\n * Output format of the image.\n */\n format: PropTypes.oneOf(['image/jpeg', 'image/png']),\n\n /** An [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html). */\n map: PropTypes.instanceOf(OLMap),\n\n /**\n * Extent for the export. If no extent is given, the whole map is exported.\n */\n extent: PropTypes.arrayOf(PropTypes.number),\n\n /**\n * Array of 4 [ol/Coordinate](https://openlayers.org/en/latest/apidoc/module-ol_coordinate.html#~Coordinate).\n * If no coordinates and no extent are given, the whole map is exported.\n * This property must be used to export rotated map.\n * If you don't need to export rotated map the extent property can be used as well.\n * If extent is specified, coordinates property is ignored.\n */\n coordinates: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.number)),\n\n /**\n * Scale the map for better quality. Possible values: 1, 2 or 3.\n * WARNING: The tiled layer with a WMTS or XYZ source must provides an url\n * for each scale in the config file.\n */\n scale: PropTypes.number,\n\n /**\n * Function called before the dowload process begins.\n */\n onSaveStart: PropTypes.func,\n\n /**\n * Function called after the dowload process ends.\n *\n * @param {object} error Error message the process fails.\n */\n onSaveEnd: PropTypes.func,\n\n /**\n * Extra data, such as copyright, north arrow configuration.\n * All extra data is optional.\n *\n * Example 1:\n *\n {\n copyright: {\n text: 'Example copyright', // Copyright text or function\n font: '10px Arial', // Font, default is '12px Arial'\n fillStyle: 'blue', // Fill style, default is 'black'\n },\n northArrow, // True if the north arrow\n // should be placed with default configuration\n // (default image, rotation=0, circled=False)\n }\n * Example 2:\n *\n {\n northArrow: {\n src: NorthArrowCustom,\n width: 60, // Width in px, default is 80\n height: 100, // Height in px, default is 80\n rotation: 25, // Absolute rotation in degrees as number or function\n\n }\n }\n * Example 3:\n *\n {\n copyright: {\n text: () => { // Copyright as function\n return this.copyright;\n },\n },\n northArrow: {\n rotation: () => { // Rotation as function\n return NorthArrow.radToDeg(this.map.getView().getRotation());\n },\n circled, // Display circle around the north arrow (Does not work for custom src)\n },\n }\n */\n extraData: PropTypes.object,\n};\n\nconst defaultProps = {\n autoDownload: true,\n children: null,\n map: null,\n format: 'image/png',\n extent: null,\n extraData: null,\n coordinates: null,\n scale: 1,\n onSaveStart: (map) => {\n return Promise.resolve(map);\n },\n onSaveEnd: () => {},\n};\n\n/**\n * The CanvasSaveButton component creates a button to save\n * an [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html)\n * canvas as an image.\n */\nclass CanvasSaveButton extends PureComponent {\n constructor(props) {\n super(props);\n const { format } = this.props;\n this.fileExt = format === 'image/jpeg' ? 'jpg' : 'png';\n this.padding = 5;\n }\n\n onClick(evt) {\n const { map, onSaveStart, onSaveEnd, autoDownload } = this.props;\n if (window.navigator.msSaveBlob) {\n // ie only\n evt.preventDefault();\n evt.stopPropagation();\n }\n onSaveStart(map).then((mapToExport) => {\n return this.createCanvasImage(mapToExport || map)\n .then((canvas) => {\n if (autoDownload) {\n this.downloadCanvasImage(canvas).then((blob) => {\n onSaveEnd(mapToExport, canvas, blob);\n });\n } else {\n onSaveEnd(mapToExport, canvas);\n }\n })\n .catch((err) => {\n if (err) {\n // eslint-disable-next-line no-console\n console.error(err);\n }\n onSaveEnd(mapToExport, err);\n });\n });\n }\n\n getDownloadImageName() {\n return (\n `${window.document.title.replace(/ /g, '_').toLowerCase()}` +\n `.${this.fileExt}`\n );\n }\n\n // Ensure the font size fita with the image width.\n decreaseFontSize(destContext, maxWidth, copyright, scale) {\n const minFontSize = 8;\n let sizeMatch;\n let fontSize;\n do {\n sizeMatch = destContext.font.match(/[0-9]+(?:\\.[0-9]+)?(px)/i);\n fontSize = parseInt(sizeMatch[0].replace(sizeMatch[1], ''), 10);\n\n // eslint-disable-next-line no-param-reassign\n destContext.font = destContext.font.replace(fontSize, fontSize - 1);\n\n if (fontSize - 1 === minFontSize) {\n this.multilineCopyright = true;\n }\n } while (\n fontSize - 1 > minFontSize &&\n destContext.measureText(copyright).width * scale > maxWidth\n );\n\n return destContext.font;\n }\n\n // eslint-disable-next-line class-methods-use-this\n drawTextBackground(\n destContext,\n textMeasure,\n textX,\n textY,\n padding,\n styleOptions = {},\n ) {\n /// get width of text\n const { width, height, actualBoundingBoxAscent } = textMeasure;\n destContext.save();\n // Dflt is a white background\n destContext.fillStyle = 'rgba(255,255,255,.8)';\n\n // To simplify usability the user could pass a boolean to use only default values.\n if (typeof styleOptions === 'object') {\n Object.entries(styleOptions).forEach(([key, value]) => {\n destContext[key] = value;\n });\n }\n\n /// draw background rect assuming height of font\n destContext.fillRect(\n textX - padding,\n textY - actualBoundingBoxAscent - padding,\n width + padding * 2,\n height + padding * 2,\n );\n destContext.restore();\n }\n\n drawCopyright(destContext, destCanvas, maxWidth) {\n const { extraData, scale } = this.props;\n const { text, font, fillStyle, background } = extraData.copyright;\n let copyright = typeof text === 'function' ? text() : text;\n\n if (Array.isArray(copyright)) {\n copyright = copyright.join();\n }\n\n destContext.save();\n destContext.scale(scale, scale);\n destContext.font = font || '12px Arial';\n destContext.font = this.decreaseFontSize(\n destContext,\n maxWidth - this.padding,\n copyright,\n scale,\n );\n\n destContext.scale(scale, scale);\n destContext.fillStyle = fillStyle || 'black';\n\n // We search if the display on 2 line is necessary\n let firstLine = copyright;\n const wordNumber = copyright.split(' ').length;\n\n // If the text is bigger than the max width we split itinto 2 lines\n if (this.multilineCopyright) {\n for (let i = 0; i < wordNumber; i += 1) {\n firstLine = firstLine.substring(0, firstLine.lastIndexOf(' '));\n // Stop removing word when fits within one line.\n if (\n destContext.measureText(firstLine).width * scale <\n maxWidth - this.padding\n ) {\n break;\n }\n }\n }\n const secondLine = copyright.replace(firstLine, '');\n\n // Draw first line (line break isn't supported for fillText).\n const textX = this.padding;\n let textMeasure = destContext.measureText(firstLine);\n textMeasure.height =\n textMeasure.actualBoundingBoxAscent +\n textMeasure.actualBoundingBoxDescent;\n let firstLineY = destCanvas.height / scale - this.padding;\n const secondLineY = firstLineY;\n const paddingBetweenLines = 3;\n const paddingBackground = paddingBetweenLines / 2;\n\n if (secondLine) {\n firstLineY -= textMeasure.height + paddingBetweenLines;\n }\n if (background) {\n this.drawTextBackground(\n destContext,\n textMeasure,\n textX,\n firstLineY,\n paddingBackground,\n background,\n );\n }\n destContext.fillText(firstLine, textX, firstLineY);\n\n // Draw second line.\n if (secondLine) {\n textMeasure = destContext.measureText(secondLine);\n textMeasure.height =\n textMeasure.actualBoundingBoxAscent +\n textMeasure.actualBoundingBoxDescent;\n if (background) {\n this.drawTextBackground(\n destContext,\n textMeasure,\n textX,\n secondLineY,\n paddingBackground,\n background,\n );\n }\n destContext.fillText(secondLine, textX, secondLineY);\n }\n\n destContext.restore();\n }\n\n drawElement(data, destCanvas, previousItemSize = [0, 0]) {\n const destContext = destCanvas.getContext('2d');\n const { scale } = this.props;\n const { src, width, height, rotation } = data;\n\n return new Promise((resolve) => {\n const img = new Image();\n img.crossOrigin = 'Anonymous';\n img.src = src;\n img.onload = () => {\n destContext.save();\n const elementWidth = (width || 80) * scale;\n const elementHeight = (height || 80) * scale;\n destContext.translate(\n destCanvas.width - 2 * this.padding - elementWidth / 2,\n destCanvas.height -\n 2 * this.padding -\n elementHeight / 2 -\n previousItemSize[1],\n );\n\n if (rotation) {\n const angle = typeof rotation === 'function' ? rotation() : rotation;\n destContext.rotate(angle * (Math.PI / 180));\n }\n\n destContext.drawImage(\n img,\n -elementWidth / 2,\n -elementHeight / 2,\n elementWidth,\n elementHeight,\n );\n destContext.restore();\n\n // Return the pixels width of the arrow and the margin right,\n // that must not be occupied by the copyright.\n resolve([\n elementWidth + 2 * this.padding,\n elementHeight + 2 * this.padding,\n ]);\n };\n\n img.onerror = () => {\n resolve();\n };\n });\n }\n\n calculatePixelsToExport(mapToExport) {\n const { extent, coordinates } = this.props;\n let firstCoordinate;\n let oppositeCoordinate;\n\n if (extent) {\n firstCoordinate = getTopLeft(extent);\n oppositeCoordinate = getBottomRight(extent);\n } else if (coordinates) {\n // In case of coordinates coming from DragBox interaction:\n // firstCoordinate is the first coordinate drawn by the user.\n // oppositeCoordinate is the coordinate of the point dragged by the user.\n [firstCoordinate, , oppositeCoordinate] = coordinates;\n }\n\n if (firstCoordinate && oppositeCoordinate) {\n const firstPixel = mapToExport.getPixelFromCoordinate(firstCoordinate);\n const oppositePixel =\n mapToExport.getPixelFromCoordinate(oppositeCoordinate);\n const pixelTopLeft = [\n firstPixel[0] <= oppositePixel[0] ? firstPixel[0] : oppositePixel[0],\n firstPixel[1] <= oppositePixel[1] ? firstPixel[1] : oppositePixel[1],\n ];\n const pixelBottomRight = [\n firstPixel[0] > oppositePixel[0] ? firstPixel[0] : oppositePixel[0],\n firstPixel[1] > oppositePixel[1] ? firstPixel[1] : oppositePixel[1],\n ];\n\n return {\n x: pixelTopLeft[0],\n y: pixelTopLeft[1],\n w: pixelBottomRight[0] - pixelTopLeft[0],\n h: pixelBottomRight[1] - pixelTopLeft[1],\n };\n }\n return null;\n }\n\n createCanvasImage(mapToExport) {\n const { extraData } = this.props;\n\n return new Promise((resolve) => {\n mapToExport.once('rendercomplete', () => {\n // Find all layer canvases and add it to dest canvas.\n const canvases = mapToExport\n .getTargetElement()\n .getElementsByTagName('canvas');\n\n // Create the canvas to export with the good size.\n let destCanvas;\n let destContext;\n\n // canvases is an HTMLCollection, we don't try to transform to array because some compilers like cra doesn't translate it right.\n for (let i = 0; i < canvases.length; i += 1) {\n const canvas = canvases[i];\n if (!canvas.width || !canvas.height) {\n // eslint-disable-next-line no-continue\n continue;\n }\n const clip = this.calculatePixelsToExport(mapToExport) || {\n x: 0,\n y: 0,\n w: canvas.width,\n h: canvas.height,\n };\n\n if (!destCanvas) {\n destCanvas = document.createElement('canvas');\n destCanvas.width = clip.w;\n destCanvas.height = clip.h;\n destContext = destCanvas.getContext('2d');\n }\n\n // Draw canvas to the canvas to export.\n destContext.drawImage(\n canvas,\n clip.x,\n clip.y,\n clip.w,\n clip.h,\n 0,\n 0,\n destCanvas.width,\n destCanvas.height,\n );\n }\n\n // Custom info\n let logoPromise = Promise.resolve();\n if (destContext && extraData && extraData.logo) {\n logoPromise = this.drawElement(extraData.logo, destCanvas);\n }\n\n logoPromise.then((logoSize = [0, 0]) => {\n // North arrow\n let arrowPromise = Promise.resolve();\n if (destContext && extraData && extraData.northArrow) {\n arrowPromise = this.drawElement(\n {\n src: extraData.northArrow.circled\n ? NorthArrowCircle\n : NorthArrowSimple,\n ...extraData.northArrow,\n },\n destCanvas,\n logoSize,\n );\n }\n\n // Copyright\n arrowPromise.then((arrowSize = [0, 0]) => {\n const widestElement = Math.max(logoSize[0], arrowSize[0]);\n if (\n destContext &&\n extraData &&\n extraData.copyright &&\n extraData.copyright.text\n ) {\n const maxWidth = widestElement\n ? destContext.canvas.width - widestElement\n : destContext.canvas.width;\n this.drawCopyright(destContext, destCanvas, maxWidth);\n }\n resolve(destCanvas);\n });\n });\n });\n mapToExport.renderSync();\n });\n }\n\n downloadCanvasImage(canvas) {\n // Use blob for large images\n const promise = new Promise((resolve) => {\n const { format } = this.props;\n if (/msie (9|10)/gi.test(window.navigator.userAgent.toLowerCase())) {\n // ie 9 and 10\n const url = canvas.toDataURL(format);\n const w = window.open('about:blank', '');\n w.document.write(`<img src=\"${url}\" alt=\"from canvas\"/>`);\n resolve(url);\n }\n if (window.navigator.msSaveBlob) {\n // ie 11 and higher\n let image;\n try {\n image = canvas.msToBlob();\n } catch (e) {\n // eslint-disable-next-line no-console\n console.log(e);\n }\n const blob = new Blob([image], {\n type: format,\n });\n resolve(blob);\n window.navigator.msSaveBlob(blob, this.getDownloadImageName());\n } else {\n canvas.toBlob((blob) => {\n const link = document.createElement('a');\n link.download = this.getDownloadImageName();\n link.href = URL.createObjectURL(blob);\n // append child to document for firefox to be able to download.\n document.body.appendChild(link);\n link.click();\n resolve(blob);\n }, format);\n }\n });\n return promise;\n }\n\n render() {\n const { children, ...other } = this.props;\n\n delete other.onSaveStart;\n delete other.onSaveEnd;\n delete other.extraData;\n delete other.extent;\n delete other.format;\n delete other.map;\n delete other.coordinates;\n delete other.autoDownload;\n delete other.scale;\n\n return (\n <div\n role=\"button\"\n className=\"rs-canvas-save-button\"\n tabIndex={0}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...other}\n onClick={(e) => {\n return this.onClick(e);\n }}\n onKeyPress={(e) => {\n return e.which === 13 && this.onClick(e);\n }}\n >\n {children}\n </div>\n );\n }\n}\n\nCanvasSaveButton.propTypes = propTypes;\nCanvasSaveButton.defaultProps = defaultProps;\n\nexport default CanvasSaveButton;\n"],
|
|
5
|
-
"mappings": "AACA,OAAO,SAAS,qBAAqB;AACrC,OAAO,eAAe;AACtB,OAAO,WAAW;AAClB,SAAS,YAAY,sBAAsB;AAC3C,OAAO,sBAAsB;AAC7B,OAAO,sBAAsB;AAE7B,MAAM,YAAY;AAAA,EAIhB,cAAc,UAAU;AAAA,EAKxB,UAAU,UAAU;AAAA,EAKpB,QAAQ,UAAU,MAAM,CAAC,cAAc,WAAW,CAAC;AAAA,EAGnD,KAAK,UAAU,WAAW,KAAK;AAAA,EAK/B,QAAQ,UAAU,QAAQ,UAAU,MAAM;AAAA,EAS1C,aAAa,UAAU,QAAQ,UAAU,QAAQ,UAAU,MAAM,CAAC;AAAA,EAOlE,OAAO,UAAU;AAAA,EAKjB,aAAa,UAAU;AAAA,EAOvB,WAAW,UAAU;AAAA,EA6CrB,WAAW,UAAU;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable no-param-reassign */\nimport React, { PureComponent } from 'react';\nimport PropTypes from 'prop-types';\nimport OLMap from 'ol/Map';\nimport { getTopLeft, getBottomRight } from 'ol/extent';\nimport NorthArrowSimple from '../../images/northArrow.url.svg';\nimport NorthArrowCircle from '../../images/northArrowCircle.url.svg';\n\nconst extraDataImgPropType = PropTypes.shape({\n src: PropTypes.string,\n width: PropTypes.number,\n height: PropTypes.number,\n rotation: PropTypes.oneOfType([PropTypes.number, PropTypes.func]),\n circled: PropTypes.bool,\n});\n\nconst propTypes = {\n /**\n * Automatically download the image saved.\n */\n autoDownload: PropTypes.bool,\n\n /**\n * Children content of the button.\n */\n children: PropTypes.node,\n\n /**\n * Output format of the image.\n */\n format: PropTypes.oneOf(['image/jpeg', 'image/png']),\n\n /** An [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html). */\n map: PropTypes.instanceOf(OLMap),\n\n /**\n * Extent for the export. If no extent is given, the whole map is exported.\n */\n extent: PropTypes.arrayOf(PropTypes.number),\n\n /**\n * Array of 4 [ol/Coordinate](https://openlayers.org/en/latest/apidoc/module-ol_coordinate.html#~Coordinate).\n * If no coordinates and no extent are given, the whole map is exported.\n * This property must be used to export rotated map.\n * If you don't need to export rotated map the extent property can be used as well.\n * If extent is specified, coordinates property is ignored.\n */\n coordinates: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.number)),\n\n /**\n * Scale the map for better quality. Possible values: 1, 2 or 3.\n * WARNING: The tiled layer with a WMTS or XYZ source must provides an url\n * for each scale in the config file.\n */\n scale: PropTypes.number,\n\n /**\n * Function called before the dowload process begins.\n */\n onSaveStart: PropTypes.func,\n\n /**\n * Function called after the dowload process ends.\n *\n * @param {object} error Error message the process fails.\n */\n onSaveEnd: PropTypes.func,\n\n /**\n * Extra data, such as copyright, north arrow configuration.\n * All extra data is optional.\n *\n * Example 1:\n *\n {\n copyright: {\n text: 'Example copyright', // Copyright text or function\n font: '10px Arial', // Font, default is '12px Arial'\n fillStyle: 'blue', // Fill style, default is 'black'\n },\n northArrow, // True if the north arrow\n // should be placed with default configuration\n // (default image, rotation=0, circled=false)\n }\n * Example 2:\n *\n {\n northArrow: {\n src: NorthArrowCustom,\n width: 60, // Width in px, default is 80\n height: 100, // Height in px, default is 80\n rotation: 25, // Absolute rotation in degrees as number or function\n\n }\n }\n * Example 3:\n *\n {\n copyright: {\n text: () => { // Copyright as function\n return this.copyright;\n },\n },\n northArrow: {\n rotation: () => { // Rotation as function\n return NorthArrow.radToDeg(this.map.getView().getRotation());\n },\n circled, // Display circle around the north arrow (Does not work for custom src)\n },\n }\n */\n extraData: PropTypes.shape({\n logo: extraDataImgPropType,\n northArrow: extraDataImgPropType,\n qrCode: extraDataImgPropType,\n copyright: PropTypes.shape({\n text: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),\n font: PropTypes.string,\n fillStyle: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.instanceOf(CanvasGradient),\n PropTypes.instanceOf(CanvasPattern),\n ]),\n background: PropTypes.bool,\n }),\n }),\n};\n\nconst defaultProps = {\n autoDownload: true,\n children: null,\n map: null,\n format: 'image/png',\n extent: null,\n extraData: null,\n coordinates: null,\n scale: 1,\n onSaveStart: (map) => {\n return Promise.resolve(map);\n },\n onSaveEnd: () => {},\n};\n\n/**\n * The CanvasSaveButton component creates a button to save\n * an [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html)\n * canvas as an image.\n */\nclass CanvasSaveButton extends PureComponent {\n constructor(props) {\n super(props);\n const { format } = this.props;\n this.fileExt = format === 'image/jpeg' ? 'jpg' : 'png';\n this.padding = 5;\n }\n\n static getMargin(destCanvas) {\n const newMargin = destCanvas.width / 100; // 1% of the canvas width\n return newMargin;\n }\n\n onClick(evt) {\n const { map, onSaveStart, onSaveEnd, autoDownload } = this.props;\n if (window.navigator.msSaveBlob) {\n // ie only\n evt.preventDefault();\n evt.stopPropagation();\n }\n onSaveStart(map).then((mapToExport) => {\n return this.createCanvasImage(mapToExport || map)\n .then((canvas) => {\n if (autoDownload) {\n this.downloadCanvasImage(canvas).then((blob) => {\n onSaveEnd(mapToExport, canvas, blob);\n });\n } else {\n onSaveEnd(mapToExport, canvas);\n }\n })\n .catch((err) => {\n if (err) {\n // eslint-disable-next-line no-console\n console.error(err);\n }\n onSaveEnd(mapToExport, err);\n });\n });\n }\n\n getDownloadImageName() {\n return (\n `${window.document.title.replace(/ /g, '_').toLowerCase()}` +\n `.${this.fileExt}`\n );\n }\n\n // Ensure the font size fita with the image width.\n decreaseFontSize(destContext, maxWidth, copyright, scale) {\n const minFontSize = 8;\n let sizeMatch;\n let fontSize;\n do {\n sizeMatch = destContext.font.match(/[0-9]+(?:\\.[0-9]+)?(px)/i);\n fontSize = parseInt(sizeMatch[0].replace(sizeMatch[1], ''), 10);\n\n // eslint-disable-next-line no-param-reassign\n destContext.font = destContext.font.replace(fontSize, fontSize - 1);\n\n if (fontSize - 1 === minFontSize) {\n this.multilineCopyright = true;\n }\n } while (\n fontSize - 1 > minFontSize &&\n destContext.measureText(copyright).width * scale > maxWidth\n );\n\n return destContext.font;\n }\n\n // eslint-disable-next-line class-methods-use-this\n drawTextBackground(\n destContext,\n textMeasure,\n textX,\n textY,\n padding,\n styleOptions = {},\n ) {\n /// get width of text\n const { width, height, actualBoundingBoxAscent } = textMeasure;\n destContext.save();\n // Dflt is a white background\n destContext.fillStyle = 'rgba(255,255,255,.8)';\n\n // To simplify usability the user could pass a boolean to use only default values.\n if (typeof styleOptions === 'object') {\n Object.entries(styleOptions).forEach(([key, value]) => {\n destContext[key] = value;\n });\n }\n\n /// draw background rect assuming height of font\n destContext.fillRect(\n textX - padding,\n textY - actualBoundingBoxAscent - padding,\n width + padding * 2,\n height + padding * 2,\n );\n destContext.restore();\n }\n\n drawCopyright(destContext, destCanvas, maxWidth) {\n const { extraData, scale } = this.props;\n const { text, font, fillStyle, background } = extraData.copyright;\n let copyright = typeof text === 'function' ? text() : text;\n\n if (Array.isArray(copyright)) {\n copyright = copyright.join();\n }\n\n destContext.save();\n destContext.scale(scale, scale);\n destContext.font = font || '12px Arial';\n destContext.font = this.decreaseFontSize(\n destContext,\n maxWidth - this.padding,\n copyright,\n scale,\n );\n\n destContext.scale(scale, scale);\n destContext.fillStyle = fillStyle || 'black';\n\n // We search if the display on 2 line is necessary\n let firstLine = copyright;\n const wordNumber = copyright.split(' ').length;\n\n // If the text is bigger than the max width we split it into 2 lines\n if (this.multilineCopyright) {\n for (let i = 0; i < wordNumber; i += 1) {\n firstLine = firstLine.substring(0, firstLine.lastIndexOf(' '));\n // Stop removing word when fits within one line.\n if (\n destContext.measureText(firstLine).width * scale <\n maxWidth - this.padding\n ) {\n break;\n }\n }\n }\n const secondLine = copyright.replace(firstLine, '');\n\n // Draw first line (line break isn't supported for fillText).\n const textX = this.margin;\n let textMeasure = destContext.measureText(firstLine);\n textMeasure.height =\n textMeasure.actualBoundingBoxAscent +\n textMeasure.actualBoundingBoxDescent;\n let firstLineY = destCanvas.height / scale - this.padding;\n const secondLineY = firstLineY;\n const paddingBetweenLines = 3;\n const paddingBackground = paddingBetweenLines / 2;\n\n if (secondLine) {\n firstLineY -= textMeasure.height + paddingBetweenLines;\n }\n if (background) {\n this.drawTextBackground(\n destContext,\n textMeasure,\n textX,\n firstLineY,\n paddingBackground,\n background,\n );\n }\n destContext.fillText(firstLine, textX, firstLineY);\n\n // Draw second line.\n if (secondLine) {\n textMeasure = destContext.measureText(secondLine);\n textMeasure.height =\n textMeasure.actualBoundingBoxAscent +\n textMeasure.actualBoundingBoxDescent;\n if (background) {\n this.drawTextBackground(\n destContext,\n textMeasure,\n textX,\n secondLineY,\n paddingBackground,\n background,\n );\n }\n destContext.fillText(secondLine, textX, secondLineY);\n }\n\n const firstLineMetrics = destContext.measureText(firstLine);\n const secondLineMetrics = destContext.measureText(secondLine);\n const heightFirstLine =\n firstLineMetrics.actualBoundingBoxAscent +\n firstLineMetrics.actualBoundingBoxDescent;\n const heightSecondLine =\n secondLineMetrics.actualBoundingBoxAscent +\n secondLineMetrics.actualBoundingBoxDescent;\n this.copyrightY =\n destCanvas.height -\n (heightFirstLine + paddingBetweenLines + heightSecondLine) / 2;\n destContext.restore();\n }\n\n drawElement(data, destCanvas, previousItemSize = [0, 0], side = 'right') {\n const destContext = destCanvas.getContext('2d');\n const { scale } = this.props;\n const { src, width, height, rotation } = data;\n\n return new Promise((resolve) => {\n const img = new Image();\n img.crossOrigin = 'Anonymous';\n img.src = src;\n img.onload = () => {\n destContext.save();\n const elementWidth = (width || 80) * scale;\n const elementHeight = (height || 80) * scale;\n const left =\n side === 'left'\n ? this.margin + elementWidth / 2\n : destCanvas.width - this.margin - elementWidth / 2;\n const top =\n (side === 'left' && this.copyrightY\n ? this.copyrightY - 2 * this.padding\n : destCanvas.height) -\n this.margin -\n elementHeight / 2 -\n previousItemSize[1];\n\n destContext.translate(left, top);\n\n if (rotation) {\n const angle = typeof rotation === 'function' ? rotation() : rotation;\n destContext.rotate(angle * (Math.PI / 180));\n }\n\n destContext.drawImage(\n img,\n -elementWidth / 2,\n -elementHeight / 2,\n elementWidth,\n elementHeight,\n );\n destContext.restore();\n\n // Return the pixels width of the arrow and the margin right,\n // that must not be occupied by the copyright.\n resolve([\n elementWidth + 2 * this.padding,\n elementHeight + 2 * this.padding,\n ]);\n };\n\n img.onerror = () => {\n resolve();\n };\n });\n }\n\n calculatePixelsToExport(mapToExport) {\n const { extent, coordinates } = this.props;\n let firstCoordinate;\n let oppositeCoordinate;\n\n if (extent) {\n firstCoordinate = getTopLeft(extent);\n oppositeCoordinate = getBottomRight(extent);\n } else if (coordinates) {\n // In case of coordinates coming from DragBox interaction:\n // firstCoordinate is the first coordinate drawn by the user.\n // oppositeCoordinate is the coordinate of the point dragged by the user.\n [firstCoordinate, , oppositeCoordinate] = coordinates;\n }\n\n if (firstCoordinate && oppositeCoordinate) {\n const firstPixel = mapToExport.getPixelFromCoordinate(firstCoordinate);\n const oppositePixel =\n mapToExport.getPixelFromCoordinate(oppositeCoordinate);\n const pixelTopLeft = [\n firstPixel[0] <= oppositePixel[0] ? firstPixel[0] : oppositePixel[0],\n firstPixel[1] <= oppositePixel[1] ? firstPixel[1] : oppositePixel[1],\n ];\n const pixelBottomRight = [\n firstPixel[0] > oppositePixel[0] ? firstPixel[0] : oppositePixel[0],\n firstPixel[1] > oppositePixel[1] ? firstPixel[1] : oppositePixel[1],\n ];\n\n return {\n x: pixelTopLeft[0],\n y: pixelTopLeft[1],\n w: pixelBottomRight[0] - pixelTopLeft[0],\n h: pixelBottomRight[1] - pixelTopLeft[1],\n };\n }\n return null;\n }\n\n createCanvasImage(mapToExport) {\n const { extraData } = this.props;\n\n return new Promise((resolve) => {\n mapToExport.once('rendercomplete', () => {\n // Find all layer canvases and add it to dest canvas.\n const canvases = mapToExport\n .getTargetElement()\n .getElementsByTagName('canvas');\n\n // Create the canvas to export with the good size.\n let destCanvas;\n let destContext;\n\n // canvases is an HTMLCollection, we don't try to transform to array because some compilers like cra doesn't translate it right.\n for (let i = 0; i < canvases.length; i += 1) {\n const canvas = canvases[i];\n if (!canvas.width || !canvas.height) {\n // eslint-disable-next-line no-continue\n continue;\n }\n const clip = this.calculatePixelsToExport(mapToExport) || {\n x: 0,\n y: 0,\n w: canvas.width,\n h: canvas.height,\n };\n\n if (!destCanvas) {\n destCanvas = document.createElement('canvas');\n destCanvas.width = clip.w;\n destCanvas.height = clip.h;\n destContext = destCanvas.getContext('2d');\n }\n\n // Draw canvas to the canvas to export.\n destContext.drawImage(\n canvas,\n clip.x,\n clip.y,\n clip.w,\n clip.h,\n 0,\n 0,\n destCanvas.width,\n destCanvas.height,\n );\n }\n\n this.margin = CanvasSaveButton.getMargin(destCanvas);\n\n // Custom info\n let logoPromise = Promise.resolve();\n if (destContext && extraData && extraData.logo) {\n logoPromise = this.drawElement(extraData.logo, destCanvas);\n }\n\n logoPromise.then((logoSize = [0, 0]) => {\n // North arrow\n let arrowPromise = Promise.resolve();\n if (destContext && extraData && extraData.northArrow) {\n arrowPromise = this.drawElement(\n {\n src: extraData.northArrow.circled\n ? NorthArrowCircle\n : NorthArrowSimple,\n ...extraData.northArrow,\n },\n destCanvas,\n logoSize,\n );\n }\n\n // Copyright\n arrowPromise.then((arrowSize = [0, 0]) => {\n const widestElement = Math.max(logoSize[0], arrowSize[0]);\n if (\n destContext &&\n extraData &&\n extraData.copyright &&\n extraData.copyright.text\n ) {\n const maxWidth = widestElement\n ? destContext.canvas.width - widestElement - this.margin\n : destContext.canvas.width;\n this.drawCopyright(destContext, destCanvas, maxWidth);\n }\n let qrCodePromise = Promise.resolve();\n if (destContext && extraData && extraData.qrCode) {\n qrCodePromise = this.drawElement(\n extraData.qrCode,\n destCanvas,\n undefined,\n 'left',\n );\n }\n qrCodePromise.then(() => {\n return resolve(destCanvas);\n });\n });\n });\n });\n mapToExport.renderSync();\n });\n }\n\n downloadCanvasImage(canvas) {\n // Use blob for large images\n const promise = new Promise((resolve) => {\n const { format } = this.props;\n if (/msie (9|10)/gi.test(window.navigator.userAgent.toLowerCase())) {\n // ie 9 and 10\n const url = canvas.toDataURL(format);\n const w = window.open('about:blank', '');\n w.document.write(`<img src=\"${url}\" alt=\"from canvas\"/>`);\n resolve(url);\n }\n if (window.navigator.msSaveBlob) {\n // ie 11 and higher\n let image;\n try {\n image = canvas.msToBlob();\n } catch (e) {\n // eslint-disable-next-line no-console\n console.log(e);\n }\n const blob = new Blob([image], {\n type: format,\n });\n resolve(blob);\n window.navigator.msSaveBlob(blob, this.getDownloadImageName());\n } else {\n canvas.toBlob((blob) => {\n const link = document.createElement('a');\n link.download = this.getDownloadImageName();\n link.href = URL.createObjectURL(blob);\n // append child to document for firefox to be able to download.\n document.body.appendChild(link);\n link.click();\n resolve(blob);\n }, format);\n }\n });\n return promise;\n }\n\n render() {\n const { children, ...other } = this.props;\n\n delete other.onSaveStart;\n delete other.onSaveEnd;\n delete other.extraData;\n delete other.extent;\n delete other.format;\n delete other.map;\n delete other.coordinates;\n delete other.autoDownload;\n delete other.scale;\n\n return (\n <div\n role=\"button\"\n className=\"rs-canvas-save-button\"\n tabIndex={0}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...other}\n onClick={(e) => {\n return this.onClick(e);\n }}\n onKeyPress={(e) => {\n return e.which === 13 && this.onClick(e);\n }}\n >\n {children}\n </div>\n );\n }\n}\n\nCanvasSaveButton.propTypes = propTypes;\nCanvasSaveButton.defaultProps = defaultProps;\n\nexport default CanvasSaveButton;\n"],
|
|
5
|
+
"mappings": "AACA,OAAO,SAAS,qBAAqB;AACrC,OAAO,eAAe;AACtB,OAAO,WAAW;AAClB,SAAS,YAAY,sBAAsB;AAC3C,OAAO,sBAAsB;AAC7B,OAAO,sBAAsB;AAE7B,MAAM,uBAAuB,UAAU,MAAM;AAAA,EAC3C,KAAK,UAAU;AAAA,EACf,OAAO,UAAU;AAAA,EACjB,QAAQ,UAAU;AAAA,EAClB,UAAU,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,IAAI,CAAC;AAAA,EAChE,SAAS,UAAU;AACrB,CAAC;AAED,MAAM,YAAY;AAAA,EAIhB,cAAc,UAAU;AAAA,EAKxB,UAAU,UAAU;AAAA,EAKpB,QAAQ,UAAU,MAAM,CAAC,cAAc,WAAW,CAAC;AAAA,EAGnD,KAAK,UAAU,WAAW,KAAK;AAAA,EAK/B,QAAQ,UAAU,QAAQ,UAAU,MAAM;AAAA,EAS1C,aAAa,UAAU,QAAQ,UAAU,QAAQ,UAAU,MAAM,CAAC;AAAA,EAOlE,OAAO,UAAU;AAAA,EAKjB,aAAa,UAAU;AAAA,EAOvB,WAAW,UAAU;AAAA,E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