Issue 752 snapping movement selector misalignment (#753)

master
Kevin D 2022-04-05 14:22:39 +09:00 committed by GitHub
parent 9846622e8a
commit fda0294beb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1,39 @@
import {
visitAndApproveStorage
} from '../../../support/ui-test-helper.js'
// See https://github.com/SVG-Edit/svgedit/issues/752
describe('Fix issue 752', function () {
beforeEach(() => {
visitAndApproveStorage()
})
it('Moving an unsnapped shape will not cause selector box misalignment', function () {
cy.get('#tool_rect')
.click({ force: true })
cy.get('#svgcontent')
.trigger('mousedown', 12, 12, { force: true })
.trigger('mousemove', 99, 99, { force: true })
.trigger('mouseup', { force: true })
cy.wait(300)
cy.get('#svg_1')
.click({ force: true })
cy.get('#tool_editor_prefs')
.click({ force: true })
cy.get('#grid_snapping_step')
.then(elem => {
elem.val('35')
})
cy.wait(300)
cy.get('#grid_snapping_on')
.click({ force: true })
cy.get('#tool_prefs_save')
.click({ force: true })
cy.get('#svg_1')
.trigger('mousedown', 20, 20, { force: true })
.trigger('mousemove', 203, 205, { force: true })
.trigger('mouseup', { force: true })
cy.get('#selectedBox0').should('have.attr', 'd', 'M174,174 L246,174 246,246 174,246z')
})
})

View File

@ -625,6 +625,7 @@ const mouseUpEvent = (evt) => {
const len = selectedElements.length const len = selectedElements.length
for (let i = 0; i < len; ++i) { for (let i = 0; i < len; ++i) {
if (!selectedElements[i]) { break } if (!selectedElements[i]) { break }
svgCanvas.selectorManager.requestSelector(selectedElements[i]).resize()
} }
// no change in position/size, so maybe we should move to pathedit // no change in position/size, so maybe we should move to pathedit
} else { } else {