var screenPt = evt.screenPoint; var mapPt = map.toMap(screenPt); if (Math.abs(screenPt.x - 335) < 55) { if(screenPt.x < 335) { screenPt.x = 270; } else { screenPt.x = 400; } } var mapPtNew = map.toMap(screenPt); shiftX = mapPt.x - mapPtNew.x; map.setExtent(map.extent.offset(shiftX, 0));