From 476f8b8d2605e72867af3dcf451774bc533ed419 Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Thu, 16 Feb 2012 11:52:42 +0000 Subject: [PATCH] don't throw errors when resizing uninitialized map (fixes #480, interestingly) --- source/Ox.UI/js/Map/Ox.Map.js | 31 +++++++++++--------- source/Ox.UI/js/Video/Ox.AnnotationFolder.js | 3 +- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/source/Ox.UI/js/Map/Ox.Map.js b/source/Ox.UI/js/Map/Ox.Map.js index bbc97a61..a65ec14e 100644 --- a/source/Ox.UI/js/Map/Ox.Map.js +++ b/source/Ox.UI/js/Map/Ox.Map.js @@ -1518,21 +1518,24 @@ Ox.Map = function(options, self) { self.options.height = that.$element.height(); self.options.width = that.$element.width(); - self.mapHeight = getMapHeight(); - self.minZoom = getMinZoom(); - if (self.minZoom > self.map.getZoom()) { - self.map.setZoom(self.minZoom); + // check if map has initialized + if (self.map) { + self.mapHeight = getMapHeight(); + self.minZoom = getMinZoom(); + if (self.minZoom > self.map.getZoom()) { + self.map.setZoom(self.minZoom); + } + self.$map.css({ + height: self.mapHeight + 'px', + width: self.options.width + 'px' + }); + self.options.zoombar && self.$zoomInput.options({ + size: self.options.width + }); + updateFormElements(); + Ox.print('triggering google maps resize event, height', self.options.height) + google.maps.event.trigger(self.map, 'resize'); } - self.$map.css({ - height: self.mapHeight + 'px', - width: self.options.width + 'px' - }); - self.options.zoombar && self.$zoomInput.options({ - size: self.options.width - }); - updateFormElements(); - Ox.print('triggering google maps resize event, height', self.options.height) - google.maps.event.trigger(self.map, 'resize'); return that; } diff --git a/source/Ox.UI/js/Video/Ox.AnnotationFolder.js b/source/Ox.UI/js/Video/Ox.AnnotationFolder.js index 9e97afee..a0bac506 100644 --- a/source/Ox.UI/js/Video/Ox.AnnotationFolder.js +++ b/source/Ox.UI/js/Video/Ox.AnnotationFolder.js @@ -524,7 +524,8 @@ Ox.AnnotationFolder = function(options, self) { self.editing = false; } if (value && self.options.collapsed) { - self.$panel.options({collapsed: false}); + //self.$panel.options({collapsed: false}); + toggleLayer(); } self.$annotations.options({selected: value}); } else if (key == 'sort') {