Skip to content
This repository has been archived by the owner on Dec 1, 2020. It is now read-only.

View options #203 #206

Merged
merged 4 commits into from
Jan 14, 2016
Merged

View options #203 #206

merged 4 commits into from
Jan 14, 2016

Conversation

jwasilgeo
Copy link
Contributor

@tomwayson please review; resolves #203.

I found that it was crucial to keep your original work with getting an immediate reference to a promise for esriLoading a MapView or SceneView module. Without this--and instead AMD loading within the setMap method--sometimes I'd find myself outside of the Angular digest cycle and nothing would load in a <esri-*-view> directive.

Ultimately, this code now constructs a new MapView or SceneView with all options + a valid map instance inside of the setMap method.

Otherwise, just for illustration, I added a button to change the map property for the scene-view and feature-layer test pages. You'll see that the feature-layer test page will not behave 💯% right when attempting to change the map property, and I think this has to do with the original map having layers. Remove the layers yourself in the sample code, run it again, and then it should be fine when switching out the map.

Jacob Wasilkowski added 3 commits January 12, 2016 11:49
added test page functionality of changing the underlying map property of an already established esri-map-view
…he Angular digest cycle;

added test page functionality of changing the underlying map property of an already established esri-scene-view
@tomwayson
Copy link
Member

@jwasil I really want to merge this, and #207 - both look good and I appreciate all the thought you've put into these issues.

Only thing holding me back is "You'll see that the feature-layer test page will not behave 💯% right when attempting to change the map property" - I tried this, and for me, it seemed like I had to click the button twice to change the map, which, as you say, is not 100% right. I tried removing the call to esriLoader.require() and directly setting the map on the map view in changeMap (see below), but it made no difference.

                        self.changeMap = function() {
                            // create the map
                            // and add a feature layer
                            console.log('changeMap');
                            self.mapView.map = new Map({
                                basemap: 'gray'
                            });
                        };

Have you tried switching maps outside of Angular (i.e. in a fiddle)? If it works outside of Angular, I think we ought to keep digging into this.

What do you think?

@jwasilgeo
Copy link
Contributor Author

@tomwayson check this out, outside of Angular: https://jsfiddle.net/jwasil/ooyqymwe/

I still think the culprit is a MapView with a Map that has a FeatureLayer(s) on it. When you try to replace a Map with layers, you'll see it has trouble during teardown (?) while switching the map property on the MapView.

Seems to be fine if dealing with SceneViews, regardless of the underlying map having layers.

PS: I'll push some code cleanup, too. Good point in that we don't need another esriLoader.require.

tomwayson added a commit that referenced this pull request Jan 14, 2016
@tomwayson tomwayson merged commit 1b6780e into master Jan 14, 2016
@tomwayson tomwayson deleted the view-options-#203 branch January 14, 2016 16:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Investigate bound "view-options" differences among esriMapView and esriSceneView
2 participants