1

I have a full page arcgis js map (v3.15). On the left hand side of the map, I have a div panel positioned on top of the map that will contain settings/configurations for a user to choose from (see attached screenshot).

The problem is, when I set the maps extent to match that of a feature layer, a lot of the graphics get covered up by the panel on the left. Is there any way to only use the right half of the map to calculate the zoom and center position so all of the graphics in a layer appear on the right half of the screen?

enter image description here

1
  • If it is very important to show all the features and some are hidden behind that panel, why not step out a couple of zoom levels? Or, better yet, make that panel collapsible so it can be hidden with a toggle button in the upper left corner. The panel is taking up quite a bit of space on the map view...
    – crmackey
    Commented Aug 1, 2017 at 15:10

1 Answer 1

2

edit: realized after posting that this was for 3.x, not 4. The code below is for version 4

You're probably looking for view padding.

Documentation: https://developers.arcgis.com/javascript/latest/sample-code/view-padding/

Relevant code from the sample:

var view = new MapView({ container: "viewDiv", map: map, center: [-74.045459, 40.690083], // Liberty Island, NY, USA zoom: 16, padding: { right: 320 // Same value as the #sidebar width in CSS } });

1
  • Oh yea this is exactly what I need. Now if only there was a solution using 3.x. At least I now know what the technique is called (view padding). Thanks.
    – dave823
    Commented Aug 17, 2017 at 14:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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