OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 * @param {!WebInspector.AnimationModel.AnimationGroup} model | 7 * @param {!WebInspector.AnimationModel.AnimationGroup} model |
8 */ | 8 */ |
9 WebInspector.AnimationGroupPreviewUI = function(model) | 9 WebInspector.AnimationGroupPreviewUI = function(model) |
10 { | 10 { |
11 this._model = model; | 11 this._model = model; |
12 this.element = createElementWithClass("div", "animation-buffer-preview"); | 12 this.element = createElementWithClass("div", "animation-buffer-preview"); |
13 this.element.createChild("div", "animation-paused fill"); | 13 this.element.createChild("div", "animation-paused fill"); |
14 this._removeButton = this.element.createChild("div", "animation-remove-butto
n"); | 14 this._removeButton = this.element.createChild("div", "animation-remove-butto
n"); |
15 this._removeButton.textContent = "\u2715"; | 15 this._removeButton.textContent = "\u2715"; |
16 this._replayOverlayElement = this.element.createChild("div", "animation-buff
er-preview-animation"); | 16 this._replayOverlayElement = this.element.createChild("div", "animation-buff
er-preview-animation"); |
17 this._svg = this.element.createSVGChild("svg"); | 17 this._svg = this.element.createSVGChild("svg"); |
18 this._svg.setAttribute("width", "100%"); | 18 this._svg.setAttribute("width", "100%"); |
19 this._svg.setAttribute("preserveAspectRatio", "none"); | 19 this._svg.setAttribute("preserveAspectRatio", "none"); |
20 this._svg.setAttribute("height", "100%"); | 20 this._svg.setAttribute("height", "100%"); |
21 this._viewBoxHeight = 32; | 21 this._viewBoxHeight = 32; |
22 this._svg.setAttribute("viewBox", "0 0 100 " + this._viewBoxHeight); | 22 this._svg.setAttribute("viewBox", "0 0 100 " + this._viewBoxHeight); |
23 this._svg.setAttribute("shape-rendering", "crispEdges"); | 23 this._svg.setAttribute("shape-rendering", "crispEdges"); |
24 this._render(); | 24 this._render(); |
25 } | 25 }; |
26 | 26 |
27 WebInspector.AnimationGroupPreviewUI.prototype = { | 27 WebInspector.AnimationGroupPreviewUI.prototype = { |
28 /** | 28 /** |
29 * @return {number} | 29 * @return {number} |
30 */ | 30 */ |
31 _groupDuration: function() | 31 _groupDuration: function() |
32 { | 32 { |
33 var duration = 0; | 33 var duration = 0; |
34 for (var anim of this._model.animations()) { | 34 for (var anim of this._model.animations()) { |
35 var animDuration = anim.source().delay() + anim.source().duration(); | 35 var animDuration = anim.source().delay() + anim.source().duration(); |
(...skipping 30 matching lines...) Expand all Loading... |
66 var effect = this._model.animations()[i].source(); | 66 var effect = this._model.animations()[i].source(); |
67 var line = this._svg.createSVGChild("line"); | 67 var line = this._svg.createSVGChild("line"); |
68 line.setAttribute("x1", effect.delay() * timeToPixelRatio); | 68 line.setAttribute("x1", effect.delay() * timeToPixelRatio); |
69 line.setAttribute("x2", (effect.delay() + effect.duration()) * timeT
oPixelRatio); | 69 line.setAttribute("x2", (effect.delay() + effect.duration()) * timeT
oPixelRatio); |
70 var y = Math.floor(this._viewBoxHeight / Math.max(6, numberOfAnimati
ons) * i + 1); | 70 var y = Math.floor(this._viewBoxHeight / Math.max(6, numberOfAnimati
ons) * i + 1); |
71 line.setAttribute("y1", y); | 71 line.setAttribute("y1", y); |
72 line.setAttribute("y2", y); | 72 line.setAttribute("y2", y); |
73 line.style.stroke = WebInspector.AnimationUI.Color(this._model.anima
tions()[i]); | 73 line.style.stroke = WebInspector.AnimationUI.Color(this._model.anima
tions()[i]); |
74 } | 74 } |
75 } | 75 } |
76 } | 76 }; |
OLD | NEW |