leaflet-distortableimage
Advanced tools
Comparing version 0.6.1 to 0.6.2
{ | ||
"name": "leaflet-distortableimage", | ||
"version": "0.6.1", | ||
"version": "0.6.2", | ||
"description": "Leaflet plugin enabling image overlays to be distorted, stretched, and warped (built for Public Lab's MapKnitter: http://publiclab.org).", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -5,2 +5,3 @@ Leaflet.DistortableImage | ||
[](https://travis-ci.org/publiclab/Leaflet.DistortableImage) | ||
[](https://badge.fury.io/js/leaflet-distortableimage) | ||
@@ -103,3 +104,3 @@ A Leaflet extension to distort images -- "rubbersheeting" -- for the [MapKnitter.org](http://mapknitter.org) ([src](https://github.com/publiclab/mapknitter)) image georectification service by [Public Lab](http://publiclab.org). Leaflet.DistortableImage allows for perspectival distortions of images, client-side, using CSS3 transformations in the DOM. | ||
img = L.distortableImageOverlay( | ||
'example.png', { | ||
* 'example.png', { | ||
// 'corners' is the only required option for this class | ||
@@ -153,3 +154,3 @@ // and is in NW, NE, SW, SE order | ||
Note: when working with the multi image interface, the collection group will ensure only the last overlay you pass `selected` to will appear initially selected. | ||
Note: when working with the multi image interface, only the last overlay you pass `selected: true` to will appear with editing handles _and_ a toolbar. | ||
@@ -156,0 +157,0 @@ ### Mode |
@@ -22,4 +22,2 @@ L.DistortableCollection = L.FeatureGroup.extend({ | ||
}, this); | ||
this._lastInitialSelected(); | ||
}, | ||
@@ -125,18 +123,2 @@ | ||
_lastInitialSelected: function() { | ||
var layerArr = this.getLayers(); | ||
var initialSelected = layerArr.filter(function(layer) { | ||
return layer.options.selected; | ||
}); | ||
if (initialSelected.length !== 0) { | ||
this.eachLayer(function(layer) { | ||
if (!initialSelected[-1]) { | ||
layer._deselect(); | ||
} | ||
}); | ||
} | ||
}, | ||
_longPressMultiSelect: function(e) { | ||
@@ -143,0 +125,0 @@ var image = e.target; |
@@ -8,3 +8,3 @@ L.DistortableImageOverlay = L.ImageOverlay.extend({ | ||
// todo: find ideal number to prevent distortions during RotateScale, and make it dynamic (remove hardcoding) | ||
edgeMinWidth: 520 | ||
edgeMinWidth: 50 | ||
}, | ||
@@ -11,0 +11,0 @@ |
@@ -509,3 +509,2 @@ L.DistortableImage = L.DistortableImage || {}; | ||
// TODO: toolbar for multiple image selection | ||
_showToolbar: function() { | ||
@@ -512,0 +511,0 @@ var overlay = this._overlay, |
@@ -27,6 +27,9 @@ L.RotateScaleHandle = L.EditHandle.extend({ | ||
if (overlay.hasOwnProperty('edgeMinWidth')){ | ||
var edgeMinWidth = overlay.edgeMinWidth, | ||
w = L.latLng(overlay.getCorner(0)).distanceTo(overlay.getCorner(1)), | ||
h = L.latLng(overlay.getCorner(1)).distanceTo(overlay.getCorner(2)); | ||
if ((w > edgeMinWidth && h > edgeMinWidth) || scale > 1) { | ||
var edgeMinWidth = overlay.edgeMinWidth; | ||
var corner1 = overlay._map.latLngToContainerPoint(overlay.getCorner(0)), | ||
corner2 = overlay._map.latLngToContainerPoint(overlay.getCorner(1)); | ||
var w = Math.abs(corner1.x - corner2.x); | ||
var h = Math.abs(corner1.y - corner2.y); | ||
var distance = Math.sqrt(w * w + h * h); | ||
if ((distance > edgeMinWidth) || scale > 1) { | ||
edit._scaleBy(scale); | ||
@@ -33,0 +36,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
85
455
0
1416016
5022