File tree Expand file tree Collapse file tree 1 file changed +38
-14
lines changed Expand file tree Collapse file tree 1 file changed +38
-14
lines changed Original file line number Diff line number Diff line change @@ -258,20 +258,44 @@ export class TensorBoardSession {
258
258
if ( this . webviewPanel ) {
259
259
this . webviewPanel . webview . html = `<!DOCTYPE html>
260
260
<html lang="en">
261
- <head>
262
- <meta charset="UTF-8">
263
- <meta http-equiv="Content-Security-Policy" content="default-src 'unsafe-inline'; frame-src ${ this . url } ;">
264
- <iframe
265
- width="100%"
266
- height="800"
267
- sandbox="allow-scripts allow-forms allow-same-origin allow-pointer-lock"
268
- src="${ this . url } "
269
- frameborder="0"
270
- allowfullscreen
271
- ></iframe>
272
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
273
- <title>TensorBoard</title>
274
- </head>
261
+ <head>
262
+ <meta charset="UTF-8">
263
+ <meta http-equiv="Content-Security-Policy" content="default-src 'unsafe-inline'; frame-src ${ this . url } ;">
264
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
265
+ <title>TensorBoard</title>
266
+ </head>
267
+ <body>
268
+ <script type="text/javascript">
269
+ function resizeFrame() {
270
+ var f = window.document.getElementById('vscode-tensorboard-iframe');
271
+ if (f) {
272
+ f.style.height = window.innerHeight / 0.7 + "px";
273
+ f.style.width = window.innerWidth / 0.7 + "px";
274
+ }
275
+ }
276
+ window.addEventListener('resize', resizeFrame);
277
+ </script>
278
+ <iframe
279
+ id="vscode-tensorboard-iframe"
280
+ class="responsive-iframe"
281
+ sandbox="allow-scripts allow-forms allow-same-origin allow-pointer-lock"
282
+ src="${ this . url } "
283
+ frameborder="0"
284
+ border="0"
285
+ allowfullscreen
286
+ ></iframe>
287
+ <style>
288
+ .responsive-iframe {
289
+ transform: scale(0.7);
290
+ transform-origin: 0 0;
291
+ position: absolute;
292
+ top: 0;
293
+ left: 0;
294
+ overflow: hidden;
295
+ display: block;
296
+ }
297
+ </style>
298
+ </body>
275
299
</html>` ;
276
300
}
277
301
}
You can’t perform that action at this time.
0 commit comments