diff --git a/src/editor/components/seZoom.js b/src/editor/components/seZoom.js index c875374b..267bb8d6 100644 --- a/src/editor/components/seZoom.js +++ b/src/editor/components/seZoom.js @@ -59,6 +59,17 @@ class Zoom extends ListComboBox { ); return result; } + /** + * @function init + * @param {any} name + * @returns {void} + */ + init (editor) { + this.editor = editor; + if (this.hasAttribute("src")) { + this.setAttribute('src', this.getAttribute("src")); + } + } /** * @function observedAttributes * @returns {any} observed @@ -74,13 +85,16 @@ class Zoom extends ListComboBox { * @returns {void} */ attributeChangedCallback (name, oldValue, newValue) { - if (oldValue === newValue) return; + if (oldValue === newValue && name !== "src") return; switch (name) { case 'title': // this.$span.setAttribute('title', `${newValue} ${shortcut ? `[${shortcut}]` : ''}`); break; case 'src': - this.src = './images/' + newValue; + if (this.editor !== null && this.editor !== undefined) { + const { imgPath } = this.editor.configObj.curConfig; + this.src = imgPath + '/' + newValue; + } break; case 'inputsize': this.inputsize = newValue; diff --git a/src/editor/panels/BottomPanel.js b/src/editor/panels/BottomPanel.js index d44ad638..941cc275 100644 --- a/src/editor/panels/BottomPanel.js +++ b/src/editor/panels/BottomPanel.js @@ -218,10 +218,11 @@ class BottomPanel { $id('opacity').addEventListener('change', this.handleOpacity.bind(this)); $id('fill_color').init(i18next, this.editor); $id('stroke_color').init(i18next, this.editor); + $id('zoom').init(this.editor); // eslint-disable-next-line max-len - [ "linejoin_miter", "linejoin_round", "linejoin_bevel", "linecap_butt", "linecap_square", "linecap_round" ].forEach((attrId) => - $id(attrId).init(this.editor) - ); + [ "linejoin_miter", "linejoin_round", "linejoin_bevel", "linecap_butt", "linecap_square", "linecap_round" ].forEach((attrId) => { + $id(attrId).init(this.editor); + }); } /** * @type {module}