Skip to content

Commit

Permalink
fix side effects
Browse files Browse the repository at this point in the history
  • Loading branch information
jfhenon committed Dec 9, 2023
1 parent e6e1a37 commit 7478dc4
Show file tree
Hide file tree
Showing 14 changed files with 531 additions and 430 deletions.
138 changes: 70 additions & 68 deletions coverage/coverage-summary.json

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions cypress/e2e/unit/utilities-bbox.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as utilities from '../../../packages/svgcanvas/core/utilities.js'
import * as math from '../../../packages/svgcanvas/core/math.js'
import * as path from '../../../packages/svgcanvas/core/path.js'
import setAssertionMethods from '../../support/assert-close.js'
import * as units from '../../../packages/svgcanvas/core/units.js'

// eslint-disable-next-line
chai.use(setAssertionMethods)
Expand Down Expand Up @@ -94,6 +95,7 @@ describe('utilities bbox', function () {
}

path.init(mockSvgCanvas)
units.init({ getRoundDigits: () => 2 }) // mock getRoundDigits
mockaddSVGElementsFromJsonCallCount = 0
})

Expand Down
3 changes: 3 additions & 0 deletions cypress/e2e/unit/utilities-performance.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ import 'pathseg'
import { NS } from '../../../packages/svgcanvas/core/namespaces.js'
import * as utilities from '../../../packages/svgcanvas/core/utilities.js'
import * as math from '../../../packages/svgcanvas/core/math.js'
import * as units from '../../../packages/svgcanvas/core/units.js'


describe('utilities performance', function () {
let currentLayer; let groupWithMatrixTransform; let textWithMatrixTransform
units.init({ getRoundDigits: () => 2 }) // mock getRoundDigits
beforeEach(() => {
document.body.textContent = ''
const style = document.createElement('style')
Expand Down
3 changes: 1 addition & 2 deletions packages/svgcanvas/core/undo.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ export const changeSelectedAttributeNoUndoMethod = (attr, newValue, elems) => {
const bbox = getStrokedBBoxDefaultVisible([elem])
const diffX = attr === 'x' ? parseFloat(newValue) - bbox.x : 0
const diffY = attr === 'y' ? parseFloat(newValue) - bbox.y : 0
console.log('diffX, diffY', diffX, diffY)
svgCanvas.moveSelectedElements(diffX * zoom, diffY * zoom, true)
continue
}
Expand All @@ -190,7 +189,7 @@ export const changeSelectedAttributeNoUndoMethod = (attr, newValue, elems) => {
} else if (attr === '#href') {
setHref(elem, newValue)
} else if (newValue) {
elem.setAttribute(attr, parseFloat(newValue))
elem.setAttribute(attr, isNaN(parseFloat(newValue)) ? newValue : parseFloat(newValue))
} else if (typeof newValue === 'number') {
elem.setAttribute(attr, newValue)
} else {
Expand Down
Loading

0 comments on commit 7478dc4

Please sign in to comment.