From f063b978da08f188e89e583623cb635dce4c5bbe Mon Sep 17 00:00:00 2001 From: Agriya Dev5 Date: Fri, 4 Dec 2020 17:58:49 +0530 Subject: [PATCH] #se-menu button size changed --- src/editor/components/seMenu.js | 49 +++++++++++++++++++++++++++++++-- src/editor/index.html | 30 ++++++++++---------- src/editor/svgedit.css | 7 ----- 3 files changed, 61 insertions(+), 25 deletions(-) diff --git a/src/editor/components/seMenu.js b/src/editor/components/seMenu.js index 963f079e..ccecd6c8 100644 --- a/src/editor/components/seMenu.js +++ b/src/editor/components/seMenu.js @@ -12,9 +12,12 @@ template.innerHTML = ` elix-menu-button::part(menu) { background-color: #eee !important; } + elix-menu-button::part(popup-toggle) { + padding: 0.40em 1.75em !important; + } - + @@ -32,15 +35,55 @@ export class SeMenu extends HTMLElement { this._shadowRoot = this.attachShadow({mode: 'open'}); this._shadowRoot.appendChild(template.content.cloneNode(true)); this.$menu = this._shadowRoot.querySelector('elix-menu-button'); - console.log(this.$menu); + this.$label = this.$menu.shadowRoot.querySelector('#popupToggle').shadowRoot; + } + /** + * @function observedAttributes + * @returns {any} observed + */ + static get observedAttributes () { + return ['label']; } + /** + * @function attributeChangedCallback + * @param {string} name + * @param {string} oldValue + * @param {string} newValue + * @returns {void} + */ + attributeChangedCallback (name, oldValue, newValue) { + if (oldValue === newValue) return; + switch (name) { + case 'label': + this.$label.prepend(newValue); + break; + default: + // eslint-disable-next-line no-console + console.error(`unknown attribute: ${name}`); + break; + } + } + /** + * @function get + * @returns {any} + */ + get label () { + return this.getAttribute('label'); + } + + /** + * @function set + * @returns {void} + */ + set label (value) { + this.setAttribute('label', value); + } /** * @function connectedCallback * @returns {void} */ connectedCallback () { - console.log("connectedCallback"); this.$menu.addEventListener('openedchange', (e) => { e.preventDefault(); const selectedItem = e?.detail?.closeResult; diff --git a/src/editor/index.html b/src/editor/index.html index d7691e75..95063f5d 100644 --- a/src/editor/index.html +++ b/src/editor/index.html @@ -74,15 +74,24 @@
L a y e r s
- -
+ + + + + + + + + + + +
  • @@ -123,18 +132,9 @@
-
- - - - - - - - - - - + + --> +
diff --git a/src/editor/svgedit.css b/src/editor/svgedit.css index b8787f1d..9ffdce45 100644 --- a/src/editor/svgedit.css +++ b/src/editor/svgedit.css @@ -281,13 +281,6 @@ hr { z-index: 5; } -#mainmenu1 { - position: absolute; - top: 4px; - left: 355px; - z-index: 5; -} - #main_icon { position: relative; top: -2px;