Skip to content

Commit b1a4d25

Browse files
authored
Have click toggle actualSize of image (#423)
1 parent 05b39cd commit b1a4d25

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

tensorboard/plugins/image/tf_image_dashboard/tf-image-loader.html

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,33 @@
6969
</div>
7070
</template>
7171
</tf-card-heading>
72-
<div id="main-image-container"></div>
72+
73+
<button aria-label="Toggle actual size"
74+
id="main-image-container"
75+
on-tap="_handleTap"></button>
7376

7477
<style>
78+
/** Make button a div. */
79+
button {
80+
width: 100%;
81+
display: block;
82+
background: none;
83+
border: 0;
84+
padding: 0;
85+
}
86+
87+
/** Firefox: Get rid of dotted line inside button. */
88+
button::-moz-focus-inner {
89+
border: 0;
90+
padding: 0;
91+
}
92+
93+
/** Firefox: Simulate Chrome's outer glow on button when focused. */
94+
button:-moz-focusring {
95+
outline: none;
96+
box-shadow: 0px 0px 1px 2px Highlight;
97+
}
98+
7599
:host {
76100
display: block;
77101
width: 350px;
@@ -89,6 +113,7 @@
89113

90114
:host[actual-size] #main-image-container {
91115
max-height: none;
116+
width: auto;
92117
}
93118

94119
:host[actual-size] #main-image-container img {
@@ -127,9 +152,10 @@
127152
}
128153

129154
#main-image-container img {
155+
cursor: pointer;
156+
display: block;
130157
image-rendering: -moz-crisp-edges;
131158
image-rendering: pixelated;
132-
display: block;
133159
width: 100%;
134160
height: auto;
135161
}
@@ -343,6 +369,9 @@
343369
this.set("_isImageLoading", true);
344370
img.src = steps[stepIndex].url;
345371
},
372+
_handleTap(e) {
373+
this.set('actualSize', !this.actualSize);
374+
},
346375
});
347376
</script>
348377
</dom-module>

0 commit comments

Comments
 (0)