[Mapbender-commits] r9026 - trunk/mapbender/lib

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Aug 5 06:46:37 PDT 2014


Author: hwbllmnn
Date: 2014-08-05 06:46:37 -0700 (Tue, 05 Aug 2014)
New Revision: 9026

Modified:
   trunk/mapbender/lib/mb.ui.displayKmlFeatures.js
Log:
added offsetx and -y style properties to better place marker symbols


Modified: trunk/mapbender/lib/mb.ui.displayKmlFeatures.js
===================================================================
--- trunk/mapbender/lib/mb.ui.displayKmlFeatures.js	2014-08-05 13:25:03 UTC (rev 9025)
+++ trunk/mapbender/lib/mb.ui.displayKmlFeatures.js	2014-08-05 13:46:37 UTC (rev 9026)
@@ -571,15 +571,29 @@
             feature.properties['marker-type'] = 'custom';
             feature.properties['Mapbender:icon'] = null;
         }
+        if(feature.properties['Mapbender:iconOffsetX']) {
+            feature.properties['marker-offset-x'] = feature.properties['Mapbender:iconOffsetX'];
+            feature.properties['Mapbender:iconOffsetX'] = null;
+        }
+        if(feature.properties['Mapbender:iconOffsetY']) {
+            feature.properties['marker-offset-y'] = feature.properties['Mapbender:iconOffsetY'];
+            feature.properties['Mapbender:iconOffsetY'] = null;
+        }
         if(feature.properties['marker-type'] === 'custom') {
             var size = 32;
             if(feature.properties['marker-size']) {
                 size = feature.properties['marker-size'];
             }
+            var offx = 0, offy = 0;
             if(feature.preview) {
                 size = 20;
+            } else {
+                offx = feature.properties['marker-offset-x'] || 0;
+                offy = feature.properties['marker-offset-y'] || 0;
+                offx = parseInt(offx);
+                offy = parseInt(offy);
             }
-            var img = canvas.image(feature.properties['marker-symbol'], pt.x, pt.y, size, size).node;
+            var img = canvas.image(feature.properties['marker-symbol'], pt.x + offx, pt.y + offy, size, size).node;
             if(img.setAttributeNS) {
                 img.setAttributeNS(null, "preserveAspectRatio" , "xMidYMid meet" );
             }



More information about the Mapbender_commits mailing list