5x12 pentomino tiling

JavaScript is for ...


... well, driving you mad really. I've just spent most of the day wrestling with a peculiar problem interfacing with the latest version of the Ordnance Survey OpenSpace software after they claimed they couldn't re-produce my bug.

After a lot of red herrings it finally came down to this: they have a map object which you can interrogate via the function getCenter() which returns a point object indicating the current centre of the map being displayed. You can use the point object to do things like (in my case) draw a cross on the centre of the map.

And when the map is moved by dragging (which in the new software you can do on your mobile device using your finger but on the desktop you drag with your mouse) the software helpfully triggers a "move" event so you can register a callback function and then in that function I can re-centre the cross as the drag proceeds.

Except I can't any more.

It turned out, and it took me far longer than it should have done to realise what the real problem was as the symptoms confused me, that they only bother to reset the center property on the map object when the move had completed - so when you lifted your finger or released the mouse button. Hence the getCenter() function returns null so you can't re-centre the cross. Arggghhh!

It did used to work on the old software, but that didn't support mobile browsers.

Anyway I've reported it, with examples, so let's see what they say this time.

Tags: JavaScript, maps Written 09/02/13

Comment on this article

« »
I am currently reading:

A History of Women in 101 Objects by Annabelle Hirsch Game On by Janet Evanovich

Word of the Day: