Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.18.0 #1548

Merged
merged 33 commits into from
Dec 29, 2024
Merged

v2.18.0 #1548

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
b6f1ac8
ci: fix name pattern for release asset
mscno Feb 19, 2024
414dcc1
ci: add environment key to release job
mscno Feb 19, 2024
e00b5f5
fix: update readme and package.json
mscno Feb 19, 2024
b566d7f
build: cleanup and bump nvmrc version
mscno Feb 20, 2024
6e47f00
Additional Control methods (#1295) (minor)
TurtIeSocks Feb 27, 2024
20df292
Update TypeScript definition for Controls (patch)
Falke-Design Feb 27, 2024
7dd940b
Prevent drawing of rectangle whenn the corners have the same position…
Falke-Design Mar 24, 2024
275e1e7
Update translations pt_br and add translations pt_pt (#1466) (minor)
leoneljdias Mar 24, 2024
f551fa7
Add fallback to english translation if translations is missing (#1461…
Falke-Design Mar 24, 2024
b491854
Prevent opening popup on ignored layers while drawing (#1471) (patch)
Falke-Design Mar 26, 2024
ae21e82
Add sourcemaps to dist (#1480)
mscno Apr 15, 2024
8240215
Merge pull request #1483 from geoman-io/patch/1480
mscno Apr 15, 2024
e9d0f10
Remove extra backslash in css <\/style> closing tag (#1481) (minor)
mscno Apr 16, 2024
b736a1d
Remove :focus of marker-icon style to fix marker jumping while zoomin…
Falke-Design Apr 28, 2024
c88fd70
Backport Pro changes into OSS (#1490) (patch)
Falke-Design May 3, 2024
d5cb57b
Bump version to 2.17
mscno May 15, 2024
03a794c
Fix typo in TS
Falke-Design Jun 5, 2024
9f6aac7
fixes setLang to handle navigator.language formats (such as "fr-FR") …
mscno Jun 15, 2024
c8961ef
Add missing type definition `name` in `Action` (#1514) (patch)
m208 Sep 15, 2024
772c47c
Rename everywehre resizableCircle to resizeableCircle (#1518) (patch)
DoiMayank Oct 13, 2024
7a34d73
Fix snapping when polyline has only one coordinate (#1526) (patch)
Falke-Design Nov 5, 2024
d83df5e
Update README.md
mscno Nov 8, 2024
346205f
Upgrade Cypress & package.json & apply some fixes from Pro version (#…
Falke-Design Nov 23, 2024
d955384
Fix dragging center marker of circle while snapping is disabled (#153…
Falke-Design Nov 23, 2024
d7ea514
Center text in TextLayer with css box-sizing (#1509) (patch)
zzxming Nov 23, 2024
71b83e5
Allow removal of holes in polygons while maintaining the minimum vert…
Tobikblom Nov 24, 2024
b55fd6d
Remove temp layers after editing / removing (#1534) (patch)
Falke-Design Nov 24, 2024
abe8408
Show HintMarker at the last position if continueDrawing is enabled (#…
Falke-Design Nov 24, 2024
7b02826
Only check self-intersection when allowSelfIntersection is false (#15…
Falke-Design Nov 24, 2024
408b197
Overwrite leaflet-interactive css while drawing for crosshair cursor …
Falke-Design Nov 24, 2024
480f490
Add new option to disable vertex snapping - snapVertex (#1539) (minor)
Falke-Design Nov 24, 2024
84918c3
Fix Text test (#1540) (ignore)
Falke-Design Nov 24, 2024
025f768
Bump to 2.18.0
mscno Dec 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ on:
- 'v*.*.*'

env:
FILE_NAME_PREFIX: geoman-io-leaflet-geoman-pro
FILE_NAME_PREFIX: geoman-io-leaflet-geoman
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

jobs:
build:
environment: release
name: release job
runs-on: ubuntu-latest

Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ npm-debug.log
/cypress/screenshots
/cypress/videos
.eslintcache
.env
*.tgz
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16.15.0
v20.5.1
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodejs 20.5.1
19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!-- hey there, thanks for reporting an issue or feature request. If you found unexpected behaviour or problems using leaflet-geoman, please provide a demo via JSfiddle that reproduces the problem. You can use this as a starting point: https://jsfiddle.net/o1dwu2vg/ . This saves me a lot of time to find the issue and I can help you / fix it much faster :-) - THANKS -->
<!-- hey there, thanks for reporting an issue or feature request. If you found unexpected behaviour or problems using leaflet-geoman, please provide a demo that reproduces the problem. You can use this as a starting point: https://plnkr.co/edit/3XhAuzVQ2CMyNFSr . This saves a lot of time to find the issue and to help you / fix it much faster :-) - THANKS -->
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<p align="center">
<a href="https://geoman.io">
<img width="130" alt="Geoman Logo" src="https://geoman-static.onrender.com/assets/logo_white_bg.svg" />
<img width="130" alt="Geoman Logo" src="https://assets.geoman.io/assets/logo_white_bg.svg" />
</a>
</p>
<h1 align="center">
Expand All @@ -23,9 +23,8 @@
</a>
</p>


<p align="center">
<img src="https://geoman-static.onrender.com/assets/draw-example.png" alt="Demo" />
<img src="https://assets.geoman.io/assets/draw-example.png" alt="Demo" />
</p>

## Documentation
Expand All @@ -47,37 +46,37 @@ Please see the existing [Feature Requests here](https://github.com/geoman-io/lea
Clone the repository and then install all npm packages:

```
npm install
pnpm install
```

Compile and run `dev` watch version:

```
npm run start
pnpm run start
```

Compile and run `build` version:

```
npm run prepare
pnpm run prepare
```

Run cypress test:

```
npm run test
pnpm run test
```

Open cypress window:

```
npm run cypress
pnpm run cypress
```

Open eslint check:

```
npm run lint
pnpm run lint
```

Take a look into [CONTRIBUTING](./CONTRIBUTING.md)
Expand Down
9 changes: 7 additions & 2 deletions bundle.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const buildOptions = {
'.svg': 'dataurl' },
minify: true,
outfile: './dist/leaflet-geoman.js',
sourcemap: process.env.DEV ? true : false,
sourcemap: true,
}

const ctx = await esbuild.context({ ...buildOptions, plugins });
Expand All @@ -37,7 +37,7 @@ if (process.env.DEV) {
servedir: '.',
fallback: "./index.html"
});
console.log(`Serving app at ${host}:${port}.`);
console.log(`Serving app at http://${host}:${port}/demo`);
} else {
// Clean /dist folder
fs.rmSync("./dist", { recursive: true, force: true });
Expand All @@ -48,6 +48,11 @@ if (process.env.DEV) {
// Dispose context
ctx.dispose();

// Replace incorrect closing tag in <\/style>
const data = fs.readFileSync('./dist/leaflet-geoman.css', 'utf8');
const result = data.replace(/<\\\/style>/g, '</style>');
fs.writeFileSync('./dist/leaflet-geoman.css', result, 'utf8');

// Copy types
fs.copyFileSync('leaflet-geoman.d.ts', './dist/leaflet-geoman.d.ts');
fs.copyFileSync('./dist/leaflet-geoman.js', './dist/leaflet-geoman.min.js');
Expand Down
16 changes: 16 additions & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const { defineConfig } = require('cypress');

module.exports = defineConfig({
video: false,
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
return require('./cypress/plugins/index.js')(on, config);
},
experimentalRunAllSpecs: true,
},
retries: {
runMode: 2,
},
});
3 changes: 0 additions & 3 deletions cypress.json

This file was deleted.

75 changes: 66 additions & 9 deletions cypress/integration/circle.spec.js → cypress/e2e/circle.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ describe('Draw Circle', () => {
// draw with continueDrawing: true the second circle
cy.get(mapSelector).click(300, 200).click(350, 250);

cy.window().then(({ map }) => {
const latlng = map.pm.Draw.Circle._hintMarker.getLatLng();
const pxLatLng = map.containerPointToLatLng([350, 250]);
expect(pxLatLng).to.deep.equal(latlng);
});

// additional click because cypress lose the focus on the window ... wtf ...
cy.get(mapSelector).click();
cy.toolbarButton('edit').click();
Expand Down Expand Up @@ -225,6 +231,8 @@ describe('Draw Circle', () => {
// move marker
const marker = circle.pm._markers[1];
marker.setLatLng([marker.getLatLng().lng, marker.getLatLng().lat + 10]);
circle.pm._resizeCircle();

expect(167).to.eq(Math.floor(circle.getRadius()));
});
});
Expand Down Expand Up @@ -275,7 +283,7 @@ describe('Draw Circle', () => {
const layer = map.pm.getGeomanDrawLayers()[0];
layer.remove();
});
cy.hasLayers(3);
cy.hasLayers(2);
});
it('check if snapping works with max radius of circle', () => {
cy.toolbarButton('circle')
Expand Down Expand Up @@ -348,10 +356,10 @@ describe('Draw Circle', () => {
});
});

it('creates circles (non-resizableCircle)', () => {
it('creates circles (non-resizeableCircle)', () => {
cy.window().then(({ map }) => {
map.pm.setGlobalOptions({
resizableCircle: false,
resizeableCircle: false,
continueDrawing: true,
});
});
Expand All @@ -373,9 +381,9 @@ describe('Draw Circle', () => {
cy.hasCircleLayers(3);
});

it('disable dragging correctly (non-resizableCircle)', () => {
it('disable dragging correctly (non-resizeableCircle)', () => {
cy.window().then(({ map }) => {
map.pm.setGlobalOptions({ resizableCircle: false });
map.pm.setGlobalOptions({ resizeableCircle: false });
});

cy.toolbarButton('circle')
Expand All @@ -397,9 +405,9 @@ describe('Draw Circle', () => {
});
});

it('deletes no circles by right-click (non-resizableCircle)', () => {
it('deletes no circles by right-click (non-resizeableCircle)', () => {
cy.window().then(({ map }) => {
map.pm.setGlobalOptions({ resizableCircle: false });
map.pm.setGlobalOptions({ resizeableCircle: false });
});

cy.toolbarButton('circle')
Expand All @@ -421,9 +429,9 @@ describe('Draw Circle', () => {
cy.hasCircleLayers(1);
});

it('change color of circleMarker while drawing (non-resizableCircle)', () => {
it('change color of circleMarker while drawing (non-resizeableCircle)', () => {
cy.window().then(({ map }) => {
map.pm.setGlobalOptions({ resizableCircle: false });
map.pm.setGlobalOptions({ resizeableCircle: false });
});

cy.toolbarButton('circle')
Expand Down Expand Up @@ -469,4 +477,53 @@ describe('Draw Circle', () => {
cy.get(mapSelector).click(200, 200);
cy.get(mapSelector).click(300, 200);
});

it('checks if editing with snappable:false works', () => {
cy.toolbarButton('circle')
.click()
.closest('.button-container')
.should('have.class', 'active');

cy.get(mapSelector).click(200, 200);
cy.get(mapSelector).click(300, 200);

cy.window().then(({ map }) => {
map.pm.setGlobalOptions({ snappable: false });
});

cy.window().then(({ map }) => {
const layer = map.pm.getGeomanLayers()[0];
expect(layer.getLatLng().lat).to.eq(51.51034504891232);
expect(layer.getLatLng().lng).to.eq(-0.14144897460937503);
expect(layer.getRadius()).to.eq(1187.9783670191234);
});

cy.toolbarButton('edit').click();

// change radius
cy.get(mapSelector)
.trigger('mousedown', 300, 200, { which: 1 })
.trigger('mousemove', 300, 250, { which: 1 })
.trigger('mouseup', 300, 250, { which: 1 });

cy.window().then(({ map }) => {
const layer = map.pm.getGeomanLayers()[0];
expect(layer.getLatLng().lat).to.eq(51.51034504891232);
expect(layer.getLatLng().lng).to.eq(-0.14144897460937503);
expect(layer.getRadius()).to.eq(1328.278061564339);
});

// change center
cy.get(mapSelector)
.trigger('mousedown', 200, 200, { which: 1 })
.trigger('mousemove', 200, 250, { which: 1 })
.trigger('mouseup', 200, 250, { which: 1 });

cy.window().then(({ map }) => {
const layer = map.pm.getGeomanLayers()[0];
expect(layer.getLatLng().lat).to.eq(51.50500286265417);
expect(layer.getLatLng().lng).to.eq(-0.14144897460937503);
expect(layer.getRadius()).to.eq(1328.278061564339);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@ describe('Draw Circle Marker', () => {
// draw with continueDrawing: ture the second circle
cy.get(mapSelector).click(300, 200).click(350, 250);

cy.window().then(({ map }) => {
const latlng = map.pm.Draw.CircleMarker._hintMarker.getLatLng();
const pxLatLng = map.containerPointToLatLng([350, 250]);
expect(pxLatLng).to.deep.equal(latlng);
});

// additional click because cypress lose the focus on the window ... wtf ...
cy.get(mapSelector).click();

Expand Down Expand Up @@ -436,7 +442,7 @@ describe('Draw Circle Marker', () => {
const layer = map.pm.getGeomanDrawLayers()[0];
layer.remove();
});
cy.hasLayers(3);
cy.hasLayers(2);
});

it('check if snapping works with max radius of circle', () => {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading
Loading