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

Run formatter (ignore) #1419

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Changes from all commits
Commits
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
22 changes: 10 additions & 12 deletions cypress/integration/circle.spec.js
Original file line number Diff line number Diff line change
@@ -336,7 +336,7 @@ describe('Draw Circle', () => {
const layer = map.pm.getGeomanDrawLayers()[0];

let disableFired = false;
layer.on('pm:disable',()=>{
layer.on('pm:disable', () => {
disableFired = true;
});
layer.pm.disable();
@@ -348,10 +348,12 @@ describe('Draw Circle', () => {
});
});


it('creates circles (non-resizableCircle)', () => {
cy.window().then(({ map }) => {
map.pm.setGlobalOptions({ resizableCircle: false, continueDrawing: true });
map.pm.setGlobalOptions({
resizableCircle: false,
continueDrawing: true,
});
});

cy.toolbarButton('circle')
@@ -414,10 +416,7 @@ describe('Draw Circle', () => {

cy.hasCircleLayers(1);


cy.get(mapSelector)
.rightclick(200, 200);

cy.get(mapSelector).rightclick(200, 200);

cy.hasCircleLayers(1);
});
@@ -457,18 +456,17 @@ describe('Draw Circle', () => {
cy.window().then(({ map }) => {
let count = 0;
const layer = map.pm.getGeomanDrawLayers()[0];
layer.on('pm:vertexclick', ()=>{
layer.on('pm:vertexclick', () => {
count += 1;
if(count >= 2) {
if (count >= 2) {
expect(count).to.eql(2);
setTimeout(done, 100)
setTimeout(done, 100);
}
})
});
});

cy.toolbarButton('edit').click();
cy.get(mapSelector).click(200, 200);
cy.get(mapSelector).click(300, 200);

});
});
24 changes: 14 additions & 10 deletions cypress/integration/circlemarker.spec.js
Original file line number Diff line number Diff line change
@@ -116,7 +116,10 @@ describe('Draw Circle Marker', () => {

it('draw a CircleMarker like a Circle', () => {
cy.window().then(({ map }) => {
map.pm.setGlobalOptions({ resizeableCircleMarker: true, continueDrawing: false });
map.pm.setGlobalOptions({
resizeableCircleMarker: true,
continueDrawing: false,
});
});

cy.toolbarButton('circle-marker')
@@ -142,7 +145,10 @@ describe('Draw Circle Marker', () => {

it('enable continueDrawing #2', () => {
cy.window().then(({ map }) => {
map.pm.setGlobalOptions({ continueDrawing: true, resizeableCircleMarker: true });
map.pm.setGlobalOptions({
continueDrawing: true,
resizeableCircleMarker: true,
});
});

cy.toolbarButton('circle-marker')
@@ -523,7 +529,7 @@ describe('Draw Circle Marker', () => {
const layer = map.pm.getGeomanDrawLayers()[0];

let disableFired = false;
layer.on('pm:disable',()=>{
layer.on('pm:disable', () => {
disableFired = true;
});
layer.pm.disable();
@@ -543,8 +549,7 @@ describe('Draw Circle Marker', () => {

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

cy.toolbarButton('circle-marker')
.click();
cy.toolbarButton('circle-marker').click();

cy.window().then(({ map }) => {
const layer = map.pm.getGeomanDrawLayers()[0];
@@ -595,18 +600,17 @@ describe('Draw Circle Marker', () => {
cy.window().then(({ map }) => {
let count = 0;
const layer = map.pm.getGeomanDrawLayers()[0];
layer.on('pm:vertexclick', ()=>{
layer.on('pm:vertexclick', () => {
count += 1;
if(count >= 2) {
if (count >= 2) {
expect(count).to.eql(2);
setTimeout(done, 100)
setTimeout(done, 100);
}
})
});
});

cy.toolbarButton('edit').click();
cy.get(mapSelector).click(200, 200);
cy.get(mapSelector).click(300, 200);

});
});
54 changes: 33 additions & 21 deletions cypress/integration/rectangle.spec.js
Original file line number Diff line number Diff line change
@@ -900,17 +900,30 @@ describe('Draw Rectangle', () => {

cy.window().then(({ map }) => {
const corners = map.pm.Draw.Rectangle._findCorners();
expect(corners[0].equals([51.50820824957313, -0.13801574707031253])).to.eql(true);
expect(corners[1].equals([51.48897254548231, -0.10711669921875001])).to.eql(true);
expect(corners[2].equals([51.499660050014434, -0.08995056152343751])).to.eql(true);
expect(corners[3].equals([51.51889124411909, -0.12084960937500001])).to.eql(true);
expect(
corners[0].equals([51.50820824957313, -0.13801574707031253])
).to.eql(true);
expect(
corners[1].equals([51.48897254548231, -0.10711669921875001])
).to.eql(true);
expect(
corners[2].equals([51.499660050014434, -0.08995056152343751])
).to.eql(true);
expect(
corners[3].equals([51.51889124411909, -0.12084960937500001])
).to.eql(true);
});
});

it('edit correctly after a rotated rectangle is imported', ()=>{
it('edit correctly after a rotated rectangle is imported', () => {
cy.window().then(({ map, L }) => {
const coords = JSON.parse('{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[-0.122532,51.507986],[-0.117474,51.518864],[-0.06784,51.509926],[-0.072898,51.499046],[-0.122532,51.507986]]]}}');
const rectangle = L.rectangle([[0,0],[0,0]]);
const coords = JSON.parse(
'{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[-0.122532,51.507986],[-0.117474,51.518864],[-0.06784,51.509926],[-0.072898,51.499046],[-0.122532,51.507986]]]}}'
);
const rectangle = L.rectangle([
[0, 0],
[0, 0],
]);
rectangle.setLatLngs(L.geoJSON(coords).getLayers()[0].getLatLngs());
rectangle.addTo(map);
});
@@ -927,21 +940,21 @@ describe('Draw Rectangle', () => {

const expected = [
{
"x": 200,
"y": 120
x: 200,
y: 120,
},
{
"x": 617,
"y": 243
x: 617,
y: 243,
},
{
"x": 629,
"y": 204
x: 629,
y: 204,
},
{
"x": 211,
"y": 81
}
x: 211,
y: 81,
},
];

const px = layer.getLatLngs()[0].map((latlng) => {
@@ -965,18 +978,17 @@ describe('Draw Rectangle', () => {
cy.window().then(({ map }) => {
let count = 0;
const layer = map.pm.getGeomanDrawLayers()[0];
layer.on('pm:vertexclick', ()=>{
layer.on('pm:vertexclick', () => {
count += 1;
if(count >= 2) {
if (count >= 2) {
expect(count).to.eql(2);
setTimeout(done, 100)
setTimeout(done, 100);
}
})
});
});

cy.toolbarButton('edit').click();
cy.get(mapSelector).click(200, 200);
cy.get(mapSelector).click(300, 300);

});
});
30 changes: 17 additions & 13 deletions cypress/integration/rotation.spec.js
Original file line number Diff line number Diff line change
@@ -349,7 +349,6 @@ describe('Rotation', () => {
layer.pm.setRotationCenter(origin);
});


cy.window().then(({ map }) => {
const layer = map.pm.getGeomanDrawLayers()[0];
const marker1 = layer.pm._rotatePoly.pm._markers[0][0];
@@ -437,10 +436,15 @@ describe('Rotation', () => {
});
});

it('set the angle correctly after rotating a new imported rotated rectangle', ()=>{
it('set the angle correctly after rotating a new imported rotated rectangle', () => {
cy.window().then(({ map, L }) => {
const coords = JSON.parse('{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[-0.122532,51.507986],[-0.117474,51.518864],[-0.06784,51.509926],[-0.072898,51.499046],[-0.122532,51.507986]]]}}');
const rectangle = L.rectangle([[0,0],[0,0]]);
const coords = JSON.parse(
'{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[-0.122532,51.507986],[-0.117474,51.518864],[-0.06784,51.509926],[-0.072898,51.499046],[-0.122532,51.507986]]]}}'
);
const rectangle = L.rectangle([
[0, 0],
[0, 0],
]);
rectangle.setLatLngs(L.geoJSON(coords).getLayers()[0].getLatLngs());
rectangle.addTo(map);
});
@@ -462,20 +466,20 @@ describe('Rotation', () => {

const expected = [
{
'x': 319,
'y': 267,
x: 319,
y: 267,
},
{
'x': 319,
'y': 161,
x: 319,
y: 161,
},
{
'x': 620,
'y': 159,
x: 620,
y: 159,
},
{
'x': 620,
'y': 265,
x: 620,
y: 265,
},
];

@@ -486,5 +490,5 @@ describe('Rotation', () => {

expect(px).to.eql(expected);
});
})
});
});
43 changes: 17 additions & 26 deletions demo/demo-canvas.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,21 @@
/* eslint-disable no-console */
const tiles1 = L.tileLayer(
'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
{
maxZoom: 19,
attribution:
'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
}
);

const tiles2 = L.tileLayer(
'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
{
maxZoom: 19,
attribution:
'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
}
);

const tiles3 = L.tileLayer(
'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
{
maxZoom: 19,
attribution:
'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
}
);
const tiles1 = L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution:
'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
});

const tiles2 = L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution:
'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
});

const tiles3 = L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution:
'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
});

const map2 = L.map('example2', { preferCanvas: true })
.setView([51.505, -0.09], 13)
39 changes: 15 additions & 24 deletions demo/demo.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,21 @@
/* eslint-disable no-console */
const tiles1 = L.tileLayer(
'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
{
maxZoom: 19,
attribution:
'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
}
);
const tiles1 = L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution:
'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
});

const tiles2 = L.tileLayer(
'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
{
maxZoom: 19,
attribution:
'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
}
);
const tiles2 = L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution:
'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
});

const tiles3 = L.tileLayer(
'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
{
maxZoom: 19,
attribution:
'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
}
);
const tiles3 = L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution:
'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
});

const map2 = L.map('example2').setView([51.505, -0.09], 13).addLayer(tiles1);
const map3 = L.map('example3').setView([51.505, -0.09], 13).addLayer(tiles2);
Loading