2828 />
2929 <div
3030 v-show =" cursorVisible"
31- class =" pointer-events-none absolute left-0 top-0 rounded-full border border-black/60 shadow-[0_0_0_1px_rgba(255,255,255,0.8)]"
32- :style =" cursorStyle"
31+ ref =" cursorEl"
32+ class =" pointer-events-none absolute left-0 top-0 rounded-full border border-black/60 shadow-[0_0_0_1px_rgba(255,255,255,0.8)] will-change-transform"
33+ :style =" cursorSizeStyle"
3334 />
3435 </div >
3536 </div >
141142 max =" 100"
142143 step =" 1"
143144 class =" w-7 appearance-none border-0 bg-transparent text-right text-xs text-node-text-muted outline-none [& ::-webkit-inner-spin-button]:appearance-none [& ::-webkit-outer-spin-button]:appearance-none [-moz-appearance:textfield]"
144- @click.prevent
145+ @click.stop
145146 @change ="
146147 (e) => {
147148 const val = Math.min(
@@ -281,6 +282,7 @@ const { nodeId } = defineProps<{
281282const modelValue = defineModel <string >({ default: ' ' })
282283
283284const canvasEl = useTemplateRef <HTMLCanvasElement >(' canvasEl' )
285+ const cursorEl = useTemplateRef <HTMLElement >(' cursorEl' )
284286const controlsEl = useTemplateRef <HTMLDivElement >(' controlsEl' )
285287const { width : controlsWidth } = useElementSize (controlsEl )
286288const compact = computed (
@@ -296,8 +298,6 @@ const {
296298 backgroundColor,
297299 canvasWidth,
298300 canvasHeight,
299- cursorX,
300- cursorY,
301301 cursorVisible,
302302 displayBrushSize,
303303 inputImageUrl,
@@ -309,7 +309,7 @@ const {
309309 handlePointerLeave,
310310 handleInputImageLoad,
311311 handleClear
312- } = usePainter (nodeId , { canvasEl , modelValue })
312+ } = usePainter (nodeId , { canvasEl , cursorEl , modelValue })
313313
314314const canvasContainerStyle = computed (() => ({
315315 aspectRatio: ` ${canvasWidth .value } / ${canvasHeight .value } ` ,
@@ -318,16 +318,10 @@ const canvasContainerStyle = computed(() => ({
318318 : backgroundColor .value
319319}))
320320
321- const cursorStyle = computed (() => {
322- const size = displayBrushSize .value
323- const x = cursorX .value - size / 2
324- const y = cursorY .value - size / 2
325- return {
326- width: ` ${size }px ` ,
327- height: ` ${size }px ` ,
328- transform: ` translate(${x }px, ${y }px) `
329- }
330- })
321+ const cursorSizeStyle = computed (() => ({
322+ width: ` ${displayBrushSize .value }px ` ,
323+ height: ` ${displayBrushSize .value }px `
324+ }))
331325
332326const brushOpacityPercent = computed ({
333327 get : () => Math .round (brushOpacity .value * 100 ),
0 commit comments