correct transparency of result place rectangle and rectangle markers (fixes #312)

This commit is contained in:
rlx 2012-03-07 13:28:45 +00:00
parent f317e6ccf0
commit 2ed61c7b08
4 changed files with 21 additions and 10 deletions

View file

@ -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() {

View file

@ -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]

View file

@ -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;

View file

@ -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],
});
};