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';
if (editmode) {
// Change select icon
const elements = document.getElementsByClassName("tool_button_current");
Array.from(elements).forEach(function (element) {
element.classList.add('tool_button_current');
element.classList.remove('tool_button');
});
$id('tool_select').classList.add('tool_button_current');
$id('tool_select').classList.remove('tool_button');
$id('tool_path').pressed = false;
$id('tool_select').pressed = true;
$id('tool_select').setAttribute('src', './images/select_node.svg');
this.multiselected = false;
if (elems.length) {
this.selectedElement = elems[0];
}
} else {
setTimeout(() => {
// setIcon('#tool_select', 'select');
$id('tool_select').setAttribute('src', './images/select.svg');
}, 1000);
}
}

View File

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

View File

@@ -636,8 +636,8 @@ class TopPanel {
* @returns {void}
*/
linkControlPoints() {
const linked = $id("tool_node_link").pressed;
$id("tool_node_link").pressed = !linked;
$id("tool_node_link").pressed = ($id("tool_node_link").pressed) ? false : true;
const linked = ($id("tool_node_link").pressed) ? true : false;
this.path.linkControlPoints(linked);
}
@@ -970,7 +970,7 @@ class TopPanel {
</div> <!-- a_panel -->
<div id="path_node_panel">
<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>
<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:">