diff --git a/src/editor/components/seFlyingButton.js b/src/editor/components/seFlyingButton.js index 2bb11fad..da380e9e 100644 --- a/src/editor/components/seFlyingButton.js +++ b/src/editor/components/seFlyingButton.js @@ -15,7 +15,7 @@ template.innerHTML = ` } .overall.pressed .button-icon, .overall.pressed .handle { - background-color: #000 !important; + background-color: #F4E284 !important; } .overall.pressed .menu-button { box-shadow: inset 1px 1px 2px rgba(0,0,0,0.4), 1px 1px 0 white !important; @@ -106,7 +106,7 @@ export class FlyingButton extends HTMLElement { * @returns {any} observed */ static get observedAttributes () { - return ['title', 'src', 'pressed', 'disabled']; + return ['title', 'pressed', 'disabled']; } /** * @function attributeChangedCallback @@ -124,9 +124,6 @@ export class FlyingButton extends HTMLElement { this.$button.setAttribute('title', `${newValue} [${shortcut}]`); } break; - case 'src': - this.$img.setAttribute('src', newValue); - break; case 'pressed': if (newValue) { this.$overall.classList.add('pressed'); @@ -202,21 +199,6 @@ export class FlyingButton extends HTMLElement { this.removeAttribute('disabled', ''); } } - /** - * @function get - * @returns {any} - */ - get src () { - return this.getAttribute('src'); - } - - /** - * @function set - * @returns {void} - */ - set src (value) { - this.setAttribute('src', value); - } /** * @function connectedCallback * @returns {void} @@ -224,6 +206,7 @@ export class FlyingButton extends HTMLElement { connectedCallback () { // initialize currentAction with the first slot of the list this.activeSlot = this.shadowRoot.querySelector('slot').assignedElements()[0]; + this.$img.setAttribute('src', this.activeSlot.getAttribute('src')); // capture click event on the button to manage the logic const onClickHandler = (ev) => { switch (ev.target.nodeName) { @@ -237,17 +220,16 @@ export class FlyingButton extends HTMLElement { } break; case 'SE-BUTTON': - console.log('change current action'); - // change icon to the current action and close the menu + // change to the current action this.setAttribute('src', ev.target.getAttribute('src')); this.currentAction = ev.target; this.setAttribute('pressed', 'pressed'); + // and close the menu this.$menu.classList.remove('open'); break; default: - console.log(ev.target, ev.target.className); - this.$menu.classList.remove('open'); - this.setAttribute('pressed', 'pressed'); + // eslint-disable-next-line no-console + console.error('unkonw nodeName for:', ev.target, ev.target.className); } }; // capture event from slots diff --git a/src/editor/extensions/ext-connector/ext-connector.js b/src/editor/extensions/ext-connector/ext-connector.js index fbaf25fe..094a9618 100644 --- a/src/editor/extensions/ext-connector/ext-connector.js +++ b/src/editor/extensions/ext-connector/ext-connector.js @@ -349,13 +349,7 @@ export default { const buttons = [{ id: 'mode_connect', - type: 'mode', - icon: svgEditor.curConfig.imgPath + 'cut.png', - includeWith: { - button: '#tool_line', - isDefault: false, - position: 1 - }, + type: 'mode_flyout', events: { click () { svgCanvas.setMode('connector'); @@ -364,6 +358,8 @@ export default { }]; const strings = await loadExtensionTranslation(svgEditor.curPrefs.lang); return { + /** @todo JFH special flag */ + newUI: true, name: strings.name, svgicons: 'conn.svg', buttons: strings.buttons.map((button, i) => { diff --git a/src/editor/extensions/ext-imagelib/ext-imagelib.js b/src/editor/extensions/ext-imagelib/ext-imagelib.js index 13ae02dd..82135fc3 100644 --- a/src/editor/extensions/ext-imagelib/ext-imagelib.js +++ b/src/editor/extensions/ext-imagelib/ext-imagelib.js @@ -454,7 +454,7 @@ export default { const buttons = [{ id: 'tool_imagelib', - type: 'app_menu', // _flyout + type: 'app_menu', icon: 'imagelib.png', position: 4, events: { diff --git a/src/editor/extensions/ext-shapes/ext-shapes.js b/src/editor/extensions/ext-shapes/ext-shapes.js index a65f2601..f146d84a 100644 --- a/src/editor/extensions/ext-shapes/ext-shapes.js +++ b/src/editor/extensions/ext-shapes/ext-shapes.js @@ -156,7 +156,7 @@ export default { const buttons = [{ id: 'tool_shapelib', icon: 'shapes.png', - type: 'mode_flyout', // _flyout + type: 'mode_flyout', position: 6, events: { click () { @@ -214,7 +214,6 @@ export default { if (!btn.length) { return; } const copy = btn.children().clone(); - shower.children(':not(.flyout_arrow_horiz)').remove(); shower .append(copy) .attr('data-curopt', '#' + btn[0].id) // This sets the current mode @@ -223,8 +222,6 @@ export default { curShapeId = btn[0].id.substr((modeId + '_').length); currentD = curLib.data[curShapeId]; - - $('.tools_flyout').fadeOut(); }); const shapeCats = $('