#599 InternalError: too much recursion issue partially fixed

master
agriyadev5 2021-08-17 13:19:12 +05:30
parent 2860528211
commit 0b79020a9b
5 changed files with 39 additions and 12 deletions

View File

@ -183,7 +183,7 @@ export class SESpinInput extends HTMLElement {
connectedCallback () { connectedCallback () {
this.$input.addEventListener('onchange', (e) => { this.$input.addEventListener('onchange', (e) => {
e.preventDefault(); e.preventDefault();
if(e.detail !== this.value && e.detail !== "") { if(e.detail !== this.value && e.detail !== "" && !isNaN(e.detail) ) {
const event = new CustomEvent('change', { detail: e.detail }); const event = new CustomEvent('change', { detail: e.detail });
this.dispatchEvent(event); this.dispatchEvent(event);
} }

View File

@ -134,8 +134,14 @@ class BottomPanel {
* @type {module} * @type {module}
*/ */
handleOpacity (evt) { handleOpacity (evt) {
const val = Number.parseInt(evt.currentTarget.value.split('%')[0]); let val = evt.currentTarget.value;
this.editor.svgCanvas.setOpacity(val / 100); if(evt.detail !== undefined) {
val = evt.detail;
}
val = Number.parseInt(val.split('%')[0]);
if(!isNaN(val)) {
this.editor.svgCanvas.setOpacity(val / 100);
}
} }
/** /**
* @type {module} * @type {module}

View File

@ -497,23 +497,35 @@ class TopPanel {
* @type {module} * @type {module}
*/ */
changeRectRadius(e) { changeRectRadius(e) {
this.editor.svgCanvas.setRectRadius(e.target.value); let val = e.target.value;
if(e.detail !== undefined) {
val = e.detail;
}
this.editor.svgCanvas.setRectRadius(val);
} }
/** /**
* @type {module} * @type {module}
*/ */
changeFontSize(e) { changeFontSize(e) {
this.editor.svgCanvas.setFontSize(e.target.value); let val = e.target.value;
if(e.detail !== undefined) {
val = e.detail;
}
this.editor.svgCanvas.setFontSize(val);
} }
/** /**
* @type {module} * @type {module}
*/ */
changeRotationAngle(e) { changeRotationAngle(e) {
this.editor.svgCanvas.setRotationAngle(e.target.value); let val = e.target.value;
if(e.detail !== undefined) {
val = e.detail;
}
this.editor.svgCanvas.setRotationAngle(val);
// eslint-disable-next-line max-len // eslint-disable-next-line max-len
(Number.parseInt(e.target.value) === 0) ? $id("tool_reorient").classList.add("disabled") : $id("tool_reorient").classList.remove("disabled"); (Number.parseInt(val) === 0) ? $id("tool_reorient").classList.add("disabled") : $id("tool_reorient").classList.remove("disabled");
} }
/** /**
@ -521,7 +533,11 @@ class TopPanel {
* @returns {void} * @returns {void}
*/ */
changeBlur(e) { changeBlur(e) {
this.editor.svgCanvas.setBlur(e.target.value / 10, true); let val = e.target.value;
if(e.detail !== undefined) {
val = e.detail;
}
this.editor.svgCanvas.setBlur(val / 10, true);
} }
/** /**
* *
@ -570,7 +586,10 @@ class TopPanel {
*/ */
attrChanger(e) { attrChanger(e) {
const attr = e.target.getAttribute("data-attr"); const attr = e.target.getAttribute("data-attr");
let val = (e.detail || e.target.value); let val = e?.target?.value;
if(e.detail !== undefined) {
val = e.detail;
}
const valid = isValidUnit(attr, val, this.selectedElement); const valid = isValidUnit(attr, val, this.selectedElement);
if (!valid) { if (!valid) {

View File

@ -828,7 +828,7 @@ export const setRectRadiusMethod = function (val) {
const selected = selectedElements[0]; const selected = selectedElements[0];
if (!isNullish(selected) && selected.tagName === 'rect') { if (!isNullish(selected) && selected.tagName === 'rect') {
const r = selected.getAttribute('rx'); const r = selected.getAttribute('rx');
if (r !== String(val)) { if (r !== String(val) && !isNullish(val)) {
selected.setAttribute('rx', val); selected.setAttribute('rx', val);
selected.setAttribute('ry', val); selected.setAttribute('ry', val);
elemContext_.addCommandToHistory(new ChangeElementCommand(selected, { rx: r, ry: r }, 'Radius')); elemContext_.addCommandToHistory(new ChangeElementCommand(selected, { rx: r, ry: r }, 'Radius'));

View File

@ -385,8 +385,10 @@ export const setRotationAngle = function (val, preventUndo) {
} else { } else {
elem.removeAttribute('transform'); elem.removeAttribute('transform');
} }
svgCanvas.changeSelectedAttribute('transform', newTransform, selectedElements()); if (oldTransform !== newTransform) {
svgCanvas.call('changed', selectedElements()); svgCanvas.changeSelectedAttribute('transform', newTransform, selectedElements());
svgCanvas.call('changed', selectedElements());
}
} }
// const pointGripContainer = getElem('pathpointgrip_container'); // const pointGripContainer = getElem('pathpointgrip_container');
// if (elem.nodeName === 'path' && pointGripContainer) { // if (elem.nodeName === 'path' && pointGripContainer) {