add new vector style property "graphicOpacity"
enabling mixing non-opaque vector geometries with opaque external graphics on the same vector layer (closes #873) git-svn-id: http://svn.openlayers.org/trunk/openlayers@4114 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -256,6 +256,13 @@ OpenLayers.Feature.Vector = OpenLayers.Class(OpenLayers.Feature, {
|
||||
* - hoverPointRadius: 1,
|
||||
* - hoverPointUnit: "%",
|
||||
* - pointerEvents: "visiblePainted"
|
||||
*
|
||||
* Other style properties that have no default values:
|
||||
*
|
||||
* - externalGraphic,
|
||||
* - graphicWidth,
|
||||
* - graphicHeight,
|
||||
* - graphicOpacity
|
||||
*/
|
||||
OpenLayers.Feature.Vector.style = {
|
||||
'default': {
|
||||
|
||||
@@ -206,6 +206,7 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
|
||||
var height = style.graphicHeight || style.graphicWidth;
|
||||
width = width ? width : style.pointRadius*2;
|
||||
height = height ? height : style.pointRadius*2;
|
||||
var opacity = style.graphicOpacity || style.fillOpacity;
|
||||
|
||||
node.setAttributeNS(null, "x", x-(.5*width).toFixed());
|
||||
node.setAttributeNS(null, "y", -y-(.5*height).toFixed());
|
||||
@@ -213,7 +214,7 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
|
||||
node.setAttributeNS(null, "height", height);
|
||||
node.setAttributeNS("http://www.w3.org/1999/xlink", "href", style.externalGraphic);
|
||||
node.setAttributeNS(null, "transform", "scale(1,-1)");
|
||||
node.setAttributeNS(null, "style", "opacity: "+style.fillOpacity);
|
||||
node.setAttributeNS(null, "style", "opacity: "+opacity);
|
||||
} else {
|
||||
node.setAttributeNS(null, "r", style.pointRadius);
|
||||
}
|
||||
|
||||
@@ -210,7 +210,12 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
|
||||
fill = this.createNode('v:fill', node.id + "_fill");
|
||||
node.appendChild(fill);
|
||||
}
|
||||
if (style.fillOpacity) {
|
||||
// if graphicOpacity is set use it in priority for external graphic
|
||||
if (node._geometryClass == "OpenLayers.Geometry.Point" &&
|
||||
style.externalGraphic &&
|
||||
style.graphicOpacity) {
|
||||
fill.setAttribute("opacity", style.graphicOpacity);
|
||||
} else if (style.fillOpacity) {
|
||||
fill.setAttribute("opacity", style.fillOpacity);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user