fix: 修复多个已知问题
This commit is contained in:
@@ -427,6 +427,12 @@ import { sprayBrushDataUrl } from "./data/sprayBrushData.js";
|
||||
},
|
||||
|
||||
onMouseDown: function (pointer) {
|
||||
// 添加坐标转换处理画布缩放和偏移
|
||||
pointer.x =
|
||||
pointer.x * this.canvas.getZoom() + this.canvas.viewportTransform[4];
|
||||
pointer.y =
|
||||
pointer.y * this.canvas.getZoom() + this.canvas.viewportTransform[5];
|
||||
|
||||
this._points = [pointer];
|
||||
this._count = 0;
|
||||
|
||||
@@ -449,6 +455,12 @@ import { sprayBrushDataUrl } from "./data/sprayBrushData.js";
|
||||
},
|
||||
|
||||
onMouseMove: function (pointer) {
|
||||
// 添加坐标转换处理画布缩放和偏移
|
||||
pointer.x =
|
||||
pointer.x * this.canvas.getZoom() + this.canvas.viewportTransform[4];
|
||||
pointer.y =
|
||||
pointer.y * this.canvas.getZoom() + this.canvas.viewportTransform[5];
|
||||
|
||||
this._points.push(pointer);
|
||||
|
||||
var i,
|
||||
@@ -985,9 +997,9 @@ import { sprayBrushDataUrl } from "./data/sprayBrushData.js";
|
||||
ctx.globalAlpha = 0.8 * this.opacity;
|
||||
ctx.moveTo(this._lastPoint.x, this._lastPoint.y);
|
||||
let x =
|
||||
content > this._lastPoint.x
|
||||
? content - this._lastPoint.x + content
|
||||
: content * 2 - this._lastPoint.x;
|
||||
this.content > this._lastPoint.x
|
||||
? this.content - this._lastPoint.x + this.content
|
||||
: this.content * 2 - this._lastPoint.x;
|
||||
ctx.lineTo(x, this._lastPoint.y);
|
||||
// ctx.lineTo(pointer.y + lineWidthDiff,pointer.x + lineWidthDiff);
|
||||
ctx.stroke();
|
||||
@@ -997,10 +1009,12 @@ import { sprayBrushDataUrl } from "./data/sprayBrushData.js";
|
||||
},
|
||||
|
||||
onMouseDown: function (pointer) {
|
||||
// 添加坐标转换处理画布缩放和偏移
|
||||
pointer.x =
|
||||
pointer.x * this.canvas.getZoom() + this.canvas.viewportTransform[4];
|
||||
pointer.y =
|
||||
pointer.y * this.canvas.getZoom() + this.canvas.viewportTransform[5];
|
||||
|
||||
this._lastPoint = pointer;
|
||||
this.canvas.contextTop.strokeStyle = this.color;
|
||||
this.canvas.contextTop.lineWidth = this._lineWidth;
|
||||
@@ -1009,10 +1023,12 @@ import { sprayBrushDataUrl } from "./data/sprayBrushData.js";
|
||||
|
||||
onMouseMove: function (pointer) {
|
||||
if (this.canvas._isCurrentlyDrawing) {
|
||||
// 添加坐标转换处理画布缩放和偏移
|
||||
pointer.x =
|
||||
pointer.x * this.canvas.getZoom() + this.canvas.viewportTransform[4];
|
||||
pointer.y =
|
||||
pointer.y * this.canvas.getZoom() + this.canvas.viewportTransform[5];
|
||||
|
||||
this._render(pointer);
|
||||
}
|
||||
},
|
||||
@@ -1022,7 +1038,7 @@ import { sprayBrushDataUrl } from "./data/sprayBrushData.js";
|
||||
this.canvas.contextTop.globalAlpha = 1;
|
||||
this.convertToImg();
|
||||
},
|
||||
}); // End MarkerBrush
|
||||
}); // End MarkerBrush1
|
||||
/**
|
||||
* PenBrush
|
||||
* Based on code by Tennison Chan.
|
||||
|
||||
Reference in New Issue
Block a user