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

«
You can follow these posts on Twitter at @Wibblings
»
I am currently reading:

Faster, Higher, Farther by Jack Ewing The World of Mr Mulliner by PG Wodehouse

(?)
Word of the Day:
fakelore