Fix for rendering custom symbols with aspect ratio differnt than 1.

r=pgiraud (closes #1836)


git-svn-id: http://svn.openlayers.org/trunk/openlayers@9665 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
ahocevar
2009-09-14 10:25:54 +00:00
parent 7f240d3ba9
commit 93eccfc003
3 changed files with 16 additions and 4 deletions
+1 -1
View File
@@ -8,7 +8,7 @@
// user custom graphicname // user custom graphicname
OpenLayers.Renderer.symbol.lightning = [0,0, 4,2, 6,0, 10,5, 6,3, 4,5, 0,0]; OpenLayers.Renderer.symbol.lightning = [0,0, 4,2, 6,0, 10,5, 6,3, 4,5, 0,0];
OpenLayers.Renderer.symbol.rectangle = [0,0, 10,0, 10,4, 0,4, 0,0]; OpenLayers.Renderer.symbol.rectangle = [0,0, 4,0, 4,10, 0,10, 0,0];
var map; var map;
+2 -2
View File
@@ -947,8 +947,8 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
symbolExtent.bottom = symbolExtent.bottom - diff; symbolExtent.bottom = symbolExtent.bottom - diff;
symbolExtent.top = symbolExtent.top + diff; symbolExtent.top = symbolExtent.top + diff;
} else { } else {
symbolExtent.left = symbolExtent.left - diff; symbolExtent.left = symbolExtent.left + diff;
symbolExtent.right = symbolExtent.right + diff; symbolExtent.right = symbolExtent.right - diff;
} }
cache = { cache = {
+13 -1
View File
@@ -360,7 +360,10 @@
return; return;
} }
t.plan(2); t.plan(4);
OpenLayers.Renderer.symbol.rect1 = [0,0, 10,0, 10,4, 0,4, 0,0];
OpenLayers.Renderer.symbol.rect2 = [0,0, 4,0, 4,10, 0,10, 0,0];
var r = new OpenLayers.Renderer.VML(document.body); var r = new OpenLayers.Renderer.VML(document.body);
@@ -369,6 +372,15 @@
t.eq(cache.path, "m 0 0 l 0 1 1 1 1 0 0 0 x e", "Square symbol rendered correctly"); t.eq(cache.path, "m 0 0 l 0 1 1 1 1 0 0 0 x e", "Square symbol rendered correctly");
t.ok(r.symbolCache["-square"], "Symbol has been cached correctly."); t.ok(r.symbolCache["-square"], "Symbol has been cached correctly.");
cache = r.importSymbol("rect1");
t.eq(cache.bottom, -3, "coordorigin bottom of landscape symbol set to -3 to move topmost part to the bottom (we are flipping y!)");
cache = r.importSymbol("rect2");
t.eq(cache.left, -3, "coordorigin left of portrait symbol set to -3 to move leftmost part to the right");
delete OpenLayers.Renderer.symbol.rect1;
delete OpenLayers.Renderer.symbol.rect2;
} }
function test_vml_dashstyle(t) { function test_vml_dashstyle(t) {