I am trying to add GuidedDraggingTool in FloorPlan Project Sample but it is throwing an error “go.GuidedDraggingTool is not a constructor”. Can you please help me out how can i use it.
Have you successfullly loaded the JavaScript for that extension class?
If so, I believe that the GuidedDraggingTool
is not loaded in the go
namespace. Try removing “go.” from your code there.
Thanks Walter.
That did fix the problem.But i am not able to see guideline can you help me out what are the changes required to enable the guideline in FloorPlan project. I have also set below property as shown in example Guided Dragging
this.draggingTool.isGuidelineEnabled = true;
The Floorplan.js file overrides some of the DraggingTool methods, by changing the instance that the ToolManager has.
I suggest that you replace the ToolManager.draggingTool with an instance of GuidedDraggingTool before that code, and replace references to:
go.DraggingTool.prototype
with:
GuidedDraggingTool.prototype
By the way, isGuidelineEnabled
defaults to true, so you don’t have to set it.
Hi walter,
Made the following changes as mention above
- Change the instance
// this.draggingTool = new go.DraggingTool();
this.draggingTool=new GuidedDraggingTool();
2.Replace go.DraggingTool.Prototype with “GuidedDraggingTool.prototype”
// If a wall was dragged to intersect another wall, update angle displays
this.toolManager.draggingTool.doMouseUp = function () {
GuidedDraggingTool.prototype.doMouseUp.call(this);
this.diagram.updateWallAngles();
this.isGridSnapEnabled = this.diagram.model.modelData.preferences.gridSnap;
}
// If user holds SHIFT while dragging, do not use grid snap
this.toolManager.draggingTool.doMouseMove = function () {
if (this.diagram.lastInput.shift) {
this.isGridSnapEnabled = false;
} else this.isGridSnapEnabled = this.diagram.model.modelData.preferences.gridSnap;
this.diagram.updateWallDimensions();
GuidedDraggingTool.prototype.doMouseMove.call(this);
}
this.toolManager.draggingTool.canStart = function() {
return GuidedDraggingTool.prototype.canStart.call(this) &&
this.diagram.selection.count === 1;
}
but still not getting guidelines
Can you please help me out what i am missing here
I suggest that you debug the code to make sure that each of the GuidedDraggingTool methods is being called appropriately as mouse events happen.
I cant figure out what is wrong,
Can you please help me out?
HI walter ,
Can you help me out with this?