Skip to content

Commit

Permalink
Fix intersection "red" when layer is already red by default. Fixes #751
Browse files Browse the repository at this point in the history
… (patch)
  • Loading branch information
Falke-Design committed Feb 6, 2021
1 parent e404e51 commit d100974
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cypress/integration/rectangle.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ describe('Draw Rectangle', () => {

cy.window().then(({ map, L }) => {
const rect = map.pm.getGeomanDrawLayers()[0];
expect(rect.options.color).to.not.equal('red');
expect(rect.options.color).to.not.equal('#f00000ff');

})
});
Expand Down
2 changes: 1 addition & 1 deletion src/js/Draw/L.PM.Draw.Line.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ Draw.Line = Draw.extend({
// change the style based on self intersection
if (this._doesSelfIntersect) {
this._hintline.setStyle({
color: 'red',
color: '#f00000ff',
});
} else if (!this._hintline.isEmpty()) {
this._hintline.setStyle(this.options.hintlineStyle);
Expand Down
6 changes: 3 additions & 3 deletions src/js/Edit/L.PM.Edit.Line.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Edit.Line = Edit.extend({
}

if (!this.options.allowSelfIntersection) {
if(this._layer.options.color !== 'red') {
if(this._layer.options.color !== '#f00000ff') {
this.cachedColor = this._layer.options.color;
this.isRed = false;
}else{
Expand Down Expand Up @@ -356,7 +356,7 @@ Edit.Line = Edit.extend({
if (flash) {
this._flashLayer();
} else {
layer.setStyle({ color: 'red' });
layer.setStyle({ color: '#f00000ff' });
this.isRed = true;
}

Expand All @@ -380,7 +380,7 @@ Edit.Line = Edit.extend({
this.cachedColor = this._layer.options.color;
}

this._layer.setStyle({ color: 'red' });
this._layer.setStyle({ color: '#f00000ff' });
this.isRed = true;

window.setTimeout(() => {
Expand Down

0 comments on commit d100974

Please sign in to comment.