What steps will reproduce the problem?
1. Load the canvaslayer/examples/hello2d.html sample into your browser
2. Ensure the window is wide enough to display both the west Pacific and the
south-eastern US at the default zoom.
3. Click and drag the map, moving the pointer to the right so that Asia,
Siberia and the Pacific are shown.
Expected result:
The green rectangle on the southeast of the US should remain visible.
Actual result:
As the left corner of the map crosses the international date line, the green
rectangle disappears.
Version: Code downloaded on March 27th 2013
Browser / Operating System:
Reproduced in both Chrome and Firefox
Additional comments:
I have a patch for this, which should be inserted after line 89 in the
hello2d.html file
var offset = mapProjection.fromLatLngToPoint(canvasLayer.getTopLeft());
+
+ /* We need to do some fix-ups for cases where we cross the
international
+ * dateline. The offset is returned in normalized 0.0 to 256.0
+ * coordinates, so we get the desired result by subtracting 256.0.
+ */
+ var bounds = map.getBounds();
+ var westLongitude = bounds.getSouthWest().lng();
+ var eastLongitude = bounds.getNorthEast().lng();
+ var doesCrossDateLine = (westLongitude >= 0.0) && (eastLongitude < 0);
+ if (doesCrossDateLine) {
+ offset.x -= 256.0;
+ }
context.translate(-offset.x, -offset.y);
Original issue reported on code.google.com by searchbr...@gmail.com on 27 Mar 2013 at 8:05
Original issue reported on code.google.com by
searchbr...@gmail.com
on 27 Mar 2013 at 8:05