Disable Move/Scale/Rotate on Editor widget

6650
18
04-23-2015 01:26 AM
CiprianLazar
New Contributor III

Hi,

I'm new to Web AppBuilder and JavaScript API and I'm implementing a small app for digitizing features over a orthophoto map. I'm using the developer version of the Web AppBuilder and an intranet Portal for ArcGIS.

I need to set a maximum scale for the map and disable the move/scale/rotate options when using the default editor widget.

I couldn't find a way to set a maximum scale for the map after the initialization of the map (ie when the editor widget is started), but I hooked to the "zoom-end" event of the map and if the user zooms out, the app automatically zooms back in. Is there a better way to do this?

this.blockScaleEvent =
  this.map.on("zoom-end", lang.hitch(this, function () {
       if (this.map.getScale() > 250) {
            this.map.setScale(250);
       }
  }));

I couldn't find a way to disable the move/scale/rotate options when using the default editor widget. Can anyone help me with this?

Thank you,

Ciprian

0 Kudos
18 Replies
KavishGhime
Esri Contributor

Hi Robert,

 

Where to apply the disable-zoom method inside a web appbuilder application`s code after unzipping, since I cannot find where the map is defined?

 

Thanks.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Kavish,

  In the jimu.js folder find the MapManager.js this is where the code would go.

KavishGhime
Esri Contributor

Hi Robert, 

Thank you for the location where I can edit the map for zoom disable, which can be found in wab application downloaded form WAB developer edition.

Actually I forgot to mention one thing, I downloaded the web appbuilder application from ArcGIS Online. And, under jimu.js folder, there is no "MapManager.js" (as compared to developer edition, the files are less when downloaded from ArcGIS Online). So, where to find in this situation?

Thanks,

Kavish

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Kavish,

   That is quite a bit harder then. In the jimu.js\main.js search for "d.hideZoomSlider();"

d is the var for map. So right after that semicolon you can add your code.

KavishGhime
Esri Contributor

Hello Robert Scheitlin,

Apologies for a little late response. The solution you gave me, worked. I was able to disable mouse-scroll using the variable "d", which is the map`s variable. Only thing is, the map zooms fro initial scroll, and then it gets disable. Any view on this small issue?

Thanks,

Kavish

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Kavish,

Only thing is, the map zooms fro initial scroll, and then it gets disable

So I am not sure I am following here. What do you mean it zooms from initial scroll?

0 Kudos
KavishGhime
Esri Contributor

Robert,

When the application is loaded, and I try to scroll the mouse the map zooms(zoom-in or zoom-out) for that initial mouse scroll, and then the map gets locked (means, after this, i cannot scroll the map further -- the mouse scrolling is disabled -- which is what I am achieving).

Just want to know why the initial scrolling makes the map to zoom (after that scrolling is disabled), or is it the way it works in 3.23 JS API?

-Kavish

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Kavish,

  Using minified code like you are it is to hard for me direct you to the appropriate area. You really need to use WAB Developer.

KavishGhime
Esri Contributor

Hello Robert,

Yeah, exactly what I thought before -- to use Web AppBuilder instead of working on ArcGIS Online downloaded minified version app code. 

Thank you for clearing this and for your help.

-Kavish

0 Kudos