| Index: appengine/sheriff_o_matic/ui/ct-results-comparison-zoomer.html
|
| diff --git a/appengine/sheriff_o_matic/ui/ct-results-comparison-zoomer.html b/appengine/sheriff_o_matic/ui/ct-results-comparison-zoomer.html
|
| index 762cbeb4bc0be27ae7f23a5c0ee189197e6513aa..461d649c0f0d01d0802ef53128016b73d7a71d61 100644
|
| --- a/appengine/sheriff_o_matic/ui/ct-results-comparison-zoomer.html
|
| +++ b/appengine/sheriff_o_matic/ui/ct-results-comparison-zoomer.html
|
| @@ -2,11 +2,8 @@
|
| Copyright 2014 The Chromium Authors. All rights reserved.
|
| Use of this source code is governed by a BSD-style license that can be
|
| found in the LICENSE file.
|
| --->
|
| -
|
| -<polymer-element name="ct-results-comparison-zoomer" attributes="expectedUrl actualUrl diffUrl position">
|
| - <template>
|
| - <style>
|
| +--><html><head><dom-module id="ct-results-comparison-zoomer">
|
| + <style>
|
| :host {
|
| background-color: silver;
|
| border: 1px solid gray;
|
| @@ -38,6 +35,7 @@ found in the LICENSE file.
|
| display: none;
|
| }
|
| </style>
|
| + <template>
|
|
|
| <div>
|
| <div class="label">Expected</div>
|
| @@ -64,54 +62,69 @@ found in the LICENSE file.
|
| </div>
|
| </template>
|
| <script>
|
| - (function() {
|
| - var kResultWidth = 800;
|
| - var kResultHeight = 600;
|
| - var kZoomFactor = 6;
|
| - var kZoomedResultWidth = kResultWidth * kZoomFactor;
|
| - var kZoomedResultHeight = kResultHeight * kZoomFactor;
|
| -
|
| - Polymer({
|
| - expectedUrl: '',
|
| - actualUrl: '',
|
| - diffUrl: '',
|
| - position: null,
|
| - _drawScheduled: false,
|
| -
|
| - positionChanged: function() {
|
| - if (!this._drawScheduled) {
|
| - this._drawScheduled = true;
|
| - this.async(this._drawAll);
|
| + (function () {
|
| + var kResultWidth = 800;
|
| + var kResultHeight = 600;
|
| + var kZoomFactor = 6;
|
| + var kZoomedResultWidth = kResultWidth * kZoomFactor;
|
| + var kZoomedResultHeight = kResultHeight * kZoomFactor;
|
| + Polymer({
|
| + is: 'ct-results-comparison-zoomer',
|
| + properties: {
|
| + _drawScheduled: {
|
| + type: Boolean,
|
| + value: false
|
| + },
|
| + actualUrl: {
|
| + type: String,
|
| + value: '',
|
| + notify: true
|
| + },
|
| + diffUrl: {
|
| + type: String,
|
| + value: '',
|
| + notify: true
|
| + },
|
| + expectedUrl: {
|
| + type: String,
|
| + value: '',
|
| + notify: true
|
| + },
|
| + position: {
|
| + value: null,
|
| + notify: true,
|
| + observer: 'positionChanged'
|
| + }
|
| + },
|
| + positionChanged: function () {
|
| + if (!this._drawScheduled) {
|
| + this._drawScheduled = true;
|
| + this.async(this._drawAll);
|
| + }
|
| + },
|
| + _drawAll: function () {
|
| + this._drawScheduled = false;
|
| + if (!this.position)
|
| + return;
|
| + this._draw(this.$.expectedZoomer);
|
| + this._draw(this.$.actualZoomer);
|
| + this._draw(this.$.diffZoomer);
|
| + },
|
| + _draw: function (imageContainer) {
|
| + var canvas = imageContainer.querySelector('canvas');
|
| + canvas.width = imageContainer.clientWidth;
|
| + canvas.height = imageContainer.clientHeight;
|
| + this._drawCanvas(canvas.getContext('2d'), imageContainer);
|
| + },
|
| + _drawCanvas: function (context, imageContainer) {
|
| + context.imageSmoothingEnabled = false;
|
| + context.translate(imageContainer.clientWidth / 2, imageContainer.clientHeight / 2);
|
| + context.translate(-this.position.x * kZoomedResultWidth, -this.position.y * kZoomedResultHeight);
|
| + context.strokeRect(-1.5, -1.5, kZoomedResultWidth + 2, kZoomedResultHeight + 2);
|
| + context.scale(kZoomFactor, kZoomFactor);
|
| + context.drawImage(imageContainer.querySelector('img'), 0, 0);
|
| }
|
| - },
|
| -
|
| - _drawAll: function() {
|
| - this._drawScheduled = false;
|
| -
|
| - if (!this.position)
|
| - return;
|
| -
|
| - this._draw(this.$.expectedZoomer);
|
| - this._draw(this.$.actualZoomer);
|
| - this._draw(this.$.diffZoomer);
|
| - },
|
| -
|
| - _draw: function(imageContainer) {
|
| - var canvas = imageContainer.querySelector('canvas');
|
| - canvas.width = imageContainer.clientWidth;
|
| - canvas.height = imageContainer.clientHeight;
|
| - this._drawCanvas(canvas.getContext('2d'), imageContainer);
|
| - },
|
| -
|
| - _drawCanvas: function(context, imageContainer) {
|
| - context.imageSmoothingEnabled = false;
|
| - context.translate(imageContainer.clientWidth / 2, imageContainer.clientHeight / 2);
|
| - context.translate(-this.position.x * kZoomedResultWidth, -this.position.y * kZoomedResultHeight);
|
| - context.strokeRect(-1.5, -1.5, kZoomedResultWidth + 2, kZoomedResultHeight + 2);
|
| - context.scale(kZoomFactor, kZoomFactor);
|
| - context.drawImage(imageContainer.querySelector('img'), 0, 0);
|
| - },
|
| - });
|
| - })();
|
| + });
|
| + }());
|
| </script>
|
| -</polymer-element>
|
| +</dom-module>
|
|
|