I am using angular 4 and integrated goJS with it.
in the diagram-editor.component.ts file i have added following methods.
export class DiagramEditorComponentV2 implements OnInit {
public diagram: go.Diagram = new go.Diagram();
constructor() {
const $ = go.GraphObject.make;
//nodeTemplate,grouptemplate,linktemplate everything is defined here in constructor
}
out side constructor, other functions defined like this.
copyCommandHandler() {
this.diagram.commandHandler.copySelection();
}
cutCommandHandler() {
console.log(‘cancut:’ + this.diagram.commandHandler.canCutSelection());
this.diagram.commandHandler.cutSelection();
}
pasteCommandHandler() {
this.diagram.commandHandler.pasteFromClipboard();
}
zoomInCommandHandler() {
this.diagram.commandHandler.increaseZoom()
//this.diagram.commandHandler.increaseZoom(1);
}
zoomOutCommandHandler() {
this.diagram.commandHandler.decreaseZoom(1);
}
clearCancasCommandHandler() {
this.diagram.clear();
}
undoCommandHandler() {
this.diagram.undoManager.undo();
}
redoCommandHandler() {
this.diagram.undoManager.redo();
}
I am calling this function through button click events.
so for example, i have put a button with text zoomIn, which calls method zoomInCommandHandler(). there is no any error is generated but actually it doesnt zoom. any function of commandHandler is not working for me.
Keyboard shortcuts for zoomIn, ZoomOut, Cut,Copy,Paste,Undo,Redo everything is working fine.
how can i fix this ? do let me know if you need any other information,
Thanks.