Skip to content

Commit

Permalink
fix(free-dom): transform scale error
Browse files Browse the repository at this point in the history
  • Loading branch information
SepVeneto committed Jan 3, 2025
1 parent b57b170 commit ad238ed
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 7 additions & 3 deletions packages/core/src/components/freeDom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,13 @@ const freeDom = defineComponent({

sceneContext.emit('moveup')

emit('update:x', x.value)
emit('update:y', y.value)
emit('update:modelValue', { x: x.value, y: y.value, w: width.value, h: height.value })
const roundX = Math.round(x.value)
const roundY = Math.round(y.value)
const roundW = Math.round(width.value || 0)
const roundH = Math.round(height.value || 0)
emit('update:x', roundX)
emit('update:y', roundY)
emit('update:modelValue', { x: roundX, y: roundY, w: roundW, h: roundH })
sceneContext.history?.push({ type: 'move-end' })
}
const onDragStart: CoreFnCallback = (evt, coreData) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/hooks/use-draggable-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export function useDraggableData(props: FreeDomProps) {
props.dragStartFn(evt, data)
}
const handleDrag: CoreFnCallback = (evt, data) => {
x.value = Math.round(data.x)
y.value = Math.round(data.y)
x.value = data.x
y.value = data.y
deltaX.value = data.deltaX
deltaY.value = data.deltaY

Expand Down

0 comments on commit ad238ed

Please sign in to comment.