Select to view content in your preferred language

Editing Graphics

3938
7
10-07-2015 08:52 PM
UmarSharif
Deactivated User

I am developing a drawing tool (circle/line/polygon etc.) with editing capabilities. I have a questions:

I want to scale a graphic object without editing tool (I don't want to click on graphic object and set scale as done in editing widget) How this can be achieved?

Tags (1)
0 Kudos
7 Replies
TyroneBiggums
Deactivated User

Look here: https://developers.arcgis.com/javascript/jsapi/graphic-amd.html#setgeometry


What you'll do is find your graphic object, and then it'll depend on the shape.

Make it easier on yourself and var graphic = // code to retrieve the graphic you want to edit;

Then you'll need to get the geometry for the shape you're editing. If it's a circle, I think it's graphic.geometry.rings. Change the rings collection, set graphic.geometry.rings = rings, and then geometry.setGeometry(graphic.geometry);

The easier example is editing a point from user in put x and y.

graphic.geometry.setX(4);

graphic.geometry.setY(1);

graphic.setGeometry(graphic.geometry);

You see? You're changing the geometry then sort of setting itself with the geometry you changed.

I hope that's what you meant by editing the scale.

0 Kudos
TyroneBiggums
Deactivated User
0 Kudos
TimWitt2
MVP Alum

Umar,

I have created a drawing widget, check it out here: Javascript API - Advanced Draw widget

Here is a live version:Advanced Draw

Tim

UmarSharif
Deactivated User

I don't want to click on a graphic to edit it. I want to edit it dynmically

0 Kudos
TyroneBiggums
Deactivated User

Look at my code example above. Remove setGeometry and insert setScale, and apply the proper properties to it. That's how you programmitcally change the graphic scale.

0 Kudos
UmarSharif
Deactivated User

Can you send a link

0 Kudos
TyroneBiggums
Deactivated User

A link to my working code? No, I don't have a link that has this code. In my initial reply to this thread, I provided a link to the class you need, and a code snippet example.