[Mapbender-commits] r8869 - trunk/mapbender/lib
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Thu May 15 05:29:06 PDT 2014
Author: hwbllmnn
Date: 2014-05-15 05:29:06 -0700 (Thu, 15 May 2014)
New Revision: 8869
Modified:
trunk/mapbender/lib/mb.ui.displayKmlFeatures.js
Log:
added style preview to kml tree
Modified: trunk/mapbender/lib/mb.ui.displayKmlFeatures.js
===================================================================
--- trunk/mapbender/lib/mb.ui.displayKmlFeatures.js 2014-05-15 12:00:44 UTC (rev 8868)
+++ trunk/mapbender/lib/mb.ui.displayKmlFeatures.js 2014-05-15 12:29:06 UTC (rev 8869)
@@ -389,7 +389,11 @@
pt = {x: feature.geometry.coordinates[0], y: feature.geometry.coordinates[1]};
}
if(feature.properties['Mapbender:icon']) {
- var img = canvas.image(feature.properties['Mapbender:icon'], pt.x, pt.y, 32, 32).node;
+ var size = 32;
+ if(feature.preview) {
+ size = 20;
+ }
+ var img = canvas.image(feature.properties['Mapbender:icon'], pt.x, pt.y, size, size).node;
if(img.setAttributeNS) {
img.setAttributeNS(null, "preserveAspectRatio" , "xMidYMid meet" );
}
@@ -457,8 +461,14 @@
}
},
- renderPreview: function(feature, target) {
- var canvas = Raphael(target, 40, 40);
+ renderPreview: function(feature, target, size) {
+ var canvas;
+ if(size) {
+ canvas = Raphael(target, size, size);
+ } else {
+ canvas = Raphael(target, 40, 40);
+ size = 40;
+ }
var feat = {
geometry: {
@@ -468,15 +478,17 @@
preview: true
};
+ var min = size / 8;
+ var max = size - size / 8;
switch(feature.geometry.type.toLowerCase()) {
case 'point':
feat.geometry.coordinates = [0, 0];
break;
case 'linestring':
- feat.geometry.coordinates = [[5, 35], [35, 5]];
+ feat.geometry.coordinates = [[min, max], [max, min]];
break;
case 'polygon':
- feat.geometry.coordinates = [[[5, 5], [5, 35], [35, 35], [35, 5]]];
+ feat.geometry.coordinates = [[[min, min], [min, max], [max, max], [max, min]]];
break;
};
More information about the Mapbender_commits
mailing list