OpenLayers: prevent map from resizing [on hold]
We are using OpenLayers on mobile devices. When ever the keyboard is shown, OpenLayers resizes the map. This gives us performance issues when there are many features on that map. It takes a long time for the keyboard to appear/disappear.
Is there a way to prevent OpenLayers from resizing the map? Or are there any other ideas how avoid performance issues?
EDIT:
A user can click on a feature and an overlay is opened, where he can edit some of the values. The map is only in the background, mostly not visible for the user. So, the problem is not so much that the map gets bigger/smaller, but that the map is re-rendered / reloaded. So every time the keyboard is shown, the whole map is re-rendered (although invisible). Is there a way to stop re-rendering / reloading?
javascript openlayers
put on hold as off-topic by ahmadhanb, whyzar, Jochen Schwarze, LaughU, Erik Feb 2 at 8:18
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "When seeking help to debug/write/improve code always provide the desired behavior, a specific problem/error and the shortest code (as formatted text, not pictures) needed to reproduce it in the question body. Providing a clear problem statement and a code attempt helps others to help you." – ahmadhanb, whyzar, Jochen Schwarze, LaughU, Erik
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
We are using OpenLayers on mobile devices. When ever the keyboard is shown, OpenLayers resizes the map. This gives us performance issues when there are many features on that map. It takes a long time for the keyboard to appear/disappear.
Is there a way to prevent OpenLayers from resizing the map? Or are there any other ideas how avoid performance issues?
EDIT:
A user can click on a feature and an overlay is opened, where he can edit some of the values. The map is only in the background, mostly not visible for the user. So, the problem is not so much that the map gets bigger/smaller, but that the map is re-rendered / reloaded. So every time the keyboard is shown, the whole map is re-rendered (although invisible). Is there a way to stop re-rendering / reloading?
javascript openlayers
put on hold as off-topic by ahmadhanb, whyzar, Jochen Schwarze, LaughU, Erik Feb 2 at 8:18
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "When seeking help to debug/write/improve code always provide the desired behavior, a specific problem/error and the shortest code (as formatted text, not pictures) needed to reproduce it in the question body. Providing a clear problem statement and a code attempt helps others to help you." – ahmadhanb, whyzar, Jochen Schwarze, LaughU, Erik
If this question can be reworded to fit the rules in the help center, please edit the question.
This has to do with your browser window, not Openlayers. You should try to find a solution for that issue, if any.
– Ulas
Jan 29 at 14:08
add a comment |
We are using OpenLayers on mobile devices. When ever the keyboard is shown, OpenLayers resizes the map. This gives us performance issues when there are many features on that map. It takes a long time for the keyboard to appear/disappear.
Is there a way to prevent OpenLayers from resizing the map? Or are there any other ideas how avoid performance issues?
EDIT:
A user can click on a feature and an overlay is opened, where he can edit some of the values. The map is only in the background, mostly not visible for the user. So, the problem is not so much that the map gets bigger/smaller, but that the map is re-rendered / reloaded. So every time the keyboard is shown, the whole map is re-rendered (although invisible). Is there a way to stop re-rendering / reloading?
javascript openlayers
We are using OpenLayers on mobile devices. When ever the keyboard is shown, OpenLayers resizes the map. This gives us performance issues when there are many features on that map. It takes a long time for the keyboard to appear/disappear.
Is there a way to prevent OpenLayers from resizing the map? Or are there any other ideas how avoid performance issues?
EDIT:
A user can click on a feature and an overlay is opened, where he can edit some of the values. The map is only in the background, mostly not visible for the user. So, the problem is not so much that the map gets bigger/smaller, but that the map is re-rendered / reloaded. So every time the keyboard is shown, the whole map is re-rendered (although invisible). Is there a way to stop re-rendering / reloading?
javascript openlayers
javascript openlayers
edited Jan 30 at 11:59
Jeremy Benks
asked Jan 29 at 13:51
Jeremy BenksJeremy Benks
112
112
put on hold as off-topic by ahmadhanb, whyzar, Jochen Schwarze, LaughU, Erik Feb 2 at 8:18
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "When seeking help to debug/write/improve code always provide the desired behavior, a specific problem/error and the shortest code (as formatted text, not pictures) needed to reproduce it in the question body. Providing a clear problem statement and a code attempt helps others to help you." – ahmadhanb, whyzar, Jochen Schwarze, LaughU, Erik
If this question can be reworded to fit the rules in the help center, please edit the question.
put on hold as off-topic by ahmadhanb, whyzar, Jochen Schwarze, LaughU, Erik Feb 2 at 8:18
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "When seeking help to debug/write/improve code always provide the desired behavior, a specific problem/error and the shortest code (as formatted text, not pictures) needed to reproduce it in the question body. Providing a clear problem statement and a code attempt helps others to help you." – ahmadhanb, whyzar, Jochen Schwarze, LaughU, Erik
If this question can be reworded to fit the rules in the help center, please edit the question.
This has to do with your browser window, not Openlayers. You should try to find a solution for that issue, if any.
– Ulas
Jan 29 at 14:08
add a comment |
This has to do with your browser window, not Openlayers. You should try to find a solution for that issue, if any.
– Ulas
Jan 29 at 14:08
This has to do with your browser window, not Openlayers. You should try to find a solution for that issue, if any.
– Ulas
Jan 29 at 14:08
This has to do with your browser window, not Openlayers. You should try to find a solution for that issue, if any.
– Ulas
Jan 29 at 14:08
add a comment |
1 Answer
1
active
oldest
votes
After opening the map fix the size of the map div to the current size in pixels, as by default it will be based on the size of the document, which will reduce when the keyboard is displayed
var size = map.getSize();
map.getTargetElement().style.width = size[0] + 'px';
map.getTargetElement().style.height = size[1] + 'px';
How is this an answer to "Is there a way to prevent openlayer from resizing the map?"
– Ulas
Jan 29 at 14:55
3
It's not OpenLayers which is resizing the map, but it answers the headline question "prevent map from resizing".
– Mike
Jan 29 at 15:15
@Mike: your code snipped fixes the size - which is great - but the map is still rendered and the performance issue is there. Is there a way to stop rendering the map?
– Jeremy Benks
Jan 30 at 11:52
It seems OpenLayers listens for window.onresize and then renders regardless of whether the map size has changed. It fires a map change:size event with the same value each time, so it is possible to detect when it is about to happen, but I don't know how to stop the render.
– Mike
Jan 30 at 19:25
There doesn't seem to be a way to stop rendering because it is normal for a map to render whenever there is any interaction. Performance issues with multiple features can often be resolved by optimising the way features are styled stackoverflow.com/questions/39125958/… github.com/openlayers/openlayers/issues/8514
– Mike
Jan 31 at 11:52
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
After opening the map fix the size of the map div to the current size in pixels, as by default it will be based on the size of the document, which will reduce when the keyboard is displayed
var size = map.getSize();
map.getTargetElement().style.width = size[0] + 'px';
map.getTargetElement().style.height = size[1] + 'px';
How is this an answer to "Is there a way to prevent openlayer from resizing the map?"
– Ulas
Jan 29 at 14:55
3
It's not OpenLayers which is resizing the map, but it answers the headline question "prevent map from resizing".
– Mike
Jan 29 at 15:15
@Mike: your code snipped fixes the size - which is great - but the map is still rendered and the performance issue is there. Is there a way to stop rendering the map?
– Jeremy Benks
Jan 30 at 11:52
It seems OpenLayers listens for window.onresize and then renders regardless of whether the map size has changed. It fires a map change:size event with the same value each time, so it is possible to detect when it is about to happen, but I don't know how to stop the render.
– Mike
Jan 30 at 19:25
There doesn't seem to be a way to stop rendering because it is normal for a map to render whenever there is any interaction. Performance issues with multiple features can often be resolved by optimising the way features are styled stackoverflow.com/questions/39125958/… github.com/openlayers/openlayers/issues/8514
– Mike
Jan 31 at 11:52
add a comment |
After opening the map fix the size of the map div to the current size in pixels, as by default it will be based on the size of the document, which will reduce when the keyboard is displayed
var size = map.getSize();
map.getTargetElement().style.width = size[0] + 'px';
map.getTargetElement().style.height = size[1] + 'px';
How is this an answer to "Is there a way to prevent openlayer from resizing the map?"
– Ulas
Jan 29 at 14:55
3
It's not OpenLayers which is resizing the map, but it answers the headline question "prevent map from resizing".
– Mike
Jan 29 at 15:15
@Mike: your code snipped fixes the size - which is great - but the map is still rendered and the performance issue is there. Is there a way to stop rendering the map?
– Jeremy Benks
Jan 30 at 11:52
It seems OpenLayers listens for window.onresize and then renders regardless of whether the map size has changed. It fires a map change:size event with the same value each time, so it is possible to detect when it is about to happen, but I don't know how to stop the render.
– Mike
Jan 30 at 19:25
There doesn't seem to be a way to stop rendering because it is normal for a map to render whenever there is any interaction. Performance issues with multiple features can often be resolved by optimising the way features are styled stackoverflow.com/questions/39125958/… github.com/openlayers/openlayers/issues/8514
– Mike
Jan 31 at 11:52
add a comment |
After opening the map fix the size of the map div to the current size in pixels, as by default it will be based on the size of the document, which will reduce when the keyboard is displayed
var size = map.getSize();
map.getTargetElement().style.width = size[0] + 'px';
map.getTargetElement().style.height = size[1] + 'px';
After opening the map fix the size of the map div to the current size in pixels, as by default it will be based on the size of the document, which will reduce when the keyboard is displayed
var size = map.getSize();
map.getTargetElement().style.width = size[0] + 'px';
map.getTargetElement().style.height = size[1] + 'px';
answered Jan 29 at 14:12
MikeMike
1,63838
1,63838
How is this an answer to "Is there a way to prevent openlayer from resizing the map?"
– Ulas
Jan 29 at 14:55
3
It's not OpenLayers which is resizing the map, but it answers the headline question "prevent map from resizing".
– Mike
Jan 29 at 15:15
@Mike: your code snipped fixes the size - which is great - but the map is still rendered and the performance issue is there. Is there a way to stop rendering the map?
– Jeremy Benks
Jan 30 at 11:52
It seems OpenLayers listens for window.onresize and then renders regardless of whether the map size has changed. It fires a map change:size event with the same value each time, so it is possible to detect when it is about to happen, but I don't know how to stop the render.
– Mike
Jan 30 at 19:25
There doesn't seem to be a way to stop rendering because it is normal for a map to render whenever there is any interaction. Performance issues with multiple features can often be resolved by optimising the way features are styled stackoverflow.com/questions/39125958/… github.com/openlayers/openlayers/issues/8514
– Mike
Jan 31 at 11:52
add a comment |
How is this an answer to "Is there a way to prevent openlayer from resizing the map?"
– Ulas
Jan 29 at 14:55
3
It's not OpenLayers which is resizing the map, but it answers the headline question "prevent map from resizing".
– Mike
Jan 29 at 15:15
@Mike: your code snipped fixes the size - which is great - but the map is still rendered and the performance issue is there. Is there a way to stop rendering the map?
– Jeremy Benks
Jan 30 at 11:52
It seems OpenLayers listens for window.onresize and then renders regardless of whether the map size has changed. It fires a map change:size event with the same value each time, so it is possible to detect when it is about to happen, but I don't know how to stop the render.
– Mike
Jan 30 at 19:25
There doesn't seem to be a way to stop rendering because it is normal for a map to render whenever there is any interaction. Performance issues with multiple features can often be resolved by optimising the way features are styled stackoverflow.com/questions/39125958/… github.com/openlayers/openlayers/issues/8514
– Mike
Jan 31 at 11:52
How is this an answer to "Is there a way to prevent openlayer from resizing the map?"
– Ulas
Jan 29 at 14:55
How is this an answer to "Is there a way to prevent openlayer from resizing the map?"
– Ulas
Jan 29 at 14:55
3
3
It's not OpenLayers which is resizing the map, but it answers the headline question "prevent map from resizing".
– Mike
Jan 29 at 15:15
It's not OpenLayers which is resizing the map, but it answers the headline question "prevent map from resizing".
– Mike
Jan 29 at 15:15
@Mike: your code snipped fixes the size - which is great - but the map is still rendered and the performance issue is there. Is there a way to stop rendering the map?
– Jeremy Benks
Jan 30 at 11:52
@Mike: your code snipped fixes the size - which is great - but the map is still rendered and the performance issue is there. Is there a way to stop rendering the map?
– Jeremy Benks
Jan 30 at 11:52
It seems OpenLayers listens for window.onresize and then renders regardless of whether the map size has changed. It fires a map change:size event with the same value each time, so it is possible to detect when it is about to happen, but I don't know how to stop the render.
– Mike
Jan 30 at 19:25
It seems OpenLayers listens for window.onresize and then renders regardless of whether the map size has changed. It fires a map change:size event with the same value each time, so it is possible to detect when it is about to happen, but I don't know how to stop the render.
– Mike
Jan 30 at 19:25
There doesn't seem to be a way to stop rendering because it is normal for a map to render whenever there is any interaction. Performance issues with multiple features can often be resolved by optimising the way features are styled stackoverflow.com/questions/39125958/… github.com/openlayers/openlayers/issues/8514
– Mike
Jan 31 at 11:52
There doesn't seem to be a way to stop rendering because it is normal for a map to render whenever there is any interaction. Performance issues with multiple features can often be resolved by optimising the way features are styled stackoverflow.com/questions/39125958/… github.com/openlayers/openlayers/issues/8514
– Mike
Jan 31 at 11:52
add a comment |
This has to do with your browser window, not Openlayers. You should try to find a solution for that issue, if any.
– Ulas
Jan 29 at 14:08