-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add overlay stroke to dashboard and fix map sidewindow interact…
…ions
- Loading branch information
1 parent
7ae9679
commit 5b56090
Showing
9 changed files
with
46 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,7 @@ | ||
import { THEME } from '@mtes-mct/monitor-ui' | ||
import { isEmpty } from 'lodash' | ||
import { getCenter } from 'ol/extent' | ||
import { LineString } from 'ol/geom' | ||
import { Icon, Stroke, Style } from 'ol/style' | ||
import { overlayStroke } from '@features/map/overlays/style' | ||
import { Icon, Style } from 'ol/style' | ||
|
||
export const layerListIconStyle = (feature, resolution) => [ | ||
new Style({ | ||
geometry: () => { | ||
const overlayPostion = feature.get('overlayCoordinates') | ||
|
||
if (isEmpty(overlayPostion)) { | ||
return undefined | ||
} | ||
|
||
const extent = feature?.getGeometry()?.getExtent() | ||
const center = extent && getCenter(extent) | ||
if (!center) { | ||
return undefined | ||
} | ||
|
||
return new LineString([overlayPostion.coordinates, center]) | ||
}, | ||
stroke: new Stroke({ | ||
color: THEME.color.slateGray, | ||
lineDash: [4, 4], | ||
width: 2 | ||
}) | ||
}), | ||
export const layerListIconStyle = resolution => [ | ||
overlayStroke, | ||
new Style({ image: new Icon({ scale: 1 / resolution ** (1 / 8) + 0.4, src: 'Cursor_border.svg' }) }) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { THEME } from '@mtes-mct/monitor-ui' | ||
import { isEmpty } from 'lodash' | ||
import { getCenter } from 'ol/extent' | ||
import { LineString } from 'ol/geom' | ||
import { Style, Stroke } from 'ol/style' | ||
|
||
export const overlayStroke = new Style({ | ||
geometry: feature => { | ||
const overlayPosition = feature.get('overlayCoordinates') | ||
if (isEmpty(overlayPosition)) { | ||
return undefined | ||
} | ||
|
||
const extent = feature?.getGeometry()?.getExtent() | ||
const center = extent && getCenter(extent) | ||
if (!center) { | ||
return undefined | ||
} | ||
|
||
return new LineString([overlayPosition.coordinates, center]) | ||
}, | ||
stroke: new Stroke({ | ||
color: THEME.color.slateGray, | ||
lineDash: [4, 4], | ||
width: 2 | ||
}) | ||
}) |