-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuf-image.html
57 lines (54 loc) · 1.38 KB
/
uf-image.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<link rel="import" href="../../bower_components/polymer/polymer.html">
<polymer-element name="uf-image" attributes="width height">
<template>
<style>
:host {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
display: inline-block;
position: relative;
}
rect {
stroke: #ccc;
stroke-width: 1px;
fill: transparent;
}
line {
stroke: #ccc;
stroke-width: 1px;
}
:host > div {
color: #999;
height: 100%;
position: absolute;
text-align: center;
top: 0;
vertical-align: middle;
width: 100%;
}
</style>
<svg width="{{width}}" height="{{height}}">
<rect width="100%" height="100%" />
<line x1="0" x2="100%" y1="0" y2="100%" />
<line x1="100%" x2="0" y1="0" y2="100%" />
</svg>
<template if="{{height >= 60 && width >= 60}}">
<div style="line-height: {{height}}px;">
{{width}} x {{height}}
</div>
</template>
</template>
<script>
Polymer('uf-image', {
height: null,
width: null,
heightChanged: function (oldVal, newVal) {
this.style.height = this.height+'px';
},
widthChanged: function (oldVal, newVal) {
this.style.width = this.width+'px';
}
});
</script>
</polymer-element>