@svgedit/svgcanvas 7.2.2 → 7.2.4

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@svgedit/svgcanvas",
3
- "version": "7.2.2",
3
+ "version": "7.2.4",
4
4
  "description": "SVG Canvas",
5
5
  "main": "dist/svgcanvas.js",
6
6
  "author": "Narendra Sisodiya",
package/rollup.config.mjs CHANGED
@@ -6,6 +6,7 @@ import { rimraf } from 'rimraf'
6
6
  import babel from '@rollup/plugin-babel'
7
7
  import { nodeResolve } from '@rollup/plugin-node-resolve'
8
8
  import commonjs from '@rollup/plugin-commonjs'
9
+
9
10
  // import progress from 'rollup-plugin-progress';
10
11
  import filesize from 'rollup-plugin-filesize'
11
12
 
package/svgcanvas.js CHANGED
@@ -308,6 +308,9 @@ class SvgCanvas {
308
308
  this.contentW = this.getResolution().w
309
309
  this.contentH = this.getResolution().h
310
310
  this.clear()
311
+
312
+ // creates custom modeEvent for editor
313
+ this.modeChangeEvent()
311
314
  } // End constructor
312
315
 
313
316
  getSvgOption () {
@@ -827,6 +830,11 @@ class SvgCanvas {
827
830
  ? this.curText
828
831
  : this.curShape
829
832
  this.currentMode = name
833
+
834
+ // fires modeChange event for the editor
835
+ if (this.modeEvent) {
836
+ document.dispatchEvent(this.modeEvent)
837
+ }
830
838
  }
831
839
 
832
840
  /**
@@ -844,7 +852,7 @@ class SvgCanvas {
844
852
  // create new document
845
853
  this.current_drawing_ = new draw.Drawing(this.svgContent)
846
854
  // create empty first layer
847
- this.createLayer('Layer 1')
855
+ this.createLayer()
848
856
  // clear the undo stack
849
857
  this.undoMgr.resetUndoStack()
850
858
  // reset the selector manager
@@ -1283,6 +1291,7 @@ class SvgCanvas {
1283
1291
  this.hasMatrixTransform = hasMatrixTransform
1284
1292
  this.transformListToTransform = transformListToTransform
1285
1293
  this.convertToNum = convertToNum
1294
+ this.convertUnit = convertUnit
1286
1295
  this.findDefs = findDefs
1287
1296
  this.getUrlFromAttr = getUrlFromAttr
1288
1297
  this.getHref = getHref
@@ -1328,6 +1337,14 @@ class SvgCanvas {
1328
1337
  this.decode64 = decode64
1329
1338
  this.mergeDeep = mergeDeep
1330
1339
  }
1340
+
1341
+ /**
1342
+ * Creates modeChange event, adds it as an svgCanvas property
1343
+ * **/
1344
+ modeChangeEvent () {
1345
+ const modeEvent = new CustomEvent('modeChange', { detail: { getMode: () => this.getMode() } })
1346
+ this.modeEvent = modeEvent
1347
+ }
1331
1348
  } // End class
1332
1349
 
1333
1350
  // attach utilities function to the class that are used by SvgEdit so