Skip to content

Commit

Permalink
Make toolbar dynamically update
Browse files Browse the repository at this point in the history
  • Loading branch information
sashadev-sky committed Apr 4, 2019
1 parent 2ebc6c4 commit a149476
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
14 changes: 9 additions & 5 deletions dist/leaflet.distortableimage.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/leaflet.distortableimage.js.map

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions src/edit/DistortableImage.Edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,17 +331,18 @@ L.DistortableImage.Edit = L.Handler.extend({
},

// TODO: toolbar for multiple image selection
_showToolbar: function(event) {
_showToolbar: function() {
var overlay = this._overlay,
target = event.target,
// target = event.target,
map = overlay._map;

/* Ensure that there is only ever one toolbar attached to each image. */
this._hideToolbar();

var point;
if (event.containerPoint) { point = event.containerPoint; }
else { point = target._leaflet_pos; }
// if (event.containerPoint) { point = event.containerPoint; }
// point = target._leaflet_pos;
point = overlay._image._leaflet_pos;

var raised_point = map.containerPointToLatLng(new L.Point(point.x,point.y-20));
raised_point.lng = overlay.getCenter().lng;
Expand Down
2 changes: 2 additions & 0 deletions src/edit/DistortableImage.EditToolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ var EditOverlayAction = LeafletToolbar.ToolbarAction.extend({
var editing = this._overlay.editing;

editing._toggleRotateDistort();
editing._hideToolbar();
editing._showToolbar();
this.disable();
}
}),
Expand Down

0 comments on commit a149476

Please sign in to comment.