correct transparency of result place rectangle and rectangle markers (fixes #312)
This commit is contained in:
parent
f317e6ccf0
commit
2ed61c7b08
4 changed files with 21 additions and 10 deletions
|
@ -533,6 +533,7 @@ Ox.Map = function(options, self) {
|
||||||
Ox.Log('Map', 'addP2P', data, place);
|
Ox.Log('Map', 'addP2P', data, place);
|
||||||
setPlaceControls(place);
|
setPlaceControls(place);
|
||||||
place.marker.update();
|
place.marker.update();
|
||||||
|
place.rectangle.update();
|
||||||
self.places.push(place);
|
self.places.push(place);
|
||||||
self.resultPlace = null;
|
self.resultPlace = null;
|
||||||
that.triggerEvent('addplace', place)
|
that.triggerEvent('addplace', place)
|
||||||
|
@ -1130,6 +1131,7 @@ Ox.Map = function(options, self) {
|
||||||
self.resultPlace = place;
|
self.resultPlace = place;
|
||||||
Ox.print('removed place, place is now', place);
|
Ox.print('removed place, place is now', place);
|
||||||
place.marker.update();
|
place.marker.update();
|
||||||
|
place.rectangle.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
function reset() {
|
function reset() {
|
||||||
|
|
|
@ -21,8 +21,9 @@ Ox.MapMarkerImage = (function() {
|
||||||
options = Ox.extend({
|
options = Ox.extend({
|
||||||
color: [255, 0, 0],
|
color: [255, 0, 0],
|
||||||
mode: 'normal', // normal, selected, editing
|
mode: 'normal', // normal, selected, editing
|
||||||
|
rectangle: false,
|
||||||
size: 16,
|
size: 16,
|
||||||
type: 'place', // place, result, rectangle
|
type: 'place', // place, result
|
||||||
}, options);
|
}, options);
|
||||||
|
|
||||||
var index = [
|
var index = [
|
||||||
|
@ -30,7 +31,7 @@ Ox.MapMarkerImage = (function() {
|
||||||
].join(';');
|
].join(';');
|
||||||
|
|
||||||
if (!cache[index]) {
|
if (!cache[index]) {
|
||||||
var color = options.type == 'rectangle' ? [0, 0, 0, 0]
|
var color = options.rectangle ? [0, 0, 0, 0]
|
||||||
: Ox.merge(
|
: Ox.merge(
|
||||||
Ox.clone(options.color),
|
Ox.clone(options.color),
|
||||||
[options.type == 'place' ? 0.75 : 0.25]
|
[options.type == 'place' ? 0.75 : 0.25]
|
||||||
|
|
|
@ -64,12 +64,13 @@ Ox.MapRectangle = function(options, self) {
|
||||||
function setOptions() {
|
function setOptions() {
|
||||||
var color = that.place.editing ? '#8080FF' : '#FFFFFF';
|
var color = that.place.editing ? '#8080FF' : '#FFFFFF';
|
||||||
that.rectangle.setOptions({
|
that.rectangle.setOptions({
|
||||||
|
bounds: that.place.bounds,
|
||||||
fillColor: color,
|
fillColor: color,
|
||||||
fillOpacity: that.place.editing ? 0.1 : 0,
|
fillOpacity: that.place.editing ? 0.1 : 0,
|
||||||
strokeColor: color,
|
strokeColor: color,
|
||||||
strokeOpacity: 1,
|
strokeOpacity: that.place.id[0] == '_' ? 0.5 : 1,
|
||||||
strokeWeight: 2
|
strokeWeight: 2
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/*@
|
/*@
|
||||||
|
@ -90,6 +91,7 @@ Ox.MapRectangle = function(options, self) {
|
||||||
Ox.forEach(that.markers, function(marker) {
|
Ox.forEach(that.markers, function(marker) {
|
||||||
marker.remove();
|
marker.remove();
|
||||||
});
|
});
|
||||||
|
return that;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*@
|
/*@
|
||||||
|
@ -98,7 +100,7 @@ Ox.MapRectangle = function(options, self) {
|
||||||
that.remove = function() {
|
that.remove = function() {
|
||||||
that.rectangle.setMap(null);
|
that.rectangle.setMap(null);
|
||||||
google.maps.event.clearListeners(that.rectangle);
|
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) {
|
Ox.forEach(that.markers, function(marker) {
|
||||||
marker.add();
|
marker.add();
|
||||||
});
|
});
|
||||||
|
return that;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*@
|
/*@
|
||||||
|
@ -116,12 +119,11 @@ Ox.MapRectangle = function(options, self) {
|
||||||
@*/
|
@*/
|
||||||
that.update = function() {
|
that.update = function() {
|
||||||
Ox.Log('Map', 'UPDATE...')
|
Ox.Log('Map', 'UPDATE...')
|
||||||
that.rectangle.setOptions({
|
setOptions();
|
||||||
bounds: that.place.bounds
|
|
||||||
});
|
|
||||||
Ox.forEach(that.markers, function(marker) {
|
Ox.forEach(that.markers, function(marker) {
|
||||||
marker.update();
|
marker.update();
|
||||||
});
|
});
|
||||||
|
return that;
|
||||||
}
|
}
|
||||||
|
|
||||||
return that;
|
return that;
|
||||||
|
|
|
@ -34,7 +34,8 @@ Ox.MapRectangleMarker = function(options, self) {
|
||||||
draggable: true,
|
draggable: true,
|
||||||
icon: Ox.MapMarkerImage({
|
icon: Ox.MapMarkerImage({
|
||||||
mode: 'editing',
|
mode: 'editing',
|
||||||
type: 'rectangle'
|
rectangle: true,
|
||||||
|
type: that.place.id[0] == '_' ? 'result' : 'place'
|
||||||
}),
|
}),
|
||||||
position: that.place.points[that.position],
|
position: that.place.points[that.position],
|
||||||
raiseOnDrag: false
|
raiseOnDrag: false
|
||||||
|
@ -111,7 +112,12 @@ Ox.MapRectangleMarker = function(options, self) {
|
||||||
@*/
|
@*/
|
||||||
that.update = function() {
|
that.update = function() {
|
||||||
that.marker.setOptions({
|
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],
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue