Skip to content

Commit

Permalink
WIP: ajout icone png
Browse files Browse the repository at this point in the history
  • Loading branch information
LE DIOURON Kevin committed Jun 22, 2021
1 parent 3ce5a1e commit 4c88bc1
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
10 changes: 8 additions & 2 deletions src/iotMapManager/src/iot-map-icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -484,11 +484,17 @@ function getMarkerDivIcon (marker: IotMarker, config: IotMapConfig, selected: bo

if (marker.inner.icon) { // icon
innerDesign = `<span class='iotmap-innerspan ${marker.inner.icon} ${((selected) ? ' iotmap-iconSelected' : ' iotmap-iconUnselected')}'
style='color: ${innerColor}'></span>`
} else if (marker.inner.label) { // label
style='color: ${innerColor}'></span>`

} else if (marker.inner.img) {
innerDesign = `<img src='${marker.inner.img}'>`
}

else if (marker.inner.label) { // label
innerDesign = `<span class='iotmap-innerspan ${((selected) ? ' iotmap-labelSelected' : ' iotmap-labelUnselected')}'
style='color: ${innerColor}'>${marker.inner.label[0]}</span>`
}

}

// state / gauge
Expand Down
4 changes: 3 additions & 1 deletion src/iotMapManager/src/iot-map-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ interface Shape {
* Inner
*
* @param icon - (optional) define the icon displayed inside the shape.
* @param img - (optional) define the src of an img displayed inside the shape.
* @param label - (optional) define the character displayed inside the shape.
* @param color - (optional) define the color of the inner element.
*
Expand All @@ -111,7 +112,8 @@ interface Shape {
interface Inner {
color?: string

icon?: string
icon?: string;
img?: string;
// *** OR ***
label?: string
}
Expand Down
20 changes: 19 additions & 1 deletion src/map/map.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,25 @@ export class MapComponent implements AfterViewInit {
},
template: 'square'
},

{
id: 's7',
location: {
lat: 40.895,
lng: 6.890
},
shape: {
type: ShapeType.square,
anchored: true,
plain: false,
// accuracy: 200
},
inner: {
img: 'https://img.icons8.com/ios/452/apple-phone.png',
color: 'green'
},
layer: 'etablissements',
status: 'inactive'
},
// POI
{
id: 'p1',
Expand Down

0 comments on commit 4c88bc1

Please sign in to comment.