widgets/Draw/Widget.js
//Creates the right-click menu  
Creates the right-click menu
Creates the right - click menu
function createGraphicsMenu() {
			ctxMenuForGraphics = new Menu({});
			EditIt = new MenuItem({ 
				label: "Edit",
				onClick: function() {
					if ( selected.geometry.type !== "point" ) {
						editToolbar.activate(Edit.EDIT_VERTICES, selected);
					} else {
						editToolbar.activate(Edit.MOVE | Edit.EDIT_VERTICES | Edit.EDIT_TEXT | Edit.SCALE, selected);
					}
				}
			});
			ctxMenuForGraphics.addChild(EditIt);
		    MoveMenu = new MenuItem({
                label: "Move",
                onClick: function () {
                    editToolbar.activate(Edit.MOVE, selected);
                }
            })
            RoScMenu = new MenuItem({
                label: "Rotate/Scale",
                onClick: function () {
					editToolbar.activate(Edit.ROTATE | Edit.SCALE, selected);
                }
            })
			SepMenu = new MenuSeparator();
			MenuDelete = new MenuItem({
                label: "Delete",
                onClick: function () {
					myGraphic.remove(selected);			
				}
             });
			XYMenu = new MenuItem({
				label: "Add X/Y",
				onClick: function () {
					var newColor = new Color([0,0,0,1]);
					var a = Font.STYLE_ITALIC;
					var b = Font.VARIANT_NORMAL;
					var c = Font.WEIGHT_BOLD;
					if (Spat == "geo"){
						var mapPoint =  selected.geometry;
						var locPoint = webMercatorUtils.webMercatorToGeographic(mapPoint);
						var lat =  number.format(locPoint.y,{places:5});
						var longi =  number.format(locPoint.x,{places:5});
						var textSymbol = new TextSymbol(
						"Lat: " + (lat) + ", Long: "  + (longi)).setColor(
						new Color(newColor)).setAlign(Font.ALIGN_MIDDLE).setAngle(0).setOffset(5, 5).setFont(
						new Font("16px",a,b,c, "Courier"));
					} else {
						var mapPoint =  selected.geometry;
						var Xdig =  number.format(mapPoint.x,{places:5});
						var Ydig =  number.format(mapPoint.y,{places:5});
						var textSymbol = new TextSymbol(
						"X: " + (Xdig) + ", Y: "  + (Ydig)).setColor(
						new Color(newColor)).setAlign(Font.ALIGN_MIDDLE).setAngle(0).setOffset(5, 5).setFont(
						new Font("16px",a,b,c, "Courier"));
					}
					var labelPointGraphic = new Graphic(mapPoint, textSymbol);
					myGraphic.add(labelPointGraphic);
				}
			});
			ctxMenuForGraphics.startup();
	  }
function createGraphicsMenu ( ) { ctxMenuForGraphics = new Menu ( { } ) ; EditIt = new MenuItem ( { label : "Edit" , onClick : function ( ) { if ( selected . geometry . type !== "point" ) { editToolbar . activate ( Edit . EDIT_VERTICES , selected ) ; } else { editToolbar . activate ( Edit . MOVE | Edit . EDIT_VERTICES | Edit . EDIT_TEXT | Edit . SCALE , selected ) ; } } } ) ; ctxMenuForGraphics . addChild ( EditIt ) ; MoveMenu = new MenuItem ( { label : "Move" , onClick : function ( ) { editToolbar . activate ( Edit . MOVE , selected ) ; } } ) RoScMenu = new MenuItem ( { label : "Rotate/Scale" , onClick : function ( ) { editToolbar . activate ( Edit . ROTATE | Edit . SCALE , selected ) ; } } ) SepMenu = new MenuSeparator ( ) ; MenuDelete = new MenuItem ( { label : "Delete" , onClick : function ( ) { myGraphic . remove ( selected ) ; } } ) ; XYMenu = new MenuItem ( { label : "Add X/Y" , onClick : function ( ) { var newColor = new Color ( [ 0 , 0 , 0 , 1 ] ) ; var a = Font . STYLE_ITALIC ; var b = Font . VARIANT_NORMAL ; var c = Font . WEIGHT_BOLD ; if ( Spat == "geo" ) { var mapPoint = selected . geometry ; var locPoint = webMercatorUtils . webMercatorToGeographic ( mapPoint ) ; var lat = number . format ( locPoint . y , { places : 5 } ) ; var longi = number . format ( locPoint . x , { places : 5 } ) ; var textSymbol = new TextSymbol ( "Lat: " + ( lat ) + ", Long: " + ( longi ) ) . setColor ( new Color ( newColor ) ) . setAlign ( Font . ALIGN_MIDDLE ) . setAngle ( 0 ) . setOffset ( 5 , 5 ) . setFont ( new Font ( "16px" , a , b , c , "Courier" ) ) ; } else { var mapPoint = selected . geometry ; var Xdig = number . format ( mapPoint . x , { places : 5 } ) ; var Ydig = number . format ( mapPoint . y , { places : 5 } ) ; var textSymbol = new TextSymbol ( "X: " + ( Xdig ) + ", Y: " + ( Ydig ) ) . setColor ( new Color ( newColor ) ) . setAlign ( Font . ALIGN_MIDDLE ) . setAngle ( 0 ) . setOffset ( 5 , 5 ) . setFont ( new Font ( "16px" , a , b , c , "Courier" ) ) ; } var labelPointGraphic = new Graphic ( mapPoint , textSymbol ) ; myGraphic . add ( labelPointGraphic ) ; } } ) ; ctxMenuForGraphics . startup ( ) ; }
Creates the right-click menu
Creates the right - click menu
//Right-click Move //Right-click Rotate/Scale //Right-click Delete