OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 * @extends {WebInspector.VBox} | 7 * @extends {WebInspector.VBox} |
8 */ | 8 */ |
9 WebInspector.DeviceModeView = function() | 9 WebInspector.DeviceModeView = function() |
10 { | 10 { |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 // Trigger download. | 480 // Trigger download. |
481 var link = createElement("a"); | 481 var link = createElement("a"); |
482 link.download = fileName + ".png"; | 482 link.download = fileName + ".png"; |
483 link.href = canvas.toDataURL("image/png"); | 483 link.href = canvas.toDataURL("image/png"); |
484 link.click(); | 484 link.click(); |
485 } | 485 } |
486 } | 486 } |
487 }, | 487 }, |
488 | 488 |
489 __proto__: WebInspector.VBox.prototype | 489 __proto__: WebInspector.VBox.prototype |
490 } | 490 }; |
491 | 491 |
492 /** | 492 /** |
493 * @constructor | 493 * @constructor |
494 * @extends {WebInspector.VBox} | 494 * @extends {WebInspector.VBox} |
495 * @param {boolean} horizontal | 495 * @param {boolean} horizontal |
496 * @param {function(number)} applyCallback | 496 * @param {function(number)} applyCallback |
497 */ | 497 */ |
498 WebInspector.DeviceModeView.Ruler = function(horizontal, applyCallback) | 498 WebInspector.DeviceModeView.Ruler = function(horizontal, applyCallback) |
499 { | 499 { |
500 WebInspector.VBox.call(this); | 500 WebInspector.VBox.call(this); |
501 this.element.classList.add("device-mode-ruler"); | 501 this.element.classList.add("device-mode-ruler"); |
502 this._contentElement = this.element.createChild("div", "device-mode-ruler-co
ntent").createChild("div", "device-mode-ruler-inner"); | 502 this._contentElement = this.element.createChild("div", "device-mode-ruler-co
ntent").createChild("div", "device-mode-ruler-inner"); |
503 this._horizontal = horizontal; | 503 this._horizontal = horizontal; |
504 this._scale = 1; | 504 this._scale = 1; |
505 this._count = 0; | 505 this._count = 0; |
506 this._throttler = new WebInspector.Throttler(0); | 506 this._throttler = new WebInspector.Throttler(0); |
507 this._applyCallback = applyCallback; | 507 this._applyCallback = applyCallback; |
508 } | 508 }; |
509 | 509 |
510 WebInspector.DeviceModeView.Ruler.prototype = { | 510 WebInspector.DeviceModeView.Ruler.prototype = { |
511 /** | 511 /** |
512 * @param {number} scale | 512 * @param {number} scale |
513 */ | 513 */ |
514 render: function(scale) | 514 render: function(scale) |
515 { | 515 { |
516 this._scale = scale; | 516 this._scale = scale; |
517 this._throttler.schedule(this._update.bind(this)); | 517 this._throttler.schedule(this._update.bind(this)); |
518 }, | 518 }, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 | 586 |
587 /** | 587 /** |
588 * @param {number} size | 588 * @param {number} size |
589 */ | 589 */ |
590 _onMarkerClick: function(size) | 590 _onMarkerClick: function(size) |
591 { | 591 { |
592 this._applyCallback.call(null, size); | 592 this._applyCallback.call(null, size); |
593 }, | 593 }, |
594 | 594 |
595 __proto__: WebInspector.VBox.prototype | 595 __proto__: WebInspector.VBox.prototype |
596 } | 596 }; |
OLD | NEW |