Panning, modeChange Event, minor changes (#939)
* mode event, panning cursor * Panning shortcuts(space,wheel), undo shortcut * Undo/redo shortcuts, svgcanvas changes added to the main file * minor refactoring
This commit is contained in:
@@ -308,6 +308,9 @@ class SvgCanvas {
|
||||
this.contentW = this.getResolution().w
|
||||
this.contentH = this.getResolution().h
|
||||
this.clear()
|
||||
|
||||
// creates custom modeEvent for editor
|
||||
this.modeChangeEvent()
|
||||
} // End constructor
|
||||
|
||||
getSvgOption () {
|
||||
@@ -827,6 +830,11 @@ class SvgCanvas {
|
||||
? this.curText
|
||||
: this.curShape
|
||||
this.currentMode = name
|
||||
|
||||
// fires modeChange event for the editor
|
||||
if (this.modeEvent) {
|
||||
document.dispatchEvent(this.modeEvent)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1328,6 +1336,14 @@ class SvgCanvas {
|
||||
this.decode64 = decode64
|
||||
this.mergeDeep = mergeDeep
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates modeChange event, adds it as an svgCanvas property
|
||||
* **/
|
||||
modeChangeEvent () {
|
||||
const modeEvent = new CustomEvent('modeChange', { detail: { getMode: () => this.getMode() } })
|
||||
this.modeEvent = modeEvent
|
||||
}
|
||||
} // End class
|
||||
|
||||
// attach utilities function to the class that are used by SvgEdit so
|
||||
|
||||
Reference in New Issue
Block a user