Skip to content

Commit 20dc863

Browse files
committed
fix: drawing position error in graffiti mode
1 parent a252997 commit 20dc863

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/editor/core/draw/graffiti/Graffiti.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ export class Graffiti {
3030
if (!this.draw.isGraffitiMode()) return
3131
this.isDrawing = true
3232
// 缓存起始数据
33+
const { scale } = this.options
3334
this.startStroke = {
3435
lineColor: this.options.graffiti.defaultLineColor,
3536
lineWidth: this.options.graffiti.defaultLineWidth,
36-
points: [evt.offsetX, evt.offsetY]
37+
points: [evt.offsetX / scale, evt.offsetY / scale]
3738
}
3839
}
3940

@@ -69,9 +70,10 @@ export class Graffiti {
6970
this.startStroke = null
7071
}
7172
if (!currentValue?.strokes?.length) return
73+
const { scale } = this.options
7274
const lastPoints =
7375
currentValue.strokes[currentValue.strokes.length - 1].points
74-
lastPoints.push(offsetX, offsetY)
76+
lastPoints.push(offsetX / scale, offsetY / scale)
7577
// 重新渲染
7678
this.draw.render({
7779
isCompute: false,

0 commit comments

Comments
 (0)