How to update graphic location as you drag (extent type)

396
2
09-06-2021 12:25 AM
yuray
by
New Contributor

 I'm wondering how to make the graphic follow the cursor as I drag it.

0 Kudos
2 Replies
LinasSpraunius
New Contributor II

In Javascript v3 I've done following:

this.map.on('mouse-drag-start', e=>{
this.map.disablePan()
this.startedMoving = true
})

this.map.on('mouse-drag', e=>{
if (!this.startedMoving) return
this.graphic.setGeometry(new Point(e.mapPoint.x, e.mapPoint.y, spatialReference))
})

this.map.on('mouse-drag-end', e=>{
this.map.enablePan()

})

0 Kudos
yuray
by
New Contributor

Thanks for your reply.
I use (ArcJSAPI 4.4), which is Extent(new Extent(( xmin, xmax, ymin, ymax, spatialReference: xxx));) instead of Point.

0 Kudos