Skip to content

Commit

Permalink
fix:修复eslint报错
Browse files Browse the repository at this point in the history
  • Loading branch information
yaoyun8 committed Jan 10, 2024
1 parent 0356e31 commit e113f97
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions packages/canvas/src/components/container/CanvasResize.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@ export default {
const mouseDown = ref(false)
const resizeDom = ref(null)
const onMouseMove = (event) => {
if (mouseDown.value) {
event.preventDefault()
calculateSize(event)
}
}
const calculateSize = ({ movementX }) => {
const dimension = useLayout().getDimension()
const { maxWidth, minWidth, width } = dimension
Expand All @@ -48,13 +41,10 @@ export default {
})
}
const onMouseDown = () => {
const iframe = canvasState.iframe
if (iframe) {
iframe.style['pointer-events'] = 'none'
bindEvents()
mouseDown.value = true
const onMouseMove = (event) => {
if (mouseDown.value) {
event.preventDefault()
calculateSize(event)
}
}
Expand All @@ -64,7 +54,9 @@ export default {
if (iframe) {
iframe.style['pointer-events'] = 'auto'
mouseDown.value = false
unbindEvents()
document.removeEventListener('mousemove', onMouseMove, { passive: false })
document.removeEventListener('mouseup', onMouseUp)
}
}
Expand All @@ -73,9 +65,14 @@ export default {
document.addEventListener('mouseup', onMouseUp)
}
const unbindEvents = () => {
document.removeEventListener('mousemove', onMouseMove, { passive: false })
document.removeEventListener('mouseup', onMouseUp)
const onMouseDown = () => {
const iframe = canvasState.iframe
if (iframe) {
iframe.style['pointer-events'] = 'none'
bindEvents()
mouseDown.value = true
}
}
const setScale = () => {
Expand Down

0 comments on commit e113f97

Please sign in to comment.