Skip to content

Commit 01960a1

Browse files
committed
【fix】升级canvg
1 parent f82006b commit 01960a1

13 files changed

+7
-23
lines changed

build/webpack.config.classic.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ module.exports = {
2020
resolve: configBase.resolve,
2121
externals: Object.assign({}, configBase.externals, {
2222
'xlsx': "function(){try{return XLSX}catch(e){return {}}}()",
23-
'canvg': "function(){try{return canvg}catch(e){return {}}}()",
2423
'jsonsql': "function(){try{return jsonsql}catch(e){return {}}}()",
2524
'xml-js': "function(){try{return convert}catch(e){return {}}}()"
2625
}),

build/webpack.config.mapboxgl.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ module.exports = {
3232
'luma.gl': '(function(){try{return luma}catch(e){return {}}})()',
3333
'webgl-debug': '(function(){try{return webgl-debug}catch(e){return {}}})()',
3434
xlsx: 'function(){try{return XLSX}catch(e){return {}}}()',
35-
canvg: 'function(){try{return canvg}catch(e){return {}}}()',
3635
'@turf/turf': 'function(){try{return turf}catch(e){return {}}}()',
3736
jsonsql: 'function(){try{return jsonsql}catch(e){return {}}}()',
3837
'./L7/l7-render': 'function(){try{return L7}catch(e){return {}}}()',

build/webpack.config.maplibregl.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ module.exports = {
3131
'webgl-debug': '(function(){try{return webgl-debug}catch(e){return {}}})()',
3232
'luma.gl': '(function(){try{return luma}catch(e){return {}}})()',
3333
xlsx: 'function(){try{return XLSX}catch(e){return {}}}()',
34-
canvg: 'function(){try{return canvg}catch(e){return {}}}()',
3534
jsonsql: 'function(){try{return jsonsql}catch(e){return {}}}()',
3635
'xml-js': 'function(){try{return convert}catch(e){return {}}}()',
3736
'./L7/l7-render': 'function(){try{return L7}catch(e){return {}}}()',

build/webpack.config.openlayers.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ var externals = [
2323
'luma.gl': '(function(){try{return luma}catch(e){return {}}})()',
2424
'webgl-debug': '(function(){try{return webgl-debug}catch(e){return {}}})()',
2525
xlsx: 'function(){try{return XLSX}catch(e){return {}}}()',
26-
canvg: 'function(){try{return canvg}catch(e){return {}}}()',
2726
jsonsql: 'function(){try{return jsonsql}catch(e){return {}}}()',
2827
three: 'function(){try{return THREE}catch(e){return {}}}()'
2928
}),

dist/mapboxgl/include-mapboxgl.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,6 @@
131131
if (inArray(includes, 'geostats')) {
132132
inputScript(libsurl + '/geostats/geostats.js');
133133
}
134-
if (inArray(includes, 'canvg')) {
135-
inputScript(libsurl + '/canvg/3.0.10/umd.min.js');
136-
}
137134
if (inArray(includes, 'XMLParser')) {
138135
inputScript(libsurl + '/fast-xml-parser/4.2.7/fxparser.min.js');
139136
}

dist/maplibregl/include-maplibregl.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,6 @@
128128
if (inArray(includes, 'geostats')) {
129129
inputScript(libsurl + '/geostats/geostats.js');
130130
}
131-
if (inArray(includes, 'canvg')) {
132-
inputScript(libsurl + '/canvg/3.0.10/umd.min.js');
133-
}
134131
if (inArray(includes, 'LegacyJSONLoader')) {
135132
inputScript(libsurl + '/three/0.110.0/examples/js/loaders/deprecated/LegacyJSONLoader.js');
136133
}

dist/ol/include-ol.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,6 @@
114114
if (inArray(includes, 'geostats')) {
115115
inputScript(libsurl + '/geostats/geostats.js');
116116
}
117-
if (inArray(includes, 'canvg')) {
118-
inputScript(libsurl + '/canvg/3.0.10/umd.min.js');
119-
}
120117
if (inArray(includes, 'tensorflow')) {
121118
inputScript(libsurl + '/tensorflow/3.9.0/tf.min.js');
122119
}

dist/openlayers/include-openlayers.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,6 @@
114114
if (inArray(includes, 'geostats')) {
115115
inputScript(libsurl + '/geostats/geostats.js');
116116
}
117-
if (inArray(includes, 'canvg')) {
118-
inputScript(libsurl + '/canvg/3.0.10/umd.min.js');
119-
}
120117
if (inArray(includes, 'tensorflow')) {
121118
inputScript(libsurl + '/tensorflow/3.9.0/tf.min.js');
122119
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@
145145
"@turf/center": "^6.5.0",
146146
"@turf/meta": "^6.5.0",
147147
"@turf/turf": "6.5.0",
148-
"canvg": "3.0.10",
148+
"canvg": "^4.0.3",
149149
"echarts": "5.5.0",
150150
"fast-xml-parser": "^4.2.7",
151151
"fetch-ie8": "1.5.0",

src/common/mapping/WebMapV2Base.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Canvg from 'canvg';
1+
import { Canvg } from 'canvg';
22
import { coordEach } from '@turf/meta';
33
import difference from 'lodash.difference';
44
import { WebMapService } from './WebMapService';
@@ -548,7 +548,7 @@ export function createWebMapV2BaseExtending(SuperClass = Events, fireField = 'tr
548548
canvas.style.display = 'none';
549549
divDom.appendChild(canvas);
550550
if (svgUrl) {
551-
const canvgs = (window.canvg || {}).default ? window.canvg.default : Canvg;
551+
const canvgs = Canvg;
552552
const ctx = canvas.getContext('2d');
553553
canvgs.from(ctx, svgUrl, {
554554
ignoreMouse: true,

src/common/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"@supermapgis/tile-decryptor": "^1.0.0",
2020
"@turf/center": "^6.5.0",
2121
"@turf/meta": "^6.5.0",
22-
"canvg": "3.0.10",
22+
"canvg": "^4.0.3",
2323
"echarts": "5.5.0",
2424
"fast-xml-parser": "^4.2.7",
2525
"fetch-ie8": "1.5.0",

src/openlayers/core/StyleUtils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { StringExt } from '@supermapgis/iclient-common/commontypes/BaseTypes';
66
import { StyleMap } from '../overlay/vectortile/StyleMap';
77
import { DeafultCanvasStyle } from '../overlay/vectortile/DeafultCanvasStyle';
88
import { Util } from '../core/Util';
9-
import Canvg from 'canvg';
9+
import { Canvg } from 'canvg';
1010
import Style from 'ol/style/Style';
1111
import Icon from 'ol/style/Icon';
1212
import CircleStyle from 'ol/style/Circle';
@@ -966,7 +966,7 @@ export class StyleUtils {
966966
*/
967967
static async getCanvasFromSVG(svgUrl, divDom, callBack) {
968968
//一个图层对应一个canvas
969-
const canvgs = window.canvg && window.canvg.default ? window.canvg.default : Canvg;
969+
const canvgs = Canvg;
970970
let canvas = document.createElement('canvas');
971971
canvas.id = 'dataviz-canvas-' + Util.newGuid(8);
972972
canvas.style.display = "none";

src/openlayers/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"@turf/turf": "6.5.0",
2121
"mapv": "2.0.62",
2222
"ol": "7.5.2",
23-
"canvg": "3.0.10",
23+
"canvg": "^4.0.3",
2424
"lodash.clonedeep": "^4.5.0",
2525
"lodash.remove": "^4.7.0",
2626
"lodash.difference": "^4.5.0",

0 commit comments

Comments
 (0)