refactor to class step 1
This commit is contained in:
@@ -15,7 +15,7 @@ class BottomPanelHandlers {
|
||||
*/
|
||||
constructor (editor) {
|
||||
this.editor = editor;
|
||||
this.svgCanvas = editor.canvas;
|
||||
this.svgCanvas = editor.svgCanvas;
|
||||
}
|
||||
/**
|
||||
* @type {module}
|
||||
@@ -178,7 +178,7 @@ class BottomPanelHandlers {
|
||||
*/
|
||||
init () {
|
||||
// register actions for bottom panel
|
||||
$id('zoom').addEventListener('change', (e) => this.changeZoom(e.detail.value).bind(this));
|
||||
$id('zoom').addEventListener('change', (e) => this.changeZoom.bind(this)(e.detail.value));
|
||||
$id('stroke_color').addEventListener('change', (evt) => this.handleColorPicker.bind(this)('stroke', evt));
|
||||
$id('fill_color').addEventListener('change', (evt) => this.handleColorPicker.bind(this)('fill', evt));
|
||||
$id('stroke_width').addEventListener('change', this.changeStrokeWidth.bind(this));
|
||||
|
||||
@@ -14,7 +14,7 @@ class LayersPanel {
|
||||
* @param {PlainObject} editor
|
||||
*/
|
||||
constructor (editor) {
|
||||
this.svgCanvas = editor.canvas;
|
||||
this.svgCanvas = editor.svgCanvas;
|
||||
this.uiStrings = editor.uiStrings;
|
||||
this.updateContextPanel = editor.topPanelHandlers.updateContextPanel;
|
||||
this.sidedrag = -1;
|
||||
@@ -120,7 +120,7 @@ class LayersPanel {
|
||||
this.lmenuFunc.bind(this)(e?.detail?.trigger, e?.detail?.source);
|
||||
});
|
||||
$id('sidepanel_handle').addEventListener('click', this.toggleSidePanel.bind(this));
|
||||
if (this.editor.curConfig.showlayers) {
|
||||
if (this.editor.configObj.curConfig.showlayers) {
|
||||
this.toggleSidePanel();
|
||||
}
|
||||
$id('sidepanel_handle').addEventListener('mousedown', (evt) => {
|
||||
|
||||
@@ -14,7 +14,7 @@ class LeftPanelHandlers {
|
||||
*/
|
||||
constructor (editor) {
|
||||
this.editor = editor;
|
||||
this.svgCanvas = editor.canvas;
|
||||
this.svgCanvas = editor.svgCanvas;
|
||||
}
|
||||
/**
|
||||
* This is a common function used when a tool has been clicked (chosen).
|
||||
|
||||
@@ -16,7 +16,7 @@ class TopPanelHandlers {
|
||||
*/
|
||||
constructor (editor) {
|
||||
this.editor = editor;
|
||||
this.svgCanvas = editor.canvas;
|
||||
this.svgCanvas = editor.svgCanvas;
|
||||
this.uiStrings = editor.uiStrings;
|
||||
}
|
||||
/**
|
||||
@@ -198,7 +198,7 @@ class TopPanelHandlers {
|
||||
|
||||
curPanel.forEach((item) => {
|
||||
let attrVal = elem.getAttribute(item);
|
||||
if (this.editor.curConfig.baseUnit !== 'px' && elem[item]) {
|
||||
if (this.editor.configObj.curConfig.baseUnit !== 'px' && elem[item]) {
|
||||
const bv = elem[item].baseVal.value;
|
||||
attrVal = convertUnit(bv);
|
||||
}
|
||||
@@ -265,8 +265,8 @@ class TopPanelHandlers {
|
||||
}
|
||||
|
||||
// update history buttons
|
||||
$id('tool_undo').disabled = (this.editor.canvas.undoMgr.getUndoStackSize() === 0);
|
||||
$id('tool_redo').disabled = (this.editor.canvas.undoMgr.getRedoStackSize() === 0);
|
||||
$id('tool_undo').disabled = (this.svgCanvas.undoMgr.getUndoStackSize() === 0);
|
||||
$id('tool_redo').disabled = (this.svgCanvas.undoMgr.getRedoStackSize() === 0);
|
||||
|
||||
this.svgCanvas.addedNew = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user