Freehand Drawing is shifting a little bit(1 or 2 px) when mouseup.
How can i avoid this shift?
Does it appear that way because of the thickness of the line? In other words, due to Shape.strokeWidth being greater than 1?
tool.temporaryShape = go.GraphObject.make(go.Shape, { name: “SHAPE”, fill:null, stroke: “black”,strokeWidth: 1});
tool.archetypePartData = { stroke: “black”, strokeWidth: 2,category: “FreehandDrawing”};
This is working.No shift happening.
When provide same strokeWidth to both temporaryShape and archetypePartData
There is shift.
On analysis, I understand that to avoid shift the stokeWidth of archetypePartData should be 2 times than stokeWidth of temporaryShape.
But my requirement is both strokeWidth should be same(user shall select the stroke width).
How can I achieve this without shift?
There’s a bug in the FreehandDrawingTool.js file. FreehandDrawingTool.addPoint should have this assignment of the temporary Part:
this.temporaryShape.geometry = geo;
// position the Shape's Part, accounting for the strokeWidth
part.position = new go.Point(viewpt.x - shape.strokeWidth/2, viewpt.y - shape.strokeWidth/2);
this.diagram.add(part);
If you don’t want to change your copy of this extension class, we’re doing so for the next release, which should be very soon.
Thanks for reporting the problem!