#631 zoom web componenet image path modified

master
agriyadev5 2021-09-21 18:13:38 +05:30
parent 5ed960cb1a
commit 542d1775c3
2 changed files with 20 additions and 5 deletions

View File

@ -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;

View File

@ -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}