From 2ed61c7b0823f2655bdbeae6c2b4b07704efdbe4 Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Wed, 7 Mar 2012 13:28:45 +0000 Subject: [PATCH] correct transparency of result place rectangle and rectangle markers (fixes #312) --- source/Ox.UI/js/Map/Ox.Map.js | 2 ++ source/Ox.UI/js/Map/Ox.MapMarkerImage.js | 5 +++-- source/Ox.UI/js/Map/Ox.MapRectangle.js | 14 ++++++++------ source/Ox.UI/js/Map/Ox.MapRectangleMarker.js | 10 ++++++++-- 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/source/Ox.UI/js/Map/Ox.Map.js b/source/Ox.UI/js/Map/Ox.Map.js index e8ed05b7..45b27c4d 100644 --- a/source/Ox.UI/js/Map/Ox.Map.js +++ b/source/Ox.UI/js/Map/Ox.Map.js @@ -533,6 +533,7 @@ Ox.Map = function(options, self) { Ox.Log('Map', 'addP2P', data, place); setPlaceControls(place); place.marker.update(); + place.rectangle.update(); self.places.push(place); self.resultPlace = null; that.triggerEvent('addplace', place) @@ -1130,6 +1131,7 @@ Ox.Map = function(options, self) { self.resultPlace = place; Ox.print('removed place, place is now', place); place.marker.update(); + place.rectangle.update(); } function reset() { diff --git a/source/Ox.UI/js/Map/Ox.MapMarkerImage.js b/source/Ox.UI/js/Map/Ox.MapMarkerImage.js index ef3e9117..41a04a1e 100644 --- a/source/Ox.UI/js/Map/Ox.MapMarkerImage.js +++ b/source/Ox.UI/js/Map/Ox.MapMarkerImage.js @@ -21,8 +21,9 @@ Ox.MapMarkerImage = (function() { options = Ox.extend({ color: [255, 0, 0], mode: 'normal', // normal, selected, editing + rectangle: false, size: 16, - type: 'place', // place, result, rectangle + type: 'place', // place, result }, options); var index = [ @@ -30,7 +31,7 @@ Ox.MapMarkerImage = (function() { ].join(';'); if (!cache[index]) { - var color = options.type == 'rectangle' ? [0, 0, 0, 0] + var color = options.rectangle ? [0, 0, 0, 0] : Ox.merge( Ox.clone(options.color), [options.type == 'place' ? 0.75 : 0.25] diff --git a/source/Ox.UI/js/Map/Ox.MapRectangle.js b/source/Ox.UI/js/Map/Ox.MapRectangle.js index c9bb4057..40942df8 100644 --- a/source/Ox.UI/js/Map/Ox.MapRectangle.js +++ b/source/Ox.UI/js/Map/Ox.MapRectangle.js @@ -64,12 +64,13 @@ Ox.MapRectangle = function(options, self) { function setOptions() { var color = that.place.editing ? '#8080FF' : '#FFFFFF'; that.rectangle.setOptions({ + bounds: that.place.bounds, fillColor: color, fillOpacity: that.place.editing ? 0.1 : 0, strokeColor: color, - strokeOpacity: 1, + strokeOpacity: that.place.id[0] == '_' ? 0.5 : 1, strokeWeight: 2 - }) + }); } /*@ @@ -90,6 +91,7 @@ Ox.MapRectangle = function(options, self) { Ox.forEach(that.markers, function(marker) { marker.remove(); }); + return that; }; /*@ @@ -98,7 +100,7 @@ Ox.MapRectangle = function(options, self) { that.remove = function() { that.rectangle.setMap(null); google.maps.event.clearListeners(that.rectangle); - return that + return that; } /*@ @@ -109,6 +111,7 @@ Ox.MapRectangle = function(options, self) { Ox.forEach(that.markers, function(marker) { marker.add(); }); + return that; }; /*@ @@ -116,12 +119,11 @@ Ox.MapRectangle = function(options, self) { @*/ that.update = function() { Ox.Log('Map', 'UPDATE...') - that.rectangle.setOptions({ - bounds: that.place.bounds - }); + setOptions(); Ox.forEach(that.markers, function(marker) { marker.update(); }); + return that; } return that; diff --git a/source/Ox.UI/js/Map/Ox.MapRectangleMarker.js b/source/Ox.UI/js/Map/Ox.MapRectangleMarker.js index 0cec3c6e..8d37218f 100644 --- a/source/Ox.UI/js/Map/Ox.MapRectangleMarker.js +++ b/source/Ox.UI/js/Map/Ox.MapRectangleMarker.js @@ -34,7 +34,8 @@ Ox.MapRectangleMarker = function(options, self) { draggable: true, icon: Ox.MapMarkerImage({ mode: 'editing', - type: 'rectangle' + rectangle: true, + type: that.place.id[0] == '_' ? 'result' : 'place' }), position: that.place.points[that.position], raiseOnDrag: false @@ -111,7 +112,12 @@ Ox.MapRectangleMarker = function(options, self) { @*/ that.update = function() { that.marker.setOptions({ - position: that.place.points[that.position] + icon: Ox.MapMarkerImage({ + mode: 'editing', + rectangle: true, + type: that.place.id[0] == '_' ? 'result' : 'place' + }), + position: that.place.points[that.position], }); };