Select to view content in your preferred language

Editing esri.symbol.TextSymbol hangs browser on Scale, Rotate when no default basemap

1760
7
04-07-2014 02:25 AM
CraigJohnson1
Emerging Contributor
Hi,

I am having a peculiar problem with using the Edit toolbar (esri/toolbars/edit) and the Text Symbol (esri/symbols/TextSymbol), where the browser hangs whilst trying to 'Edit' (Rotate, Scale, not Translate) the TextSymbol with the Edit Toolbar.

Basic template example is from http://developers.arcgis.com/javascript/samples/toolbar_edit/ and it works fine if the basemap is loaded, however...

If I remove the basemap (I am using an internal Aerial Map as my basemap), load the map, load the layers,
The try to edit the TextSymbol, it starts the editing, after I activate the edit toolbar with;

var basemapAerial = new esri.layers.ArcGISTiledMapServiceLayer("http://192.168.0.111/arcgis/rest/services/Aerial/MapServer");
map.addLayers([basemapAerial]);

....

tool = tool | Edit.MOVE;
tool = tool | Edit.EDIT_VERTICES;
tool = tool | Edit.SCALE;
tool = tool | Edit.ROTATE;

// enable text editing if a graphic uses a text symbol
if (graphic.symbol.declaredClass === "esri.symbol.TextSymbol") {
   tool = tool | Edit.EDIT_TEXT;
}


but hangs the browser if I try to scale or rotate, moving is no problem...
If I put the basemap back (doesn't matter which basemap) with

map = new esri.Map("mapDiv", {
  center: [19.202661, -34.415346],
  zoom: 2,
  basemap: "osm"
});


The scale and rotate on the TextSymbol works again. 
It only affects TextSymbol, not others Polygon, etc and is not browser specific,
Testing in IE, Chrome, Firefox and Safari.

Tried to debug, but the browser (tab) hangs completely.. sometimes if I wait long enough
the browser (chrome) will say the script has become unresponsive...

Hope anyone can assist, as I do not want to use a internet basemap, just for this functionality.
Using Arcgis Javascript API 3.8, both online and offline.

Thanks
Craig Johnson
0 Kudos
7 Replies
JonathanUihlein
Esri Regular Contributor
Interesting issue. What is the spatial reference of the Aerial basemap you are using?

Also, could you recreate a sample of the issue using jsfiddle.net so I can take a look?

Thanks!
0 Kudos
CraigJohnson1
Emerging Contributor
Hi Jon,

Thanks for taking the time to look at this.
The Spatial Reference according to the rest Map Service is Spatial Reference: 102100  (3857)

I created a fiddle as requested at http://jsfiddle.net/9PRdH/1/

Some notes on the fiddle javascript:

  • The main program is a redefine of http://developers.arcgis.com/javascript/samples/toolbar_edit/

  • I took out all checkbox and options to simplify

  • I commented out the basemap from the new Map() config

  • I changed the center of the map to within the area of my aerial layer

  • Added a loadLayers() function to load the aerial layer

  • Changed the addGraphics() to addTextGraphics() - only interested in TextSymbol


Notes to recreate issue:

  • If you run, click on the Text, you can move it.

  • Trying to perform another function on it, freezes it. 

  • uncomment the basemap (enable) and run again, now it works


Craig
0 Kudos
JonathanUihlein
Esri Regular Contributor
Craig,
Thanks so much for the sample. It's great.
I used both Firefox and Chrome and was able to cause both browsers to hang using your replication steps.
Will look into this and post my findings.
0 Kudos
mysonymysony
Emerging Contributor
hi
i have the same problem please help
0 Kudos
JonathanUihlein
Esri Regular Contributor
This has been fixed internally.

In the meantime, use a basemap if possible.

If this is not an option, I can provide a work-around.
However, you would most likely have to remove this additional code when the new API version is released.
0 Kudos
CraigJohnson1
Emerging Contributor
Hi Jon,

I would appreciate it if you could provide the workaround, even if I have to edit code, it's no problem.
We want to use the functionality for our Town Planning users who have to annotate/label their layer
snapshot before printing and I am building a new front end system/framework ...

Thanks in advance.

Regards
Craig
0 Kudos
JonathanUihlein
Esri Regular Contributor
In short, you need to temporarily override the _deNormalizePoint() function in _Box.js (which lives inside the toolbars directory) with the following:

_deNormalizePoint:function(d,a){ return d;}
0 Kudos