Snapping with measurement tool on all layers/single layer not working.

this.featureLayer = new FeatureLayer(this.Khasraurl,
     {
         mode: FeatureLayer.MODE_ONDEMAND,
         // infoTemplate: infoTemplate,
         outFields: ["*"]
     });

var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new dojo.Color([255, 0, 0]), 2), new dojo.Color([0, 0, 255, 0.20]));

this.featureLayer.setRenderer(new SimpleRenderer(symbol));
this.map.addLayer(this.featureLayer);

var layerInfos = [{
    layer: this.featureLayer
}];

// alert(featureLayer);
//alert(JSON.stringify(featureLayer));
//dojo.keys.copyKey maps to CTRL on windows and Cmd on Mac., but has wrong code for Chrome on Mac

var snapManager = this.map.enableSnapping({

    alwaysSnap: false,
    snapKey: 'CTRL', // key string ==> keys['CTRL']
    tolerance: 15
});

snapManager.setLayerInfos(layerInfos);
require([...,
                   "esri/SnappingManager",
                    "dojo/domReady!"],
                function(
                        ....,
                        SnappingManager
                )
                {
                ...

is there SnappingManager class in your code

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.