Closed tmcw closed 12 years ago
Understood that the current situation is tricky/annoying. I see how using 0x0
is more correct than making up another set of numbers. But assuming the idea is to set up a map on a hidden element and then reveal it, how do you get the correct dimensions when the element is shown? I assume window.resize doesn't fire in that case.
In this case, because the element's in an iframe - clearly a minority. (so, yes, window.onresize fires in the transition) In other cases I'm thinking that one might be able to spy on the DOM, or even expose a function to do what this does when the map is first initialized - possibly just a version of 'setSize' without arguments.
And, my main point here isn't that 0x0 is more correct - it's that setting absolute sizes on elements can lead to corner-cases which are very hard to recover from, because you need to-reset and re-flow the map to figure out what its size should be when page layout changes.
Closing so we can focus discussion in #60.
The default sizing of Modest Maps is proving to be more trouble than it's worth. Mainly because maps that are sized with CSS but in
display:none
containers on load will acquire a fixed width that can't change whenwindow.onresize
fires. Indisplay: none
, offsetWidth and Height are both 0, so trigger the default. I don't think that the Google Maps API does such a default, and it makes the sizing API more complex in a way that I don't think is very worthwhile.I'll pull together a branch that simply removes this default.