Merge pull request #585 from SVG-Edit/issues/584

#584 the select button changes when working on a path
This commit is contained in:
JFH
2021-06-15 01:10:03 +02:00
committed by GitHub
3 changed files with 12 additions and 16 deletions

View File

@@ -346,20 +346,16 @@ class Editor extends EditorStartup {
$id('path_node_panel').style.display = (editmode) ? 'block' : 'none'; $id('path_node_panel').style.display = (editmode) ? 'block' : 'none';
if (editmode) { if (editmode) {
// Change select icon // Change select icon
const elements = document.getElementsByClassName("tool_button_current"); $id('tool_path').pressed = false;
Array.from(elements).forEach(function (element) { $id('tool_select').pressed = true;
element.classList.add('tool_button_current'); $id('tool_select').setAttribute('src', './images/select_node.svg');
element.classList.remove('tool_button');
});
$id('tool_select').classList.add('tool_button_current');
$id('tool_select').classList.remove('tool_button');
this.multiselected = false; this.multiselected = false;
if (elems.length) { if (elems.length) {
this.selectedElement = elems[0]; this.selectedElement = elems[0];
} }
} else { } else {
setTimeout(() => { setTimeout(() => {
// setIcon('#tool_select', 'select'); $id('tool_select').setAttribute('src', './images/select.svg');
}, 1000); }, 1000);
} }
} }

View File

@@ -87,10 +87,10 @@ export class ToolButton extends HTMLElement {
this.$img.setAttribute('src', newValue); this.$img.setAttribute('src', newValue);
break; break;
case 'pressed': case 'pressed':
if (newValue) { if (newValue === null) {
this.$div.classList.add('pressed');
} else {
this.$div.classList.remove('pressed'); this.$div.classList.remove('pressed');
} else {
this.$div.classList.add('pressed');
} }
break; break;
case 'size': case 'size':
@@ -145,7 +145,7 @@ export class ToolButton extends HTMLElement {
if (value) { if (value) {
this.setAttribute('pressed', 'true'); this.setAttribute('pressed', 'true');
} else { } else {
this.removeAttribute('pressed', ''); this.removeAttribute('pressed');
} }
} }
/** /**
@@ -165,7 +165,7 @@ export class ToolButton extends HTMLElement {
if (value) { if (value) {
this.setAttribute('disabled', 'true'); this.setAttribute('disabled', 'true');
} else { } else {
this.removeAttribute('disabled', ''); this.removeAttribute('disabled');
} }
} }
/** /**

View File

@@ -636,8 +636,8 @@ class TopPanel {
* @returns {void} * @returns {void}
*/ */
linkControlPoints() { linkControlPoints() {
const linked = $id("tool_node_link").pressed; $id("tool_node_link").pressed = ($id("tool_node_link").pressed) ? false : true;
$id("tool_node_link").pressed = !linked; const linked = ($id("tool_node_link").pressed) ? true : false;
this.path.linkControlPoints(linked); this.path.linkControlPoints(linked);
} }
@@ -970,7 +970,7 @@ class TopPanel {
</div> <!-- a_panel --> </div> <!-- a_panel -->
<div id="path_node_panel"> <div id="path_node_panel">
<div class="tool_sep"></div> <div class="tool_sep"></div>
<se-button id="tool_node_link" title="${i18next.t('tools.node_link')}" src="./images/tool_node_link.svg" pressed> <se-button id="tool_node_link" title="${i18next.t('tools.node_link')}" src="./images/tool_node_link.svg" pressed>
</se-button> </se-button>
<div class="tool_sep"></div> <div class="tool_sep"></div>
<se-spin-input id="path_node_x" data-attr="x" size="4" title="${i18next.t('properties.node_x')}" label="x:"> <se-spin-input id="path_node_x" data-attr="x" size="4" title="${i18next.t('properties.node_x')}" label="x:">