Skip to content

Commit

Permalink
fix #66
Browse files Browse the repository at this point in the history
  • Loading branch information
jfhenon committed Jan 9, 2021
1 parent b439822 commit f7eb364
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 77 deletions.
39 changes: 36 additions & 3 deletions src/editor/components/seFlyingButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export class FlyingButton extends HTMLElement {
* @returns {any} observed
*/
static get observedAttributes () {
return ['title', 'pressed', 'disabled'];
return ['title', 'pressed', 'disabled', 'opened'];
}
/**
* @function attributeChangedCallback
Expand All @@ -132,6 +132,13 @@ export class FlyingButton extends HTMLElement {
this.$overall.classList.remove('pressed');
}
break;
case 'opened':
if (newValue) {
this.$menu.classList.add('open');
} else {
this.$menu.classList.remove('open');
}
break;
case 'disabled':
if (newValue) {
this.$div.classList.add('disabled');
Expand Down Expand Up @@ -178,6 +185,28 @@ export class FlyingButton extends HTMLElement {
this.setAttribute('pressed', 'true');
} else {
this.removeAttribute('pressed', '');
// close also the menu if open
this.removeAttribute('opened');
}
}
/**
* @function get
* @returns {any}
*/
get opened () {
return this.hasAttribute('opened');
}

/**
* @function set
* @returns {void}
*/
set opened (value) {
// boolean value => existence = true
if (value) {
this.setAttribute('opened', 'opened');
} else {
this.removeAttribute('opened');
}
}
/**
Expand Down Expand Up @@ -214,7 +243,7 @@ export class FlyingButton extends HTMLElement {
switch (ev.target.nodeName) {
case 'SE-FLYINGBUTTON':
if (this.pressed) {
this.$menu.classList.toggle('open');
this.setAttribute('opened', 'opened');
} else {
// launch current action
this.activeSlot.click();
Expand All @@ -231,7 +260,11 @@ export class FlyingButton extends HTMLElement {
break;
case 'DIV':
// this is a click on the handle so let's open/close the menu.
this.$menu.classList.toggle('open');
if (this.opened) {
this.removeAttribute('opened');
} else {
this.setAttribute('opened', 'opened');
}
break;
default:
// eslint-disable-next-line no-console
Expand Down
2 changes: 1 addition & 1 deletion src/editor/components/seSpinInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ template.innerHTML = `
<style>
img {
position: relative;
margin:0 2px 0 0;
right: -4px;
}
span {
bottom: 1px;
Expand Down
121 changes: 49 additions & 72 deletions src/editor/svgedit.css
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,52 @@ hr {
margin-top: 5px;
}

#tools_top > div > * {
float: left;
margin-right: 2px;
}
#tools_top se-input {
margin-top: 6px;
height: 15px;
}
#tools_top se-spin-input {
margin-top: 5px;
height: 15px;
}

#tools_top se-dropdown-list {
margin-top: 5px;
height: 15px;
}

/*—————————————————————————————*/

#tools_bottom {
position: absolute;
left: 40px;
right: 0;
bottom: 0;
height: 33px;
overflow: visible;
}

#tools_bottom * {
float: left;
margin-right: 2px;
}

#tools_bottom se-spin-input {
float: left;
vertical-align: middle;
display:flex;
align-items: center;
}
#tools_bottom elix-dropdown-list{
width:22px;
}

/*—————————————————————————————*/

#tools_left {
position: absolute;
border-right: none;
Expand All @@ -319,10 +365,12 @@ hr {
left: 1px;
margin-top: -2px;
padding-left: 2px;
background: --main-bg-color; /* Needed so flyout icons don't appear on the left */
background: --main-bg-color;
z-index: 4;
}

/*—————————————————————————————*/

#workarea.wireframe #svgcontent * {
fill: none;
stroke: #000;
Expand All @@ -343,11 +391,6 @@ hr {
fill: #FFF !important;
}

#tools_top div[id$="_panel"]:not(#editor_panel):not(#history_panel) {
display: none;
float: left;
}

#editor_panel, #history_panel {
height: 34px;
float: left;
Expand Down Expand Up @@ -396,20 +439,7 @@ div.toolset label span {
display: inline-block;
}

#tools_top > div > * {
float: left;
margin-right: 2px;
}

#tools_top label {
margin-top: 0;
margin-left: 5px;
}

#tools_top se-input, #tools_top se-spin-input {
margin-top: 5px;
height: 15px;
}

input[type=text] {
padding: 2px;
Expand Down Expand Up @@ -521,16 +551,6 @@ input[type=text] {
height: 24px;
}

.icon_label {
float: left;
padding-top: 3px;
padding-right: 3px;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
height: 0;
}

.width_label {
padding-right: 5px;
}
Expand All @@ -545,29 +565,6 @@ input[type=text] {
display: none;
}

#tools_bottom {
position: absolute;
left: 40px;
right: 0;
bottom: 0;
height: 33px;
overflow: visible;
}

#tools_bottom * {
float: left;
margin-right: 2px;
}

#tools_bottom se-spin-input {
float: left;
vertical-align: middle;
display:flex;
align-items: center;
}
#tools_bottom elix-dropdown-list{
width:22px;
}
.bottom-icon {
width: 22px;
}
Expand Down Expand Up @@ -718,24 +715,4 @@ ul li.current {
z-index: 20001;
}

@media screen and (max-width: 1250px) {
#tools_top {
height: 71px;
}
#workarea, #sidepanels {
top: 70px;
}

#tools_left {
top: 71px;
}

#cur_context_panel {
top: 87px;
}

#selected_panel {
clear: right;
}
}

2 changes: 1 addition & 1 deletion src/editor/svgedit.js
Original file line number Diff line number Diff line change
Expand Up @@ -1487,7 +1487,7 @@ class Editor extends EditorStartup {

// Copy title for certain tool elements
this.elems = {
'#stroke_color': '#tool_stroke .icon_label, #tool_stroke .color_block',
'#stroke_color': '#tool_stroke .color_block',
'#fill_color': '#tool_fill label, #tool_fill .color_block',
'#linejoin_miter': '#cur_linejoin',
'#linecap_butt': '#cur_linecap'
Expand Down

0 comments on commit f7eb364

Please sign in to comment.