Skip to content

Conversation

@litatus
Copy link

@litatus litatus commented Nov 12, 2017

Added resize() and getInitialPoint() as visible functions for the MapInputWidget object .
These may be useful in the scenario when the map is initially in a hidden div, so the map has "width: 0", and when the div becomes visible is needed to trigger "resize" for the map.
So when the div becomes visible, a possible solution could be adding this lines to the event Listener:
var widgetMap = mapInputWidgetManager.getWidget(mapDiv.prop('id'));
if(mapDiv.is(':visible') && !mapDiv.data('resized')){
widgetMap.resize();
var point = widgetMap.getInitialPoint();
/* for edit form */
if(point){
widgetMap.panTo(point);
widgetMap.setZoom(15);
}
mapDiv.data('resized', true);
}

Added resize() and getInitialPoint() functions.
When the map is initially in a hidden, has "width: 0", and it becomes visible is needed to trigger "resize".
So when the div becomes visible, a possible solution could be:
var widgetMap = mapInputWidgetManager.getWidget(mapDiv.prop('id'));
if(mapDiv.is(':visible') && !mapDiv.data('resized')){
                    widgetMap.resize();
                    var point = widgetMap.getInitialPoint();
                    if(point){
                        widgetMap.panTo(point);
                        widgetMap.setZoom(15);
                    }
                    mapDiv.data('resized', true);
                }
stupid of me
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant