aboutsummaryrefslogtreecommitdiffstats
path: root/web/js/nms-map.js
diff options
context:
space:
mode:
authorKristian Lyngstol <kly@kly.no>2019-01-05 12:26:06 +0100
committerKristian Lyngstol <kly@kly.no>2019-01-05 12:26:06 +0100
commit877ec9669d5185487bbebd6a4528f7c5b91f8d96 (patch)
tree087d2d0eda546eb20eb88154e0a4d402c347d435 /web/js/nms-map.js
parent65f156aa871f3e51f45e490e1a0ea797f5eff003 (diff)
js: Trigger a map-resize when menu is toggled
Fixes #71
Diffstat (limited to 'web/js/nms-map.js')
-rw-r--r--web/js/nms-map.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/web/js/nms-map.js b/web/js/nms-map.js
index 5927324..179d8e5 100644
--- a/web/js/nms-map.js
+++ b/web/js/nms-map.js
@@ -140,6 +140,20 @@ nmsMap._initContexts = function() {
}
};
+/*
+ * Used to force a resize if a regular event isn't sent. Typically if the
+ * window itself isn't resized, but available space for the map is still
+ * changed. Example: The menu is toggled. So far this is the same as
+ * _resizeEvent, but there is no guarantee that will stay true.
+ */
+nmsMap.forceResize = function() {
+ if (this._init == true) {
+ return;
+ }
+ nmsMap._resizeEvent();
+}
+
+
nmsMap._resizeEvent = function() {
var width = window.innerWidth - nmsMap._c.bg.c.offsetLeft;
var height = window.innerHeight - nmsMap._c.bg.c.offsetTop;