Open GoogleCodeExporter opened 8 years ago
When I tried doing draggability in LabeledMarker, the problem was that the label
moved down on the marker while it was being dragged, and that didn't look great.
Yours doesn't seem to address that issue. Do you have a demo?
Original comment by pamela.fox
on 27 Aug 2008 at 5:56
Indeed, i forget to address that issue (sorry). i have the same problem and i
don't
already have a good patch to solve it. Currently i play with the label offset.
For
that, i added the following function in the labeledmarker.js file:
LabeledMarker.prototype.setLabelOffset = function(labelOffset) {
this.labelOffset_ = labelOffset;
this.redrawLabel_();
}
and in my own code, the following events:
GEvent.addListener(labeledMarker, "dragstart",
GEvent.callbackArgs(labeledMarker,
function(label) {
this.setLabelOffset(new GSize(label.length > 8 ? -6 : -3, -35));
}, this));
GEvent.addListener(marker, "dragend", GEvent.callbackArgs(labeledMarker,
function(label) {
this.setLabelOffset(new GSize(label.length > 8 ? -6 : -3, -22));
}, this));
But obviously this not a good solution, i need to find a better one putting all
the
code in the labelmarker.js file.
Original comment by gregory....@gmail.com
on 27 Aug 2008 at 8:03
I have changed redrawLabel_ method (only two lines):
var p = this.map_.fromLatLngToDivPixel(this.getLatLng());
var z = GOverlay.getZIndex(this.getLatLng().lat());
(use parent getLatLng() method instead of internal latlng_ property)
and text label now dragged with icon.
Original comment by theVi...@gmail.com
on 30 Aug 2008 at 7:13
gregory- I'm not sure there's actually a good solution besides actually
exposing the
current height offset of the marker through the API (which I thought about, but
couldn't decide best way to expose), or just disabling the label during
dragging.
theVisor- The label drags, but it drags below the icon.
Original comment by pamela.fox
on 30 Aug 2008 at 2:05
Original issue reported on code.google.com by
gregory....@gmail.com
on 20 Aug 2008 at 1:07Attachments: