| <html> |
| <head> |
| <title>zoom-sk demo</title> |
| <meta charset="utf-8"> |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
| <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes"> |
| <script src="/res/common/js/common.js"></script> |
| <script src="/res/imp/bower_components/webcomponentsjs/webcomponents-lite.js"></script> |
| <link rel="import" href="/res/imp/bower_components/iron-flex-layout/iron-flex-layout.html"> |
| <link rel=import href="canvas-layers.html"> |
| <link rel=import href="crosshair.html"> |
| <link rel=import href="zoom.html"> |
| <style type="text/css" media="screen"> |
| #wrapper { |
| width: 40em; |
| margin: auto; |
| } |
| </style> |
| </head> |
| <body> |
| <h1>Zoom</h1> |
| |
| <div id=wrapper class="layout horizontal wrap"> |
| <h2>Original Content</h2> |
| <canvas-layers-sk layers='["crosshair"]' id=layers> |
| <img id=source_img src="raster.png"/> |
| </canvas-layers-sk> |
| <crosshair-sk target=layers name=crosshair update_on=click></crosshair-sk> |
| <h2>Event</h2> |
| <pre id=event> |
| </pre> |
| |
| <h2>Zoomed View</h2> |
| <zoom-sk source=source_img pixels=20 id=zoom></zoom-sk> |
| |
| </div> |
| |
| <script type="text/javascript" charset="utf-8"> |
| // Hook up the messages from the crosshair to the zoom-sk element. |
| $$$('crosshair-sk').addEventListener('crosshair', function(e) { |
| $$$('#zoom').x = e.detail.x; |
| $$$('#zoom').y = e.detail.y; |
| }); |
| |
| $$$('#zoom').addEventListener('zoom-point', function(e) { |
| $$$('#event').textContent = JSON.stringify(e.detail, null, 2); |
| }); |
| </script> |
| </body> |
| </html> |