| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 } | 224 } |
| 225 | 225 |
| 226 _resizeCanvas() { | 226 _resizeCanvas() { |
| 227 this._canvasElement.width = this._canvasElement.offsetWidth * window.deviceP
ixelRatio; | 227 this._canvasElement.width = this._canvasElement.offsetWidth * window.deviceP
ixelRatio; |
| 228 this._canvasElement.height = this._canvasElement.offsetHeight * window.devic
ePixelRatio; | 228 this._canvasElement.height = this._canvasElement.offsetHeight * window.devic
ePixelRatio; |
| 229 } | 229 } |
| 230 | 230 |
| 231 _updateTransformAndConstraints() { | 231 _updateTransformAndConstraints() { |
| 232 var paddingFraction = 0.1; | 232 var paddingFraction = 0.1; |
| 233 var viewport = this._layerTree.viewportSize(); | 233 var viewport = this._layerTree.viewportSize(); |
| 234 var root = this._layerTree.root(); | |
| 235 var baseWidth = viewport ? viewport.width : this._dimensionsForAutoscale.wid
th; | 234 var baseWidth = viewport ? viewport.width : this._dimensionsForAutoscale.wid
th; |
| 236 var baseHeight = viewport ? viewport.height : this._dimensionsForAutoscale.h
eight; | 235 var baseHeight = viewport ? viewport.height : this._dimensionsForAutoscale.h
eight; |
| 237 var canvasWidth = this._canvasElement.width; | 236 var canvasWidth = this._canvasElement.width; |
| 238 var canvasHeight = this._canvasElement.height; | 237 var canvasHeight = this._canvasElement.height; |
| 239 var paddingX = canvasWidth * paddingFraction; | 238 var paddingX = canvasWidth * paddingFraction; |
| 240 var paddingY = canvasHeight * paddingFraction; | 239 var paddingY = canvasHeight * paddingFraction; |
| 241 var scaleX = (canvasWidth - 2 * paddingX) / baseWidth; | 240 var scaleX = (canvasWidth - 2 * paddingX) / baseWidth; |
| 242 var scaleY = (canvasHeight - 2 * paddingY) / baseHeight; | 241 var scaleY = (canvasHeight - 2 * paddingY) / baseHeight; |
| 243 var viewScale = Math.min(scaleX, scaleY); | 242 var viewScale = Math.min(scaleX, scaleY); |
| 244 var minScaleConstraint = | 243 var minScaleConstraint = |
| (...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1178 * @return {!Promise} | 1177 * @return {!Promise} |
| 1179 */ | 1178 */ |
| 1180 update(glContext, scale) { | 1179 update(glContext, scale) { |
| 1181 this._gl = glContext; | 1180 this._gl = glContext; |
| 1182 this.scale = scale; | 1181 this.scale = scale; |
| 1183 return this.snapshot.replay(null, null, scale).then(imageURL => imageURL &&
UI.loadImage(imageURL)).then(image => { | 1182 return this.snapshot.replay(null, null, scale).then(imageURL => imageURL &&
UI.loadImage(imageURL)).then(image => { |
| 1184 this.texture = image && LayerViewer.LayerTextureManager._createTextureForI
mage(glContext, image); | 1183 this.texture = image && LayerViewer.LayerTextureManager._createTextureForI
mage(glContext, image); |
| 1185 }); | 1184 }); |
| 1186 } | 1185 } |
| 1187 }; | 1186 }; |
| OLD | NEW |