Skip to content

Added visible functions for MapInputWidget object #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

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