From 102541b7f4deac5ea5c38fb48eda40c98a41af64 Mon Sep 17 00:00:00 2001 From: JFH Date: Fri, 19 Jun 2020 09:14:03 +0200 Subject: [PATCH 1/5] fix issue #408 --- editor/svgcanvas.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index d190a168..b45958ae 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -692,10 +692,8 @@ const addToSelection = this.addToSelection = function (elemsToAdd, showGrips) { } call('selected', selectedElements); - if (showGrips || selectedElements.length === 1) { - selectorManager.requestSelector(selectedElements[0]).showGrips(true); - } else { - selectorManager.requestSelector(selectedElements[0]).showGrips(false); + if (selectedElements.length === 1) { + selectorManager.requestSelector(selectedElements[0]).showGrips(showGrips); } // make sure the elements are in the correct order From 033fd30955c3ab2b599a61f4124d212487f8fb8b Mon Sep 17 00:00:00 2001 From: JFH Date: Fri, 19 Jun 2020 18:42:48 +0200 Subject: [PATCH 2/5] fix #407 --- editor/svgcanvas.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index b45958ae..4c9d7804 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -2887,9 +2887,6 @@ const dblClick = function (evt) { const evtTarget = evt.target; const parent = evtTarget.parentNode; - // Do nothing if already in current group - if (parent === currentGroup) { return; } - let mouseTarget = getMouseTarget(evt); const {tagName} = mouseTarget; @@ -2898,6 +2895,9 @@ const dblClick = function (evt) { textActions.select(mouseTarget, pt.x, pt.y); } + // Do nothing if already in current group + if (parent === currentGroup) { return; } + if ((tagName === 'g' || tagName === 'a') && getRotationAngle(mouseTarget) ) { From 0c1c7d5b12864f054d86b438c7b7daf61d5d5539 Mon Sep 17 00:00:00 2001 From: JFH Date: Sat, 20 Jun 2020 13:12:19 +0200 Subject: [PATCH 3/5] add cypress tests for issues #407 and #408 --- cypress/integration/ui/issues/issue-407.js | 30 ++++++++++++++++++++++ cypress/integration/ui/issues/issue-408.js | 29 +++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 cypress/integration/ui/issues/issue-407.js create mode 100644 cypress/integration/ui/issues/issue-408.js diff --git a/cypress/integration/ui/issues/issue-407.js b/cypress/integration/ui/issues/issue-407.js new file mode 100644 index 00000000..f56e9002 --- /dev/null +++ b/cypress/integration/ui/issues/issue-407.js @@ -0,0 +1,30 @@ +import { + visitAndApproveStorage +} from '../../../support/ui-test-helper.js'; + +// See https://github.com/SVG-Edit/svgedit/issues/407 +describe('Fix issue 407: can enter edit on text child', function () { + beforeEach(() => { + visitAndApproveStorage(); + }); + + it('should set rectangle selection after click', function () { + cy.get('#tool_source').click(); + cy.get('#svg_source_textarea') + .type('{selectall}') + .type(` + + Layer 1 + + + hello + + + `, {parseSpecialCharSequences: false}); + cy.get('#tool_source_save').click(); + cy.get('#svg_1').click().dblclick(); + cy.get('#a_text').should('exist'); + cy.get('#a_text').trigger('mousedown', {which: 1}).trigger('mouseup').dblclick().type('1234'); + cy.get('#a_text').should('have.text', 'he1234llo'); + }); +}); diff --git a/cypress/integration/ui/issues/issue-408.js b/cypress/integration/ui/issues/issue-408.js new file mode 100644 index 00000000..acccc70a --- /dev/null +++ b/cypress/integration/ui/issues/issue-408.js @@ -0,0 +1,29 @@ +import { + visitAndApproveStorage +} from '../../../support/ui-test-helper.js'; + +// See https://github.com/SVG-Edit/svgedit/issues/408 +describe('Fix issue 408: does not throw when showing/saving svg content', function () { + beforeEach(() => { + visitAndApproveStorage(); + }); + + it('should set rectangle selection after click', function () { + cy.get('#tool_source').click(); + cy.get('#svg_source_textarea') + .type('{selectall}') + .type(` + + Layer 1 + + + + + + `, {parseSpecialCharSequences: false}); + cy.get('#tool_source_save').click(); + cy.get('#svg_6').click().dblclick(); // change context + cy.get('#tool_source').click(); // reopen tool_source + cy.get('#tool_source_save').should('exist'); // The save button should be here if it does not throw + }); +}); From 957d34fc9a544c7cec772e88056b0a7eb00916c4 Mon Sep 17 00:00:00 2001 From: JFH <20402845+jfhenon@users.noreply.github.com> Date: Sun, 21 Jun 2020 11:04:48 +0200 Subject: [PATCH 4/5] Update issue-407.js --- cypress/integration/ui/issues/issue-407.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cypress/integration/ui/issues/issue-407.js b/cypress/integration/ui/issues/issue-407.js index f56e9002..101727d9 100644 --- a/cypress/integration/ui/issues/issue-407.js +++ b/cypress/integration/ui/issues/issue-407.js @@ -3,12 +3,12 @@ import { } from '../../../support/ui-test-helper.js'; // See https://github.com/SVG-Edit/svgedit/issues/407 -describe('Fix issue 407: can enter edit on text child', function () { +describe('Fix issue 407', function () { beforeEach(() => { visitAndApproveStorage(); }); - it('should set rectangle selection after click', function () { + it('can enter edit on text child', function () { cy.get('#tool_source').click(); cy.get('#svg_source_textarea') .type('{selectall}') From 60115ee60237ca6d83b20cf12e049c1fb775c104 Mon Sep 17 00:00:00 2001 From: JFH <20402845+jfhenon@users.noreply.github.com> Date: Sun, 21 Jun 2020 11:05:48 +0200 Subject: [PATCH 5/5] Update issue-408.js --- cypress/integration/ui/issues/issue-408.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cypress/integration/ui/issues/issue-408.js b/cypress/integration/ui/issues/issue-408.js index acccc70a..66dd222c 100644 --- a/cypress/integration/ui/issues/issue-408.js +++ b/cypress/integration/ui/issues/issue-408.js @@ -3,12 +3,12 @@ import { } from '../../../support/ui-test-helper.js'; // See https://github.com/SVG-Edit/svgedit/issues/408 -describe('Fix issue 408: does not throw when showing/saving svg content', function () { +describe('Fix issue 408', function () { beforeEach(() => { visitAndApproveStorage(); }); - it('should set rectangle selection after click', function () { + it('should not throw when showing/saving svg content', function () { cy.get('#tool_source').click(); cy.get('#svg_source_textarea') .type('{selectall}')