laptop and a wrench

Bug

Rapidly panning a map causes the dynamic layer to be shifted relative to the cached layer if the 'useMapImage' property has been set to 'true' for the dynamic layer.

Zuletzt veröffentlicht: November 11, 2014 ArcGIS API for JavaScript
Bug-ID-Nummer NIM050461
EingereichtOctober 30, 2009
Zuletzt geändertJune 5, 2024
Gilt fürArcGIS API for JavaScript
Gefunden in VersionOther
ProgrammspracheJavaScript
BetriebssystemWindows OS
Betriebssystemversion2003
StatusNon-Reproducible

Zusätzliche Informationen

The useMapImage property is deprecated at version 2.0.

Workaround

1. Save the following code as a Javascript file and place it on the web server where the application is being hosted. /* * Patch (for v1.6) to fix the useMapImage bug in dynamic map service layer */ (function() { dojo.addOnLoad(function() { esri.layers.DynamicMapServiceLayer.prototype._onExtentChangeHandler = function(extent) { if(!this.visible){return;} var _m=this._map,_i=this._img,_istyle=_i&&_i.style,_do=this._img_dragOrigin;if(_i){_do.x=parseInt(_istyle.left);_do.y=parseInt(_istyle.top);} else{_do.x=(_do.y=0);} var loading=this._img_loading;if(loading){dojo.disconnect(loading._onload_connect);dojo.disconnect(loading._onerror_connect);dojo.disconnect(loading._onabort_connect);dojo.destroy(loading);this._img_loading=null;var request=this._jsonRequest;if(request){try{request.cancel();} catch(e){} this._jsonRequest=null;}} if(this.isPNG32){var div=(this._img_loading=dojo.create("div")),_d=this._div;div.id=_m.id+"_"+this.id+"_"+new Date().getTime();dojo.style(div,{position:"absolute",left:"0px",top:"0px",width:_m.width+"px",height:_m.height+"px"});var innerDiv=div.appendChild(dojo.create("div"));dojo.style(innerDiv,{opacity:0,width:_m.width+"px",height:_m.height+"px"});this.getImageUrl(extent,_m.width,_m.height,this._divAlphaImageFunc);div=null;} else{var img=(this._img_loading=dojo.create("img")),_d=this._div;img.id=_m.id+"_"+this.id+"_"+new Date().getTime();var styleAttr={position:"absolute",left:"0px",top:"0px",width:_m.width+"px",height:_m.height+"px"};var isIE=dojo.isIE;if(isIE&&isIE>7){styleAttr.opacity=this.opacity;} dojo.style(img,styleAttr);img._onload_connect=dojo.connect(img,"onload",this,"_onLoadHandler");img._onerror_connect=dojo.connect(img,"onerror",this,"_onErrorHandler");img._onabort_connect=dojo.connect(img,"onabort",this,"_onErrorHandler");this._startRect={left:_do.x,top:_do.y,width:_i?parseInt(_istyle.width):_m.width,height:_i?parseInt(_istyle.height):_m.height,zoom:(_istyle&&_istyle.zoom)?parseFloat(_istyle.zoom):1};this.getImageUrl(extent,_m.width,_m.height,this._imgSrcFunc);img=null;} }; esri.layers.ArcGISDynamicMapServiceLayer.prototype.getImageUrl = function(extent, width, height, callback) { var path=this._url.path+"/export?",_p=this._params,sr=extent.spatialReference.wkid,_errorHandler=this._errorHandler;delete _p._ts;dojo.mixin(_p,{bbox:dojo.toJson(extent.toJson()),bboxSR:sr,imageSR:sr,size:width+","+height},this.disableClientCaching?{_ts:new Date().getTime()}:{});if(_p.layerDefs){var defs=_p.layerDefs;delete _p.layerDefs;dojo.mixin(_p,{layerDefs:defs});} if(this.useMapImage){var _h=this._imageExportHandler;this._jsonRequest=esri.request({url:path,content:dojo.mixin(_p,{f:"json"}),callbackParamName:"callback",load:function(response,io){_h(response,io,callback);},error:_errorHandler});} else{callback(esri._getProxiedUrl(path+dojo.objectToQuery(dojo.mixin({},_p,{f:"image"}))));} }; }); }()); 2. In the Javascript application add this script tag right below the call to the Javascript API itself (patch.js is the file saved in step 1) <script type="text/javascript" src="./patch.js"></script>

Schritte zur Reproduzierung

Bug-ID: NIM050461

Software:

  • ArcGIS API for JavaScript

Benachrichtigung erhalten, wenn sich der Status eines Bugs ändert

Esri Support App herunterladen

Weitere Informationen zu diesem Thema erkunden

Unterstützung durch ArcGIS-Experten anfordern

An den technischen Support wenden

Esri Support App herunterladen

Zu Download-Optionen wechseln