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 * @extends {WebInspector.VBox} | 7 * @extends {WebInspector.VBox} |
8 */ | 8 */ |
9 WebInspector.AnimationTimeline = function() | 9 WebInspector.AnimationTimeline = function() |
10 { | 10 { |
(...skipping 28 matching lines...) Expand all Loading... |
39 { | 39 { |
40 /** | 40 /** |
41 * @param {!Event} event | 41 * @param {!Event} event |
42 * @this {WebInspector.AnimationTimeline} | 42 * @this {WebInspector.AnimationTimeline} |
43 */ | 43 */ |
44 function playbackSliderInputHandler(event) | 44 function playbackSliderInputHandler(event) |
45 { | 45 { |
46 this._animationsPlaybackRate = WebInspector.AnimationsSidebarPane.Gl
obalPlaybackRates[event.target.value]; | 46 this._animationsPlaybackRate = WebInspector.AnimationsSidebarPane.Gl
obalPlaybackRates[event.target.value]; |
47 var target = WebInspector.targetManager.mainTarget(); | 47 var target = WebInspector.targetManager.mainTarget(); |
48 if (target) | 48 if (target) |
49 target.animationAgent().setPlaybackRate(this._animationsPlayback
Rate); | 49 target.animationModel.setPlaybackRate(this._animationsPlaybackRa
te); |
50 this._playbackLabel.textContent = this._animationsPlaybackRate + "x"
; | 50 this._playbackLabel.textContent = this._animationsPlaybackRate + "x"
; |
51 WebInspector.userMetrics.AnimationsPlaybackRateChanged.record(); | 51 WebInspector.userMetrics.AnimationsPlaybackRateChanged.record(); |
52 if (this._scrubberPlayer) | 52 if (this._scrubberPlayer) |
53 this._scrubberPlayer.playbackRate = this._animationsPlaybackRate
; | 53 this._scrubberPlayer.playbackRate = this._animationsPlaybackRate
; |
54 } | 54 } |
55 | 55 |
56 var container = createElementWithClass("div", "animation-timeline-header
"); | 56 var container = createElementWithClass("div", "animation-timeline-header
"); |
57 var controls = container.createChild("div", "animation-controls"); | 57 var controls = container.createChild("div", "animation-controls"); |
58 container.createChild("div", "animation-timeline-markers"); | 58 container.createChild("div", "animation-timeline-markers"); |
59 | 59 |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 if (!this._scrubberPlayer) | 359 if (!this._scrubberPlayer) |
360 return false; | 360 return false; |
361 | 361 |
362 this._originalScrubberTime = this._scrubberPlayer.currentTime; | 362 this._originalScrubberTime = this._scrubberPlayer.currentTime; |
363 this._timelineScrubber.classList.remove("animation-timeline-end"); | 363 this._timelineScrubber.classList.remove("animation-timeline-end"); |
364 this._scrubberPlayer.pause(); | 364 this._scrubberPlayer.pause(); |
365 this._originalMousePosition = new WebInspector.Geometry.Point(event.x, e
vent.y); | 365 this._originalMousePosition = new WebInspector.Geometry.Point(event.x, e
vent.y); |
366 | 366 |
367 var target = WebInspector.targetManager.mainTarget(); | 367 var target = WebInspector.targetManager.mainTarget(); |
368 if (target) | 368 if (target) |
369 target.animationAgent().setPlaybackRate(0); | 369 target.animationModel.setPlaybackRate(0); |
370 return true; | 370 return true; |
371 }, | 371 }, |
372 | 372 |
373 /** | 373 /** |
374 * @param {!Event} event | 374 * @param {!Event} event |
375 */ | 375 */ |
376 _scrubberDragMove: function(event) | 376 _scrubberDragMove: function(event) |
377 { | 377 { |
378 var delta = event.x - this._originalMousePosition.x; | 378 var delta = event.x - this._originalMousePosition.x; |
379 this._scrubberPlayer.currentTime = Math.min(this._originalScrubberTime +
delta / this.pixelMsRatio(), this.duration() - this._scrubberRadius / this.pixe
lMsRatio()); | 379 this._scrubberPlayer.currentTime = Math.min(this._originalScrubberTime +
delta / this.pixelMsRatio(), this.duration() - this._scrubberRadius / this.pixe
lMsRatio()); |
380 var currentTime = Math.max(0, Math.round(this._scrubberPlayer.currentTim
e)); | 380 var currentTime = Math.max(0, Math.round(this._scrubberPlayer.currentTim
e)); |
381 this._timelineScrubberHead.textContent = WebInspector.UIString(Number.mi
llisToString(currentTime)); | 381 this._timelineScrubberHead.textContent = WebInspector.UIString(Number.mi
llisToString(currentTime)); |
382 var targets = WebInspector.targetManager.targets(); | 382 var targets = WebInspector.targetManager.targets(); |
383 for (var target of targets) | 383 for (var target of targets) |
384 target.animationAgent().setCurrentTime(/** @type {number} */(this.st
artTime() + currentTime)); | 384 target.animationAgent().setCurrentTime(/** @type {number} */(this.st
artTime() + currentTime)); |
385 }, | 385 }, |
386 | 386 |
387 /** | 387 /** |
388 * @param {!Event} event | 388 * @param {!Event} event |
389 */ | 389 */ |
390 _scrubberDragEnd: function(event) | 390 _scrubberDragEnd: function(event) |
391 { | 391 { |
392 if (this._scrubberPlayer.currentTime < this.duration() - this._scrubberR
adius / this.pixelMsRatio()) | 392 if (this._scrubberPlayer.currentTime < this.duration() - this._scrubberR
adius / this.pixelMsRatio()) |
393 this._scrubberPlayer.play(); | 393 this._scrubberPlayer.play(); |
394 this._timelineScrubberHead.window().requestAnimationFrame(this._updateSc
rubber.bind(this)); | 394 this._timelineScrubberHead.window().requestAnimationFrame(this._updateSc
rubber.bind(this)); |
395 var target = WebInspector.targetManager.mainTarget(); | 395 var target = WebInspector.targetManager.mainTarget(); |
396 if (target) | 396 if (target) |
397 target.animationAgent().setPlaybackRate(this._animationsPlaybackRate
); | 397 target.animationModel.setPlaybackRate(this._animationsPlaybackRate); |
398 }, | 398 }, |
399 | 399 |
400 __proto__: WebInspector.VBox.prototype | 400 __proto__: WebInspector.VBox.prototype |
401 } | 401 } |
402 | 402 |
403 /** | 403 /** |
404 * @constructor | 404 * @constructor |
405 * @param {!WebInspector.AnimationModel.AnimationNode} animationNode | 405 * @param {!WebInspector.AnimationModel.AnimationNode} animationNode |
406 */ | 406 */ |
407 WebInspector.AnimationTimeline.NodeUI = function(animationNode) { | 407 WebInspector.AnimationTimeline.NodeUI = function(animationNode) { |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
895 "Light Blue": WebInspector.Color.parse("#03A9F4"), | 895 "Light Blue": WebInspector.Color.parse("#03A9F4"), |
896 "Deep Orange": WebInspector.Color.parse("#FF5722"), | 896 "Deep Orange": WebInspector.Color.parse("#FF5722"), |
897 "Blue": WebInspector.Color.parse("#5677FC"), | 897 "Blue": WebInspector.Color.parse("#5677FC"), |
898 "Lime": WebInspector.Color.parse("#CDDC39"), | 898 "Lime": WebInspector.Color.parse("#CDDC39"), |
899 "Blue Grey": WebInspector.Color.parse("#607D8B"), | 899 "Blue Grey": WebInspector.Color.parse("#607D8B"), |
900 "Pink": WebInspector.Color.parse("#E91E63"), | 900 "Pink": WebInspector.Color.parse("#E91E63"), |
901 "Green": WebInspector.Color.parse("#0F9D58"), | 901 "Green": WebInspector.Color.parse("#0F9D58"), |
902 "Brown": WebInspector.Color.parse("#795548"), | 902 "Brown": WebInspector.Color.parse("#795548"), |
903 "Cyan": WebInspector.Color.parse("#00BCD4") | 903 "Cyan": WebInspector.Color.parse("#00BCD4") |
904 } | 904 } |
OLD | NEW |