diff options
| author | Alon Levy <alon@pobox.com> | 2014-10-28 12:22:37 +0200 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2014-10-28 12:22:37 +0200 |
| commit | cd9efc989a5a86e610513dac31316193dc41431a (patch) | |
| tree | b276f5b4e67ee7d53951d770778e955aaf2ed2f1 /scripts | |
| parent | d7d34eb2bece8a39fecc3354de0f7d0a6e8827c6 (diff) | |
wip/history zoom
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/app.js | 2 | ||||
| -rw-r--r-- | scripts/history.js | 16 | ||||
| -rw-r--r-- | scripts/rhizicore.js | 2 |
3 files changed, 17 insertions, 3 deletions
diff --git a/scripts/app.js b/scripts/app.js index 2ad7d5c0..96b15fcb 100644 --- a/scripts/app.js +++ b/scripts/app.js @@ -1,6 +1,6 @@ (function() { var config = { - //urlArgs: "bust=" + (new Date()).getTime(), // NOTE: useful for debugging + urlArgs: "bust=" + (new Date()).getTime(), // NOTE: useful for debugging paths: { jquery: 'external/jquery', 'jquery-ui': 'external/jquery-ui', diff --git a/scripts/history.js b/scripts/history.js index 5cc77eec..1df562ce 100644 --- a/scripts/history.js +++ b/scripts/history.js @@ -18,7 +18,10 @@ define('history', ['jquery', 'FileSaver', 'consts', 'signal'], function($, saveAs, consts, signal) { -function History(user) { +/* user - username (string) + * svg - svg element for catching zoom events (jquery DOMNode wrapper) + */ +function History(user, svg) { var that = this; this.records = []; this.user = user; @@ -28,6 +31,10 @@ function History(user) { signal.slot(consts.KEYSTROKES, function(obj) { return that.record_keystrokes(obj); }); + // XXX create zoom behavior - then proof to event name change + $(window).on('wheel', function(obj) { + return that.record_zoom(obj); + }); } var ACTION_KEYSTROKES = 'ACTION_KEYSTROKES'; @@ -47,6 +54,13 @@ History.prototype.record = function(d) this.records.push(d); }; +History.prototype.record_zoom = function(d) +{ + console.log('history record zoom'); + console.log(d); + return true; +} + History.prototype.save_to_file = function() { var json = JSON.stringify(this.records, function (k, v) { return v; }, 2); diff --git a/scripts/rhizicore.js b/scripts/rhizicore.js index de823882..a8b091cc 100644 --- a/scripts/rhizicore.js +++ b/scripts/rhizicore.js @@ -569,7 +569,7 @@ function myGraph(el) { function set_user(user) { this.user = user; - this.history = new History(this.user); + this.history = new History(this.user, $('svg')); console.log('new user: ' + user); } this.set_user = set_user; |
