leaflet-distortableimage
Advanced tools
Comparing version 0.16.6 to 0.17.7
Contributing to Leaflet.DistortableImage | ||
========================== | ||
We welcome community contributions to Leaflet.DistortableImage! To install Leaflet.DistortableImage locally, follow the instructions in the [README.md file](https://github.com/publiclab/Leaflet.DistortableImage/#contributing). | ||
We welcome community contributions to Leaflet.DistortableImage! There are [plenty of outstanding issues to resolve](https://github.com/publiclab/Leaflet.DistortableImage/issues). Please consider helping out. | ||
We especially welcome contributions from people from groups underrepresented in free and open source software! | ||
We especially welcome contributions from people from groups underrepresented in free and open source software. Our community aspires to be a respectful place. Please read and abide by our [Code of Conduct](https://publiclab.org/conduct). | ||
Our community aspires to be a respectful place. Please read and abide by our [Code of Conduct](https://publiclab.org/conduct). | ||
## First Timers Welcome! | ||
New to open source/free software? See our WELCOME PAGE, including a selection of issues we've made especially for first-timers. We're here to help, so just ask if one looks interesting: | ||
This project is a part of Public Lab's OSS community, which welcomes and supports contributions from newcomers to open source/free software. See the Public Lab [WELCOME PAGE](https://code.publiclab.org/#r=all), including a selection of issues we've made especially for first-timers across all projects. We're here to help, so just ask if one looks interesting. | ||
https://code.publiclab.org/#r=all | ||
Thank you so much! | ||
@@ -26,4 +22,43 @@ | ||
## Setup | ||
1\. This project uses Webpack to bundle JavaScript. From the root directory, run: | ||
```Bash | ||
# installs dependencies and the latest version of leaflet as a peer dependency; builds dist files. | ||
npm run setup | ||
``` | ||
* If you want to install a specific version of leaflet besides the latest, run `npm i leaflet@1.X.X --no-save` | ||
2\. Server setup. **Choose one option below.** | ||
- a. You can run it with the webpack development server we have set up: | ||
```Bash | ||
# Opens examples/index.html in your default browser and watch live for changes | ||
npm run serve:dev | ||
``` | ||
* b. Or to run it with your own server, just ensure that webpack is watching for updates to the `src` files: | ||
```Bash | ||
npm run watch:dev | ||
``` | ||
3\. Once you finish, commit your changes and a pre-commit hook automatically updates your `dist` files to a production build (via `npm run build`). | ||
*To learn more about our Webpack configuration file, take a look at [this](WEBPACK.md).* | ||
### Icons | ||
We use SVG for our icon system. Please visit our wiki [SVG Icon System](https://github.com/publiclab/Leaflet.DistortableImage/wiki/SVG-Icon-System) if you are interested in making updates to them or just simply learning about our workflow. | ||
### Testing | ||
[Guide](TESTING.md) on testing LDI. | ||
## Bug reports & troubleshooting | ||
If you are submitting a bug, please go to https://github.com/publiclab/Leaflet.DistortableImage/issues/new/ |
@@ -1,57 +0,57 @@ | ||
---------------------------------|---------|----------|---------|---------|-------------------------------------------------------------------------------------------------- | ||
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | ||
---------------------------------|---------|----------|---------|---------|-------------------------------------------------------------------------------------------------- | ||
All files | 53.74 | 42.62 | 54.05 | 53.58 | | ||
src | 65.32 | 57.66 | 68.33 | 65.51 | | ||
DistortableCollection.js | 39.8 | 34.29 | 46.15 | 39.8 | 35-40,67-83,111,127-157,167-229 | ||
DistortableImageOverlay.js | 75.4 | 65.69 | 85.29 | 75.71 | 35,46-47,60-61,95,143,227-228,245-247,260,267-296,367-395,444-461 | ||
src/components | 9.23 | 9.09 | 0 | 9.23 | | ||
DistortableImage.Keymapper.js | 9.23 | 9.09 | 0 | 9.23 | 11-96,100-105,110 | ||
src/edit | 54.9 | 43.07 | 54.26 | 54.74 | | ||
DistortableCollection.Edit.js | 35.85 | 29.21 | 34.21 | 35.85 | 23,35-59,68-81,88-99,114,118-119,157-177,187,193-198,203-211,237-356 | ||
DistortableImage.Edit.js | 67.02 | 54.05 | 69.09 | 66.85 | ...0,353-359,366,370,376-514,524,528,536-537,555,559,575,581,604,608,717,729,737,745,751,759,779 | ||
getEXIFdata.js | 3.45 | 0 | 0 | 3.45 | 5-64 | ||
src/edit/actions | 56.1 | 59.18 | 37.78 | 56.1 | | ||
BorderAction.js | 62.5 | 87.5 | 50 | 62.5 | 11-12,30-34 | ||
DeleteAction.js | 73.33 | 75 | 50 | 73.33 | 32-37 | ||
DistortAction.js | 71.43 | 100 | 50 | 71.43 | 16-18 | ||
DragAction.js | 100 | 100 | 100 | 100 | | ||
EditAction.js | 85.71 | 81.25 | 57.14 | 85.71 | 36,66,85-90,95 | ||
ExportAction.js | 23.21 | 28.57 | 8.33 | 23.21 | 29-104 | ||
FreeRotateAction.js | 100 | 100 | 100 | 100 | | ||
GeolocateAction.js | 14.29 | 0 | 0 | 14.29 | 5-18 | ||
LockAction.js | 78.95 | 75 | 50 | 78.95 | 35-40 | ||
OpacityAction.js | 58.82 | 87.5 | 50 | 58.82 | 11-12,29-34 | ||
RestoreAction.js | 11.11 | 0 | 0 | 11.11 | 5-22 | ||
RotateAction.js | 71.43 | 100 | 50 | 71.43 | 16-18 | ||
ScaleAction.js | 71.43 | 100 | 50 | 71.43 | 16-18 | ||
StackAction.js | 6.25 | 0 | 0 | 6.25 | 5-33 | ||
UnlockAction.js | 71.43 | 100 | 50 | 71.43 | 15-17 | ||
src/edit/handles | 34.44 | 8.7 | 51.35 | 34.44 | | ||
DistortHandle.js | 66.67 | 100 | 66.67 | 66.67 | 14-15 | ||
DragHandle.js | 33.33 | 100 | 50 | 33.33 | 14-17 | ||
EditHandle.js | 46.51 | 100 | 45.45 | 46.51 | 33-41,70-99 | ||
FreeRotateHandle.js | 17.39 | 0 | 66.67 | 17.39 | 14-42 | ||
LockHandle.js | 31.82 | 0 | 41.67 | 31.82 | 47-104 | ||
RotateHandle.js | 44.44 | 100 | 66.67 | 44.44 | 14-23 | ||
ScaleHandle.js | 20 | 0 | 66.67 | 20 | 14-46 | ||
src/edit/toolbars | 91.67 | 66.67 | 87.5 | 91.43 | | ||
DistortableImage.ControlBar.js | 100 | 50 | 100 | 100 | 3-22 | ||
DistortableImage.PopupBar.js | 88 | 75 | 83.33 | 87.5 | 15-16,35 | ||
src/iconsets | 100 | 100 | 100 | 100 | | ||
IconSet.js | 100 | 100 | 100 | 100 | | ||
KeymapperIconSet.js | 100 | 100 | 100 | 100 | | ||
ToolbarIconSet.js | 100 | 100 | 100 | 100 | | ||
src/mapmixins | 40.76 | 22.08 | 46.43 | 40.76 | | ||
BoxCollector.js | 16.36 | 0 | 18.18 | 16.36 | 24-120 | ||
DoubleClickLabels.js | 37.5 | 14.29 | 33.33 | 37.5 | 16,32,40-79 | ||
DoubleClickZoom.js | 54.76 | 32 | 75 | 54.76 | 23,29,42,57,69-97 | ||
MapMixins.js | 85 | 42.86 | 100 | 85 | 19,36,45 | ||
src/util | 64.44 | 36.59 | 73.91 | 62.79 | | ||
DomUtil.js | 75 | 53.85 | 80 | 75 | 21,31,35-36,43 | ||
IconUtil.js | 13.64 | 6.25 | 25 | 13.64 | 11,17-51 | ||
ImageUtil.js | 25 | 100 | 0 | 25 | 5-7 | ||
MatrixUtil.js | 92.86 | 100 | 85.71 | 91.67 | 47-48 | ||
TrigUtil.js | 100 | 66.67 | 100 | 100 | 5-6 | ||
Utils.js | 72.73 | 50 | 100 | 72.73 | 34-36 | ||
---------------------------------|---------|----------|---------|---------|-------------------------------------------------------------------------------------------------- | ||
-------------------|---------|----------|---------|---------|------------------- | ||
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | ||
-------------------|---------|----------|---------|---------|------------------- | ||
All files | 54.76 | 42.65 | 55.16 | 54.61 | | ||
src | 65.32 | 57.66 | 68.33 | 65.51 | | ||
...Collection.js | 39.8 | 34.29 | 46.15 | 39.8 | ...27-157,167-229 | ||
...ageOverlay.js | 75.4 | 65.69 | 85.29 | 75.71 | ...67-395,444-461 | ||
src/components | 9.23 | 9.09 | 0 | 9.23 | | ||
....Keymapper.js | 9.23 | 9.09 | 0 | 9.23 | 11-96,100-105,110 | ||
src/edit | 54.39 | 43.15 | 54.26 | 54.23 | | ||
...ction.Edit.js | 33.93 | 27.96 | 34.21 | 33.93 | ...03-211,237-357 | ||
...Image.Edit.js | 67.56 | 54.95 | 69.09 | 67.39 | ...29,745,759,779 | ||
getEXIFdata.js | 3.45 | 0 | 0 | 3.45 | 5-64 | ||
src/edit/actions | 56.1 | 59.18 | 37.78 | 56.1 | | ||
BorderAction.js | 62.5 | 87.5 | 50 | 62.5 | 11-12,30-34 | ||
DeleteAction.js | 73.33 | 75 | 50 | 73.33 | 32-37 | ||
DistortAction.js | 71.43 | 100 | 50 | 71.43 | 16-18 | ||
DragAction.js | 100 | 100 | 100 | 100 | | ||
EditAction.js | 85.71 | 81.25 | 57.14 | 85.71 | 36,66,85-90,95 | ||
ExportAction.js | 23.21 | 28.57 | 8.33 | 23.21 | 29-104 | ||
...tateAction.js | 100 | 100 | 100 | 100 | | ||
...cateAction.js | 14.29 | 0 | 0 | 14.29 | 5-18 | ||
LockAction.js | 78.95 | 75 | 50 | 78.95 | 35-40 | ||
OpacityAction.js | 58.82 | 87.5 | 50 | 58.82 | 11-12,29-34 | ||
RestoreAction.js | 11.11 | 0 | 0 | 11.11 | 5-22 | ||
RotateAction.js | 71.43 | 100 | 50 | 71.43 | 16-18 | ||
ScaleAction.js | 71.43 | 100 | 50 | 71.43 | 16-18 | ||
StackAction.js | 6.25 | 0 | 0 | 6.25 | 5-33 | ||
UnlockAction.js | 71.43 | 100 | 50 | 71.43 | 15-17 | ||
src/edit/handles | 47.71 | 8.7 | 60.53 | 47.71 | | ||
DistortHandle.js | 66.67 | 100 | 66.67 | 66.67 | 14-15 | ||
DragHandle.js | 50 | 100 | 66.67 | 50 | 14-17 | ||
EditHandle.js | 90.7 | 100 | 72.73 | 90.7 | 33-41 | ||
...tateHandle.js | 17.39 | 0 | 66.67 | 17.39 | 14-43 | ||
LockHandle.js | 31.82 | 0 | 41.67 | 31.82 | 47-104 | ||
RotateHandle.js | 44.44 | 100 | 66.67 | 44.44 | 14-23 | ||
ScaleHandle.js | 20 | 0 | 66.67 | 20 | 14-46 | ||
src/edit/toolbars | 91.67 | 66.67 | 87.5 | 91.43 | | ||
...ControlBar.js | 100 | 50 | 100 | 100 | 3-22 | ||
...e.PopupBar.js | 88 | 75 | 83.33 | 87.5 | 15-16,35 | ||
src/iconsets | 100 | 100 | 100 | 100 | | ||
IconSet.js | 100 | 100 | 100 | 100 | | ||
...perIconSet.js | 100 | 100 | 100 | 100 | | ||
...barIconSet.js | 100 | 100 | 100 | 100 | | ||
src/mapmixins | 40.76 | 22.08 | 46.43 | 40.76 | | ||
BoxCollector.js | 16.36 | 0 | 18.18 | 16.36 | 24-120 | ||
...lickLabels.js | 37.5 | 14.29 | 33.33 | 37.5 | 16,32,40-79 | ||
...eClickZoom.js | 54.76 | 32 | 75 | 54.76 | 23,29,42,57,69-97 | ||
MapMixins.js | 85 | 42.86 | 100 | 85 | 19,36,45 | ||
src/util | 64.44 | 36.59 | 73.91 | 62.79 | | ||
DomUtil.js | 75 | 53.85 | 80 | 75 | 21,31,35-36,43 | ||
IconUtil.js | 13.64 | 6.25 | 25 | 13.64 | 11,17-51 | ||
ImageUtil.js | 25 | 100 | 0 | 25 | 5-7 | ||
MatrixUtil.js | 92.86 | 100 | 85.71 | 91.67 | 47-48 | ||
TrigUtil.js | 100 | 66.67 | 100 | 100 | 5-6 | ||
Utils.js | 72.73 | 50 | 100 | 72.73 | 34-36 | ||
-------------------|---------|----------|---------|---------|------------------- |
const webpackConfig = require('./webpack.config.js'); | ||
module.exports = function(grunt) { | ||
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks); | ||
// load npm tasks for grunt-* libs, excluding grunt-cli | ||
require('matchdep').filterDev('grunt-*').filter(function(pkg) { | ||
return ['grunt-cli'].indexOf(pkg) < 0; | ||
}).forEach(grunt.loadNpmTasks); | ||
@@ -30,3 +33,2 @@ grunt.initConfig({ | ||
L: false, | ||
$: false, | ||
LeafletToolbar: false, | ||
@@ -126,4 +128,2 @@ warpWebGl: false, | ||
grunt.loadNpmTasks('grunt-webpack'); | ||
/* Run tests once. */ | ||
@@ -130,0 +130,0 @@ grunt.registerTask('test', ['jshint', 'karma:test']); |
{ | ||
"name": "leaflet-distortableimage", | ||
"version": "0.16.6", | ||
"version": "0.17.7", | ||
"description": "Leaflet plugin enabling image overlays to be distorted, stretched, and warped (built for Public Lab's MapKnitter: http://publiclab.org).", | ||
@@ -9,5 +9,8 @@ "engines": { | ||
"scripts": { | ||
"setup": "npm i && npm i leaflet --no-save && npm run build", | ||
"watch:dev": "webpack --watch", | ||
"serve:dev": "cross-env NODE_ENV=development webpack-dev-server", | ||
"test": "grunt test", | ||
"watch:test": "grunt karma:development:start && grunt watch", | ||
"build": "cross-env NODE_ENV=production grunt build", | ||
"dev": "npm run build; cross-env NODE_ENV=development webpack-dev-server", | ||
"test": "grunt test", | ||
"linter": "./node_modules/.bin/eslint ." | ||
@@ -42,5 +45,3 @@ }, | ||
"glfx": "0.0.4", | ||
"jquery": "~> 3.4.0", | ||
"leaflet-toolbar": "0.4.0-alpha.2", | ||
"promise-polyfill": "^8.1.3", | ||
"webgl-distort": "0.0.2" | ||
@@ -52,6 +53,6 @@ }, | ||
"babel-loader": "^8.1.0", | ||
"chai": "^4.1.2", | ||
"chai": "^4.2.0", | ||
"clean-webpack-plugin": "^3.0.0", | ||
"cross-env": "^7.0.2", | ||
"eslint": "^6.4.0", | ||
"eslint": "^7.3.1", | ||
"eslint-config-google": "^0.14.0", | ||
@@ -81,3 +82,3 @@ "glob": "^7.1.6", | ||
"uglify-js": "^3.7.4", | ||
"webpack": "^4.41.5", | ||
"webpack": "^4.42.1", | ||
"webpack-cli": "^3.3.10", | ||
@@ -89,3 +90,8 @@ "webpack-dev-server": "^3.10.1", | ||
"leaflet": "^1.0.0" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "npm run linter && npm run build && git add dist/leaflet.distortableimage.js" | ||
} | ||
} | ||
} |
@@ -31,7 +31,2 @@ # Leaflet.DistortableImage | ||
## Setup | ||
* From the root directory, run `npm install` and | ||
`npm install leaflet --no-save` | ||
## Demo | ||
@@ -214,3 +209,3 @@ | ||
rotation: { | ||
deg: 180 | ||
deg: 180, | ||
}, | ||
@@ -368,3 +363,3 @@ }).addTo(map); | ||
Defaults: | ||
#### Default tools | ||
@@ -391,3 +386,10 @@ * **L.BorderAction** (<kbd>b</kbd>) | ||
Addons: | ||
#### Add-on tools | ||
These may be added using `addTool()`, like this: | ||
```js | ||
distortableImageLayer.editing.addTool(L.StackAction); | ||
``` | ||
* **L.RestoreAction** | ||
@@ -860,30 +862,8 @@ * Restores the image to its natural dimensions, scale, rotation, and location on the map. | ||
--- | ||
## Contributing | ||
There are [plenty of outstanding issues to resolve](https://github.com/publiclab/Leaflet.DistortableImage/issues). Please consider helping out! | ||
See [CONTRIBUTING.md](./CONTRIBUTING.md) for details on how you can contribute to Leaflet.DistortableImage. | ||
1. This project uses `Webpack` to bundle JavaScript. | ||
```Bash | ||
$ npm install | ||
# install leaflet peer dependency locally | ||
$ npm install leaflet --no-save | ||
# It'll open examples/index.html in your default browser and watch live for changes (Webpack development server compiles the changes and refreshes the browser) | ||
$ npm run dev | ||
``` | ||
2. Once you finish, commit your changes and a pre-commit hook will build all files from `/src/` into the `/dist/` folder. | ||
3. _Optional_: We use SVG for our icon system. Please visit our wiki [SVG Icon System](https://github.com/publiclab/Leaflet.DistortableImage/wiki/SVG-Icon-System) if you are interested in making updates to them or just simply learning about our workflow. | ||
4. _Optional_: To learn more about our Webpack configuration file, take a look at [this](WEBPACK.md). | ||
### Testing | ||
[Guide](TESTING.md) on testing LDI. | ||
--- | ||
### Contributors | ||
@@ -890,0 +870,0 @@ |
L.StackAction = L.EditAction.extend({ | ||
initialize: function(map, overlay, options) { | ||
initialize(map, overlay, options) { | ||
var edit = overlay.editing; | ||
@@ -29,3 +29,3 @@ var use; | ||
addHooks: function() { | ||
addHooks() { | ||
var edit = this._overlay.editing; | ||
@@ -32,0 +32,0 @@ |
L.UnlockAction = L.EditAction.extend({ | ||
initialize: function(map, overlay, options) { | ||
initialize(map, overlay, options) { | ||
options = options || {}; | ||
@@ -14,3 +14,3 @@ options.toolbarIcon = { | ||
addHooks: function() { | ||
addHooks() { | ||
var edit = this._overlay.editing; | ||
@@ -17,0 +17,0 @@ edit._unlockGroup(); |
@@ -306,8 +306,8 @@ L.DistortableImage = L.DistortableImage || {}; | ||
self.updateInterval = setInterval(function intervalUpdater() { | ||
$.ajax(statusUrl + '?' + Date.now(), {// bust cache with timestamp | ||
type: 'GET', | ||
crossDomain: true, | ||
}).done(function(data) { | ||
opts.updater(data); | ||
}); | ||
var request = new Request(statusUrl+'?'+Date.now(), {method: 'GET'}); | ||
fetch(request).then(function(response) { | ||
if (response.ok) { | ||
return response.text(); | ||
} | ||
}).then(opts.updater); | ||
}, opts.frequency); | ||
@@ -318,13 +318,13 @@ } | ||
function _defaultFetchStatusUrl(opts) { | ||
$.ajax({ | ||
url: opts.exportStartUrl, | ||
crossDomain: true, | ||
type: 'POST', | ||
data: { | ||
collection: JSON.stringify(opts.collection), | ||
scale: opts.scale, | ||
upload: true, | ||
}, | ||
success: function(data) { opts.handleStatusRes(data); }, // this handles the initial response | ||
}); | ||
var form = new FormData(); | ||
form.append('collection', JSON.stringify(opts.collection)); | ||
form.append('scale', opts.scale); | ||
form.append('upload', true); | ||
var requestOptions = {method: 'POST', body: form}; | ||
var request = new Request(opts.exportStartUrl, requestOptions); | ||
fetch(request).then(function(response) { | ||
if (response.ok) { | ||
return response.text(); | ||
} | ||
}).then(opts.handleStatusRes); | ||
} | ||
@@ -331,0 +331,0 @@ |
@@ -116,3 +116,3 @@ L.DistortableImage = L.DistortableImage || {}; | ||
for (i = 0; i < 4; i++) { | ||
this._dragHandles.addLayer(new L.DragHandle(overlay, i)); | ||
this._dragHandles.addLayer(L.dragHandle(overlay, i)); | ||
} | ||
@@ -119,0 +119,0 @@ |
@@ -24,1 +24,5 @@ L.DragHandle = L.EditHandle.extend({ | ||
}); | ||
L.dragHandle = function(overlay, idx, options) { | ||
return new L.DragHandle(overlay, idx, options); | ||
}; |
@@ -13,19 +13,20 @@ L.FreeRotateHandle = L.EditHandle.extend({ | ||
_onHandleDrag: function() { | ||
var overlay = this._handled; | ||
var map = overlay._map; | ||
var edgeMinWidth = overlay.edgeMinWidth; | ||
var formerLatLng = overlay.getCorner(this._corner); | ||
var newLatLng = this.getLatLng(); | ||
var angle = this.calculateAngleDelta(formerLatLng, newLatLng); | ||
var scale = this._calculateScalingFactor(formerLatLng, newLatLng); | ||
_onHandleDrag() { | ||
const overlay = this._handled; | ||
const map = overlay._map; | ||
const formerLatLng = overlay.getCorner(this._corner); | ||
const newLatLng = this.getLatLng(); | ||
const angle = this.calculateAngleDelta(formerLatLng, newLatLng); | ||
const scale = this._calculateScalingFactor(formerLatLng, newLatLng); | ||
if (angle !== 0) { overlay.rotateBy(angle, 'rad'); } | ||
let edgeMinWidth = overlay.edgeMinWidth; | ||
if (!edgeMinWidth) { edgeMinWidth = 50; } /* just in case */ | ||
var corner1 = map.latLngToContainerPoint(overlay.getCorner(0)); | ||
var corner2 = 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); | ||
const corner1 = map.latLngToContainerPoint(overlay.getCorner(0)); | ||
const corner2 = map.latLngToContainerPoint(overlay.getCorner(1)); | ||
const w = Math.abs(corner1.x - corner2.x); | ||
const h = Math.abs(corner1.y - corner2.y); | ||
const distance = Math.sqrt(w * w + h * h); | ||
if (distance > edgeMinWidth || scale > 1) { | ||
@@ -38,3 +39,3 @@ overlay.scaleBy(scale); | ||
updateHandle: function() { | ||
updateHandle() { | ||
this.setLatLng(this._handled.getCorner(this._corner)); | ||
@@ -44,4 +45,4 @@ }, | ||
L.freeRotateHandle = function(overlay, idx, options) { | ||
L.freeRotateHandle = (overlay, idx, options) => { | ||
return new L.FreeRotateHandle(overlay, idx, options); | ||
}; |
@@ -7,3 +7,3 @@ /** | ||
L.Map.DoubleClickZoom.include({ | ||
addHooks: function() { | ||
addHooks() { | ||
this._map.on({ | ||
@@ -15,3 +15,3 @@ click: this._fireIfSingle, | ||
removeHooks: function() { | ||
removeHooks() { | ||
this._map.off({ | ||
@@ -23,3 +23,3 @@ click: this._fireIfSingle, | ||
enable: function() { | ||
enable() { | ||
if (this._enabled) { return this; } | ||
@@ -42,3 +42,3 @@ | ||
disable: function() { | ||
disable() { | ||
if (!this._enabled) { return this; } | ||
@@ -54,3 +54,3 @@ | ||
_fireIfSingle: function(e) { | ||
_fireIfSingle(e) { | ||
var map = this._map; | ||
@@ -79,3 +79,3 @@ var oe = e.originalEvent; | ||
_onDoubleClick: function(e) { | ||
_onDoubleClick(e) { | ||
var map = this._map; | ||
@@ -82,0 +82,0 @@ var oe = e.originalEvent; |
@@ -7,3 +7,3 @@ L.IconUtil = { | ||
*/ | ||
create: function(ref) { | ||
create(ref) { | ||
if (/^#/.test(ref)) { | ||
@@ -20,3 +20,3 @@ ref = ref.replace(/^#/, ''); | ||
addClassToSvg: function(container, loader) { | ||
addClassToSvg(container, loader) { | ||
var svg = container.querySelector('svg'); | ||
@@ -30,3 +30,3 @@ | ||
// finds the use element and toggles its icon reference | ||
toggleXlink: function(container, ref1, ref2) { | ||
toggleXlink(container, ref1, ref2) { | ||
if (!/^#/.test(ref1)) { | ||
@@ -48,3 +48,3 @@ ref1 = '#' + ref1; | ||
toggleTitle: function(container, title1, title2) { | ||
toggleTitle(container, title1, title2) { | ||
var toggled = container.getAttribute('title') === title1 ? title2 : title1; | ||
@@ -51,0 +51,0 @@ |
@@ -34,3 +34,2 @@ // Karma configuration | ||
'node_modules/chai/chai.js', | ||
'node_modules/sinon/pkg/sinon.js', | ||
'test/polyfill/*.js', | ||
@@ -107,2 +106,6 @@ 'src/util/*.js', | ||
// to address Travis build errors; https://github.com/publiclab/Leaflet.DistortableImage/pull/675 | ||
// https://docs.travis-ci.com/user/gui-and-headless-browsers/#karma-and-firefox-inactivity-timeouts | ||
browserNoActivityTimeout: 40000, | ||
// Workaround for PhantomJS random DISCONNECTED error | ||
@@ -109,0 +112,0 @@ browserDisconnectTimeout: 10000, // default 2000 |
@@ -1,2 +0,1 @@ | ||
const webpack = require('webpack'); | ||
const glob = require('glob'); | ||
@@ -16,3 +15,3 @@ const path = require('path'); | ||
...glob.sync('./src/edit/handles/*', { | ||
ignore: './src/edit/handles/EditHandle.js' | ||
ignore: './src/edit/handles/EditHandle.js', | ||
}), | ||
@@ -24,3 +23,3 @@ './src/iconsets/IconSet.js', | ||
...glob.sync('./src/edit/actions/*', { | ||
ignore: './src/edit/actions/EditAction.js' | ||
ignore: './src/edit/actions/EditAction.js', | ||
}), | ||
@@ -34,10 +33,11 @@ './src/edit/toolbars/DistortableImage.PopupBar.js', | ||
...glob.sync('./src/mapmixins/*', { | ||
ignore: './src/mapmixins/DoubleClickZoom.js' | ||
}) | ||
ignore: './src/mapmixins/DoubleClickZoom.js', | ||
}), | ||
], | ||
output: { | ||
path: path.resolve(__dirname, 'dist'), | ||
publicPath: '/dist/', | ||
filename: 'leaflet.distortableimage.js', | ||
hotUpdateChunkFilename: 'hot/hot-update.js', | ||
hotUpdateMainFilename: 'hot/hot-update.json' | ||
hotUpdateMainFilename: 'hot/hot-update.json', | ||
}, | ||
@@ -52,7 +52,7 @@ module: { | ||
options: { | ||
presets: ['@babel/preset-env'] | ||
} | ||
} | ||
} | ||
] | ||
presets: ['@babel/preset-env'], | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
@@ -63,11 +63,12 @@ devServer: { | ||
hot: true, | ||
publicPath: '/', | ||
writeToDisk: true, | ||
inline: true, | ||
open: true, | ||
openPage: 'examples/index.html' | ||
openPage: 'examples/index.html', | ||
publicPath: '/dist/', | ||
clientLogLevel: 'silent', | ||
}, | ||
devtool: 'source-map', | ||
stats: 'errors-only', | ||
plugins: [] | ||
plugins: [], | ||
}; | ||
@@ -85,8 +86,8 @@ | ||
'./node_modules/glfx/glfx.js', | ||
'./node_modules/exif-js/exif.js' | ||
'./node_modules/exif-js/exif.js', | ||
], | ||
'vendor.css': [ | ||
'./node_modules/leaflet/dist/leaflet.css', | ||
'./node_modules/leaflet-toolbar/dist/leaflet.toolbar.css' | ||
] | ||
'./node_modules/leaflet-toolbar/dist/leaflet.toolbar.css', | ||
], | ||
}, | ||
@@ -93,0 +94,0 @@ transform: { |
@@ -7,3 +7,2 @@ # Webpack configuration file | ||
// Include necessary modules | ||
const webpack = require('webpack'); | ||
const glob = require('glob'); | ||
@@ -52,6 +51,10 @@ const path = require('path'); | ||
path: path.resolve(__dirname, 'dist'), | ||
publicPath: '/dist/', | ||
filename: 'leaflet.distortableimage.js', | ||
/** | ||
* Webpack live server, on change in the source code, compiles files again and * generates new hot update files. Instead of generating new files on each change, * we just override the previous file. | ||
* Webpack dev server regenerates new hot update files on changes in src code. | ||
* The 2 options below have it override the existing ones instead, | ||
*/ | ||
// Filename of hot update chunks | ||
@@ -86,7 +89,7 @@ hotUpdateChunkFilename: 'hot/hot-update.js', | ||
port: 8080, | ||
// Enable Hot Module Replacement(HMR) | ||
// HMR allows updating modules without forcing a page refresh | ||
// Enable Hot Module Replacement (HMR), allowing | ||
// module updates without forcing a page reload. | ||
hot: true, | ||
// Make bundled files available on this location | ||
publicPath: '/', | ||
// Make bundled files available on this location. | ||
publicPath: '/dist/', | ||
writeToDisk: true, | ||
@@ -97,3 +100,5 @@ // Make build messages appear in the browser console | ||
open: true, | ||
openPage: 'examples/index.html' | ||
openPage: 'examples/index.html', | ||
// Make less messages appeaar in browser console | ||
clientLogLevel: 'silent', | ||
}, | ||
@@ -100,0 +105,0 @@ // Generate source maps |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
5
2736900
251
6755
873
4
- Removedjquery@~> 3.4.0
- Removedpromise-polyfill@^8.1.3
- Removedjquery@3.4.1(transitive)
- Removedpromise-polyfill@8.3.0(transitive)