Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(430)

Side by Side Diff: tracing/tracing/ui/timeline_viewport.html

Issue 2771723003: [tracing] Move math utilities from base into their own subdirectory (attempt 2) (Closed)
Patch Set: rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <!-- 2 <!--
3 Copyright (c) 2012 The Chromium Authors. All rights reserved. 3 Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style license that can be 4 Use of this source code is governed by a BSD-style license that can be
5 found in the LICENSE file. 5 found in the LICENSE file.
6 --> 6 -->
7 7
8 <link rel="import" href="/tracing/base/event.html"> 8 <link rel="import" href="/tracing/base/event.html">
9 <link rel="import" href="/tracing/base/unit.html"> 9 <link rel="import" href="/tracing/base/unit.html">
10 <link rel="import" href="/tracing/model/event_set.html"> 10 <link rel="import" href="/tracing/model/event_set.html">
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 183
184 queueDisplayTransformAnimation: function(animation) { 184 queueDisplayTransformAnimation: function(animation) {
185 if (!(animation instanceof tr.ui.b.Animation)) 185 if (!(animation instanceof tr.ui.b.Animation))
186 throw new Error('animation must be instanceof tr.ui.b.Animation'); 186 throw new Error('animation must be instanceof tr.ui.b.Animation');
187 this.dtAnimationController_.queueAnimation(animation); 187 this.dtAnimationController_.queueAnimation(animation);
188 }, 188 },
189 189
190 onCurentDisplayTransformChange_: function(oldDisplayTransform) { 190 onCurentDisplayTransformChange_: function(oldDisplayTransform) {
191 // Ensure panY stays clamped in the track container's scroll range. 191 // Ensure panY stays clamped in the track container's scroll range.
192 if (this.modelTrackContainer_) { 192 if (this.modelTrackContainer_) {
193 this.currentDisplayTransform.panY = tr.b.clamp( 193 this.currentDisplayTransform.panY = tr.b.math.clamp(
194 this.currentDisplayTransform.panY, 194 this.currentDisplayTransform.panY,
195 0, 195 0,
196 this.modelTrackContainer_.scrollHeight - 196 this.modelTrackContainer_.scrollHeight -
197 this.modelTrackContainer_.clientHeight); 197 this.modelTrackContainer_.clientHeight);
198 } 198 }
199 199
200 var changed = !this.currentDisplayTransform.equals(oldDisplayTransform); 200 var changed = !this.currentDisplayTransform.equals(oldDisplayTransform);
201 var yChanged = this.currentDisplayTransform.panY !== 201 var yChanged = this.currentDisplayTransform.panY !==
202 oldDisplayTransform.panY; 202 oldDisplayTransform.panY;
203 if (yChanged) 203 if (yChanged)
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 313
314 updateMajorMarkData: function(viewLWorld, viewRWorld) { 314 updateMajorMarkData: function(viewLWorld, viewRWorld) {
315 var pixelRatio = window.devicePixelRatio || 1; 315 var pixelRatio = window.devicePixelRatio || 1;
316 var dt = this.currentDisplayTransform; 316 var dt = this.currentDisplayTransform;
317 317
318 var idealMajorMarkDistancePix = 318 var idealMajorMarkDistancePix =
319 IDEAL_MAJOR_MARK_DISTANCE_PX * pixelRatio; 319 IDEAL_MAJOR_MARK_DISTANCE_PX * pixelRatio;
320 var idealMajorMarkDistanceWorld = 320 var idealMajorMarkDistanceWorld =
321 dt.xViewVectorToWorld(idealMajorMarkDistancePix); 321 dt.xViewVectorToWorld(idealMajorMarkDistancePix);
322 322
323 var majorMarkDistanceWorld = tr.b.preferredNumberLargerThanMin( 323 var majorMarkDistanceWorld = tr.b.math.preferredNumberLargerThanMin(
324 idealMajorMarkDistanceWorld); 324 idealMajorMarkDistanceWorld);
325 325
326 var firstMajorMark = Math.floor( 326 var firstMajorMark = Math.floor(
327 viewLWorld / majorMarkDistanceWorld) * majorMarkDistanceWorld; 327 viewLWorld / majorMarkDistanceWorld) * majorMarkDistanceWorld;
328 328
329 this.majorMarkWorldPositions_ = []; 329 this.majorMarkWorldPositions_ = [];
330 for (var curX = firstMajorMark; 330 for (var curX = firstMajorMark;
331 curX < viewRWorld; 331 curX < viewRWorld;
332 curX += majorMarkDistanceWorld) { 332 curX += majorMarkDistanceWorld) {
333 this.majorMarkWorldPositions_.push( 333 this.majorMarkWorldPositions_.push(
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 trackForEvent: function(event) { 431 trackForEvent: function(event) {
432 return this.eventToTrackMap_[event.guid]; 432 return this.eventToTrackMap_[event.guid];
433 } 433 }
434 }; 434 };
435 435
436 return { 436 return {
437 TimelineViewport, 437 TimelineViewport,
438 }; 438 };
439 }); 439 });
440 </script> 440 </script>
OLDNEW
« no previous file with comments | « tracing/tracing/ui/timeline_interest_range.html ('k') | tracing/tracing/ui/tracks/chart_series.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698