Skip to content

Commit

Permalink
Allow circle and rectangle tooltip text to be set correctly. fixes Le…
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtoye committed Sep 15, 2013
1 parent 621146c commit 0f12f0c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/draw/handler/Draw.Circle.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ L.Draw.Circle = L.Draw.SimpleShape.extend({
// Save the type so super can fire, need to do this as cannot do this.TYPE :(
this.type = L.Draw.Circle.TYPE;

this._initialLabelText = L.drawLocal.draw.handlers.circle.tooltip.start;

L.Draw.SimpleShape.prototype.initialize.call(this, map, options);
},

_initialLabelText: L.drawLocal.draw.handlers.circle.tooltip.start,

_drawShape: function (latlng) {
if (!this._shape) {
this._shape = new L.Circle(this._startLatLng, this._startLatLng.distanceTo(latlng), this.options.shapeOptions);
Expand Down Expand Up @@ -53,7 +53,7 @@ L.Draw.Circle = L.Draw.SimpleShape.extend({
radius = this._shape.getRadius().toFixed(1);

this._tooltip.updateContent({
text: 'Release mouse to finish drawing.',
text: this._endLabelText,
subtext: 'Radius: ' + L.GeometryUtil.readableDistance(radius, this.options.metric)
});
}
Expand Down
3 changes: 2 additions & 1 deletion src/draw/handler/Draw.Rectangle.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ L.Draw.Rectangle = L.Draw.SimpleShape.extend({
// Save the type so super can fire, need to do this as cannot do this.TYPE :(
this.type = L.Draw.Rectangle.TYPE;

this._initialLabelText = L.drawLocal.draw.handlers.rectangle.tooltip.start;

L.Draw.SimpleShape.prototype.initialize.call(this, map, options);
},
_initialLabelText: L.drawLocal.draw.handlers.rectangle.tooltip.start,

_drawShape: function (latlng) {
if (!this._shape) {
Expand Down
4 changes: 3 additions & 1 deletion src/draw/handler/Draw.SimpleShape.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ L.Draw.SimpleShape = L.Draw.Feature.extend({
},

initialize: function (map, options) {
this._endLabelText = L.drawLocal.draw.handlers.simpleshape.tooltip.end;

L.Draw.Feature.prototype.initialize.call(this, map, options);
},

Expand Down Expand Up @@ -60,7 +62,7 @@ L.Draw.SimpleShape = L.Draw.Feature.extend({

this._tooltip.updatePosition(latlng);
if (this._isDrawing) {
this._tooltip.updateContent({ text: L.drawLocal.draw.handlers.simpleshape.tooltip.end });
this._tooltip.updateContent({ text: this._endLabelText });
this._drawShape(latlng);
}
},
Expand Down

0 comments on commit 0f12f0c

Please sign in to comment.