Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

remove canvg-browser for now (#4024)

Jason Kentf235d9a7c87f
diff --git a/package-lock.json b/package-lock.json
index 9e5548531..64614025c 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -6,7 +6,7 @@
"packages": {
"": {
"name": "worldview",
- "version": "3.34.0",
+ "version": "3.37.0",
"hasInstallScript": true,
"license": "NASA-1.3",
"dependencies": {
@@ -22,7 +22,6 @@
"bluebird": "3.7.2",
"bootstrap": "4.4.1",
"cachai": "^1.0.2",
- "canvg-browser": "^1.0.0",
"compression": "^1.7.4",
"coordinate-parser": "^1.0.4",
"copy-to-clipboard": "^3.3.1",
@@ -5514,15 +5513,6 @@
}
]
},
- "node_modules/canvg-browser": {
- "version": "1.0.0",
- "license": "MIT",
- "dependencies": {
- "rgbcolor": "0.0.4",
- "stackblur": "^1.0.0",
- "xmldom": "^0.1.22"
- }
- },
"node_modules/capture-exit": {
"version": "2.0.0",
"dev": true,
@@ -18831,13 +18821,6 @@
"node": ">=0.10.0"
}
},
- "node_modules/rgbcolor": {
- "version": "0.0.4",
- "license": "Public Domain",
- "engines": {
- "node": ">= 0.8.15"
- }
- },
"node_modules/rimraf": {
"version": "3.0.2",
"dev": true,
@@ -20676,10 +20659,6 @@
"node": ">=8"
}
},
- "node_modules/stackblur": {
- "version": "1.0.0",
- "license": "BSD-2-Clause"
- },
"node_modules/stackframe": {
"version": "1.2.1",
"dev": true,
@@ -23322,13 +23301,6 @@
"dev": true,
"license": "MIT"
},
- "node_modules/xmldom": {
- "version": "0.1.31",
- "license": "(LGPL-2.0 or MIT)",
- "engines": {
- "node": ">=0.1"
- }
- },
"node_modules/xtend": {
"version": "4.0.2",
"dev": true,
@@ -27221,14 +27193,6 @@
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001409.tgz",
"integrity": "sha512-V0mnJ5dwarmhYv8/MzhJ//aW68UpvnQBXv8lJ2QUsvn2pHcmAuNtu8hQEDz37XnA1iE+lRR9CIfGWWpgJ5QedQ=="
},
- "canvg-browser": {
- "version": "1.0.0",
- "requires": {
- "rgbcolor": "0.0.4",
- "stackblur": "^1.0.0",
- "xmldom": "^0.1.22"
- }
- },
"capture-exit": {
"version": "2.0.0",
"dev": true,
@@ -36237,9 +36201,6 @@
"version": "1.0.4",
"dev": true
},
- "rgbcolor": {
- "version": "0.0.4"
- },
"rimraf": {
"version": "3.0.2",
"dev": true,
@@ -37537,9 +37498,6 @@
}
}
},
- "stackblur": {
- "version": "1.0.0"
- },
"stackframe": {
"version": "1.2.1",
"dev": true
@@ -39351,9 +39309,6 @@
"version": "2.2.0",
"dev": true
},
- "xmldom": {
- "version": "0.1.31"
- },
"xtend": {
"version": "4.0.2",
"dev": true
diff --git a/package.json b/package.json
index e082e792e..d24c75006 100644
--- a/package.json
+++ b/package.json
@@ -171,7 +171,6 @@
"bluebird": "3.7.2",
"bootstrap": "4.4.1",
"cachai": "^1.0.2",
- "canvg-browser": "^1.0.0",
"compression": "^1.7.4",
"coordinate-parser": "^1.0.4",
"copy-to-clipboard": "^3.3.1",
diff --git a/web/js/containers/gif.js b/web/js/containers/gif.js
index 9545e9e94..c2cf47977 100644
--- a/web/js/containers/gif.js
+++ b/web/js/containers/gif.js
@@ -22,7 +22,7 @@ import {
import { TIME_SCALE_FROM_NUMBER } from '../modules/date/constants';
import GifResults from '../components/animation-widget/gif-post-creation';
import getImageArray from '../modules/animation/selectors';
-import { getStampProps, svgToPng, getNumberOfSteps } from '../modules/animation/util';
+import { getStampProps, getNumberOfSteps } from '../modules/animation/util';
import { changeCropBounds } from '../modules/animation/actions';
import { subdailyLayersActive } from '../modules/layers/selectors';
import { formatDisplayDate } from '../modules/date/util';
@@ -194,11 +194,11 @@ class GIF extends Component {
gifWidth: width,
gifHeight: height,
images: imageArray,
- waterMarkXCoordinate: stampHeight * 0.01, // Margin based on GIF Height
- waterMarkYCoordinate: stampHeight * 0.01, // Margin based on GIF Height
- waterMarkHeight: stamp.height,
- waterMark: stampHeight > 20 ? stamp : null,
- waterMarkWidth: stamp.width,
+ // waterMarkXCoordinate: stampHeight * 0.01, // Margin based on GIF Height
+ // waterMarkYCoordinate: stampHeight * 0.01, // Margin based on GIF Height
+ // waterMarkHeight: stamp.height,
+ // waterMark: stampHeight > 20 ? stamp : null,
+ // waterMarkWidth: stamp.width,
fontSize: `${dateStamp.fontSize}px`,
textXCoordinate: dateStamp.x,
textYCoordinate: dateStamp.y, // date location based on Dimensions
@@ -222,6 +222,7 @@ class GIF extends Component {
},
);
};
+
const stampProps = getStampProps(
stampWidthRatio,
breakPointOne,
@@ -230,12 +231,13 @@ class GIF extends Component {
width,
height,
);
- const newImage = svgToPng(
- 'brand/images/wv-logo-w-shadow.svg',
- stampProps.stampHeight,
- );
- build(newImage, stampProps.dateStamp, stampProps.stampHeight);
+ // const newImage = svgToPng(
+ // 'brand/images/wv-logo-w-shadow.svg',
+ // stampProps.stampHeight,
+ // );
+
+ build(undefined, stampProps.dateStamp, stampProps.stampHeight);
this.setState({ isDownloading: true });
}
diff --git a/web/js/modules/animation/util.js b/web/js/modules/animation/util.js
index 96c7e2f90..aff3a820a 100644
--- a/web/js/modules/animation/util.js
+++ b/web/js/modules/animation/util.js
@@ -1,5 +1,4 @@
import { round as lodashRound, get as lodashGet } from 'lodash';
-import canvg from 'canvg-browser';
import update from 'immutability-helper';
import moment from 'moment';
import util from '../../util/util';
@@ -96,21 +95,21 @@ export function getStampProps(
return { stampHeight, dateStamp };
}
-export function svgToPng(svgURL, stampHeight) {
- const canvasEl = document.createElement('canvas');
- const canvgOptions = {
- log: false,
- ignoreMouse: true,
- scaleHeight: stampHeight,
- };
- canvg(canvasEl, svgURL, canvgOptions);
- const newImage = new Image();
- newImage.src = canvasEl.toDataURL('image/png');
- newImage.width = canvasEl.width;
- newImage.height = canvasEl.height;
+// export function svgToPng(svgURL, stampHeight) {
+// const canvasEl = document.createElement('canvas');
+// const canvgOptions = {
+// log: false,
+// ignoreMouse: true,
+// scaleHeight: stampHeight,
+// };
+// canvg(canvasEl, svgURL, canvgOptions);
+// const newImage = new Image();
+// newImage.src = canvasEl.toDataURL('image/png');
+// newImage.width = canvasEl.width;
+// newImage.height = canvasEl.height;
- return newImage;
-}
+// return newImage;
+// }
export function mapLocationToAnimationState(
parameters,