This commit is contained in:
X1627315083
2025-01-16 09:47:28 +08:00
parent 5c7782113c
commit efc89902cd
5 changed files with 47 additions and 11 deletions

View File

@@ -127,7 +127,6 @@ fabric.Point.prototype.normalize = function(thickness) {
* This makes the drawing editable, it can be moved, rotated, scaled, skewed etc.
*/
fabric.BaseBrush.prototype.convertToPath = function() {
console.log(this.canvas.upperCanvasEl);
var pixelRatio = this.canvas.getRetinaScaling(),
c = fabric.util.copyCanvasElement(this.canvas.upperCanvasEl),
xy = fabric.util.trimCanvas(c),
@@ -147,13 +146,16 @@ fabric.BaseBrush.prototype.convertToPath = function() {
strokeWidth: this._width,
stroke: 'black',
fill:'transparent',
custom:{
dashed:true
},
}).setCoords();
let group = new fabric.Group([pathElemetn],{
left:((xy.x)/pixelRatio-pointerX)/this.canvas.getZoom(),
top:((xy.y)/pixelRatio-pointerY)/this.canvas.getZoom(),
custom:{
dashed:true
}
},
})
this.canvas.add(group).clearContext(this.canvas.contextTop);