Select to view content in your preferred language

freehandDraw.js

7838
11
07-13-2016 11:04 PM

freehandDraw.js

If anyone is interested, we've built a freehand draw tool for the JavaScript 4.0 API. GitHub repo:

GitHub - kingy68/esri-javascript-draw-4

Can be extended/changed to handle other shapes pretty easily, we only needed freehand draw.

Note: this is only an interim solution until the proper draw tools are released, it is not being developed further/supported.

Attachments
Comments
JW1
by
Emerging Contributor

Thanks. Is there any easy way to disable map's navigation in version 4.1?

JordanKing3
Regular Contributor

Hey,

View.gestureManager.inputManager.manager.options.enable = false

That should disable all gestures on the Map View object. Then setting that same property to true, will enable it again.

See how that goes.

Cheers,

Jordan

JW1
by
Emerging Contributor

Thanks. I saw this method in your JavaScript file. It works well.

JordanKing3
Regular Contributor

Hey,

Just an update on this, I have noticed that you will get odd behaviour if using touch screens with the above properties. To get around it, you can use these instead:

view.gestureManager.inputManager.gestures.drag.options.enable = false;
view.gestureManager.inputManager.gestures.altdrag.options.enable = false;
JW1
by
Emerging Contributor

Thank you. It works fine for me.

Do you have a workaround for the projection problem?

https://community.esri.com/thread/184034-graphics-not-displayed-in-js-api-41-with-custom-projection-... 

SangHyouk_Oum
Occasional Contributor

Hi Jordan, 

Is there a way to disable double-click? I wanted to disable double click as well but I couldn't find any API reference. 

Thanks.

SangHyouk_Oum
Occasional Contributor

Never mind, I figured that out. It was view.gestureManager.inputManager.gestures["double-click"].options.enable = false; 

JordanKing3
Regular Contributor

Hi All,

I've updated the repo in the original post to work with the 4.2 API.

Cheers,

Jordan

JW1
by
Emerging Contributor

With 4.2 API, instead of using the handlers of "view.container", is there anyway to use something like "gestureManager" or "inputManager" for the 2D view? Thanks,

JordanKing3
Regular Contributor

Hey J W‌,

I haven't been able to find gestureManager as an object of the View at 4.2. My guess is that Esri Inc. have wrapped this functionality up into the inputManager. At this stage, it looks like they are still changing the inputManager design (it has changed from 4.0, 4.1 to 4.2), hence the need to keep finding new ways to disable the map controls.

I've only sat down looking at the inputManager at 4.2 for about 30 minutes or so, and the handlers seemed like the easiest way to control the map controls so far. If you think there is a better way, then submit some changes to the repo above with a pull request and I'll take a look (or someone from Esri Inc. might be able to provide some insights here!).

Cheers,

Jordan

JW1
by
Emerging Contributor

Hi Jordan,

Thanks for your update. I thought you might have some inside news about it. Let's wait for the next version then.

Regards,

Jing

Version history
Last update:
‎07-13-2016 11:04 PM
Updated by:
Contributors