DragZooming with DoJo

How to use DragZoomingTool, an extension which is used for zooming a particular part of a diagram using a drag-Box, with DoJo?

It’s been years since anyone has asked about Dojo, so we are not familiar with the latest versions. At the time, we did get GoJS diagrams working in Dojo apps without any issues. Can you describe what you tried and what the problem was?

I am trying to use GoJS and its extension DragZoomingTool with DoJo framework.

I am able to use gojs’s library, go.js with dojo using the following syntax:


“go”, “DragZoomingTool”

], function(lang, declare, geom, dom, domStyle, domAttr, domClass, bwin, topic,
go, DragZoomingTool, ){

But, DragZoomingTool.js, GoJS extension library is not getting included.

When i checked the value of “DragZoomingTool” in the following code line:

function(lang, declare, geom, dom, domStyle, domAttr, domClass, bwin, topic,
go, DragZoomingTool, ){

value of DragZoomingTool is undefined.

Could you please suggest, how to include this and any other GoJS extension library along with go.js in DoJo framework.

This is not really a GoJS question. We don’t know enough about Dojo to know the answer.

Our files like DragZoomingTool.js do not “export” anything in the file, and its possible you may need to customize the file so that it does. You will have read to read up on Dojo’s requirements to be sure though.

Yes, you are correct, this file doesn’t export anything. And this is the main requirement to include any library file in DoJo.
How can this be achieved in DragZoomingTool.js? Could you please suggest, if possible.

I don’t know how Dojo works, but DragZoomingTool.js creates DragZoomingTool in the context of that file.

At the end of the file, add whatever you need in Dojo to let that name be exported. I think you just need to add a define block at the end of the file, like is done here: Introduction to AMD Modules - Dojo Toolkit Tutorial

Ohk, thanks.
I will check this out.

I am able to include DragZoomingTool.js file using the following way:

function includeJs(jsFilePath) {
    var js = document.createElement("script");
    js.type = "text/javascript";
    js.src = jsFilePath;

A post was split to a new topic: Adding a tool to the ToolManager