Permalink
Browse files

Merge pull request #147 from operasoftware/profiler-zooming_reviewed

Profiler zooming reviewed
  • Loading branch information...
hzr committed Dec 13, 2012
2 parents 34b25ee + b232c0b commit 4d106476132f94661554779e8c13851f050b4a8f
Showing with 22 additions and 16 deletions.
  1. +1 −1 src/profiler/profiler_templates.js
  2. +1 −0 src/profiler/profiler_view.js
  3. +20 −15 src/ui-scripts/zoomer/zoomer.js
@@ -376,7 +376,7 @@ var ProfilerTemplates = function()
case EVENT_TYPE_THREAD_EVALUATION:
var title = [];
- var thread_type = event.scriptThreadEvaluation.threadType;
+ var thread_type = event.scriptThreadEvaluation.scriptThreadType;
var event_name = event.scriptThreadEvaluation.eventName;
if (thread_type)
@@ -349,6 +349,7 @@ var ProfilerView = function(id, name, container_class, html, default_handler)
if (this._current_session_id)
this._profiler.release_session(null, {session_id: this._old_session_id});
this._reset();
+ this._zoomer.reset();
}
};
@@ -151,9 +151,7 @@ var ZoomerPrototype = function()
this._zoomer_ele_onmousewheel = function(event)
{
var mouse_x = event.clientX - this._zoomer_ele_left;
- var diff = (mouse_x < this._overlay_left) ? MOUSEWHEEL_DIFF : -MOUSEWHEEL_DIFF;
- if (event.wheelDelta < 0)
- diff = -diff;
+ var diff = (event.wheelDelta < 0) ? -MOUSEWHEEL_DIFF : MOUSEWHEEL_DIFF;
this.move_overlay(diff);
event.stopPropagation();
};
@@ -197,7 +195,7 @@ var ZoomerPrototype = function()
this._overlay_ele_onmousewheel = function(event)
{
- var diff = (event.wheelDelta > 0) ? MOUSEWHEEL_DIFF : -MOUSEWHEEL_DIFF;
+ var diff = (event.wheelDelta > 0) ? -MOUSEWHEEL_DIFF : MOUSEWHEEL_DIFF;
this.change_overlay_size(-diff, diff);
event.stopPropagation();
};
@@ -209,20 +207,23 @@ var ZoomerPrototype = function()
if (this._handle_ele)
return;
+ if (!event.key)
+ return;
+
var width = this._to_right_x(this._overlay_right) - this._overlay_left;
var diff = {
- 33: width, // Page up
- 34: -width, // Page down
- 37: -KEYDOWN_DIFF, // Arrow left
- 39: KEYDOWN_DIFF // Arrow right
- }[event.which];
+ "PageUp": width,
+ "PageDown": -width,
+ "Left": -KEYDOWN_DIFF,
+ "Right": KEYDOWN_DIFF
+ }[event.key];
if (diff)
this.move_overlay(diff);
diff = {
- 38: KEYDOWN_DIFF, // Arrow up
- 40: -KEYDOWN_DIFF // Arrow down
- }[event.which];
+ "Up": -KEYDOWN_DIFF,
+ "Down": KEYDOWN_DIFF
+ }[event.key];
if (diff)
this.change_overlay_size(-diff, diff);
@@ -289,10 +290,14 @@ var ZoomerPrototype = function()
this._handle_ele_onkeydown = function(event)
{
+ if (!event.key)
+ return;
+
var diff = {
- 37: -KEYDOWN_DIFF, // Arrow left
- 39: KEYDOWN_DIFF // Arrow right
- }[event.which];
+ "Left": -KEYDOWN_DIFF,
+ "Right": KEYDOWN_DIFF
+ }[event.key];
+
if (!diff)
return;
var is_left_handle = this._handle_ele == this._handle_left_ele;

0 comments on commit 4d10647

Please sign in to comment.