ha-frontend/panels/map/ha-entity-marker.html

81 lines
1.7 KiB
HTML
Raw Normal View History

2016-07-19 11:25:26 +02:00
<link rel='import' href='../../bower_components/polymer/polymer.html'>
<link rel='import' href='../../bower_components/iron-image/iron-image.html'>
<link rel='import' href='../../bower_components/iron-icon/iron-icon.html'>
2015-09-21 08:12:58 +02:00
<dom-module id='ha-entity-marker'>
<template>
2016-07-18 08:18:48 +02:00
<style is="custom-style" include="iron-positioning"></style>
<style>
.marker {
vertical-align: top;
position: relative;
display: block;
margin: 0 auto;
width: 2.5em;
text-align: center;
height: 2.5em;
line-height: 2.5em;
font-size: 1.5em;
border-radius: 50%;
border: 0.1em solid var(--ha-marker-color, --default-primary-color);
color: rgb(76, 76, 76);
background-color: white;
}
iron-image {
border-radius: 50%;
}
</style>
2015-09-21 08:12:58 +02:00
<div class='marker'>
<template is='dom-if' if='[[entityName]]'>[[entityName]]</template>
<template is='dom-if' if='[[entityPicture]]'>
<iron-image sizing='cover' class='fit' src='[[entityPicture]]'></iron-image>
2015-09-21 08:12:58 +02:00
</template>
</div>
</template>
</dom-module>
2016-07-12 08:57:17 +02:00
<script>
Polymer({
is: 'ha-entity-marker',
hostAttributes: {
entityId: null,
entityName: null,
entityPicture: null,
},
2016-07-12 08:57:17 +02:00
properties: {
hass: {
type: Object,
},
entityId: {
type: String,
value: '',
},
entityName: {
type: String,
value: null,
2016-07-12 08:57:17 +02:00
},
entityPicture: {
2016-07-12 08:57:17 +02:00
type: String,
value: null,
}
2016-07-12 08:57:17 +02:00
},
listeners: {
tap: 'badgeTap',
},
badgeTap: function (ev) {
ev.stopPropagation();
if (this.entityId) {
this.fire('hass-more-info', { entityId: this.entityId });
2016-07-12 08:57:17 +02:00
}
},
});
</script>