Permalink
Browse files

Merge branch 'gh-191-locks' into development

  • Loading branch information...
pisi committed Aug 28, 2013
2 parents 04e4f27 + 03c915d commit e0e921b608cca147fdf8631966761343786bb857
Showing with 88 additions and 6 deletions.
  1. +1 −0 CHANGELOG.markdown
  2. +27 −5 jquery.reel.js
  3. +1 −0 test/tests.js
  4. +3 −1 test/unit/api.js
  5. +2 −0 test/unit/data.js
  6. +54 −0 test/unit/interaction.js
View
@@ -21,6 +21,7 @@ Version 1.2.2
* Preloading cache moved from DOM to memory for better performance.
* Hardware acceleration enabled in Firefox to help remedy occasional flickering therein (GH-196).
* Error message into the console in case target image properties were deemed insufficient.
* New `rowlock` and `framelock` options allow mouse interaction lock of axis in multirow setups (GH-191).
Version 1.2.1
View
@@ -316,6 +316,25 @@
rows: 0,
// ### Multi-Row Locks ######
//
// Optionally you can apply a lock on either of the two axes with `rowlock` and/or `framelock`.
// That will disable direct mouse interaction and will leave using of `.reel()` the only way
// of changing position on the locked axis.
//
// ---
// #### `rowlock` Option ####
// `Boolean`, since 1.3
//
rowlock: false,
// #### `framelock` Option ####
// `Boolean`, since 1.3
//
framelock: false,
// ### Dual-Orbit Mode ######
//
// Special form of multi-axis movie is the dual-axis mode. In this mode the object offers two plain
@@ -906,6 +925,8 @@
set(_row_, null);
set(_tier_, null);
set(_rows_, rows);
set(_rowlock_, opt.rowlock);
set(_framelock_, opt.framelock);
set(_dimensions_, size);
set(_bit_, 1 / (frames - (loops && !stitched ? 0 : 1)));
set(_stitched_travel_, stitched - (loops ? 0 : size.x));
@@ -1316,15 +1337,16 @@
var
revolution= get(_revolution_),
origin= get(_clicked_location_),
vertical= get(_vertical_),
vertical= get(_vertical_)
if (!get(_framelock_)) var
fraction= set(_fraction_, graph(vertical ? y - origin.y : x - origin.x, get(_clicked_on_), revolution, get(_lo_), get(_hi_), get(_cwish_), vertical ? y - origin.y : x - origin.x)),
reeling= set(_reeling_, get(_reeling_) || get(_frame_) != get(_clicked_)),
motion= to_bias(vertical ? delta.y : delta.x || 0),
backwards= motion && set(_backwards_, motion < 0)
if (orbital && get(_center_)) var
vertical= set(_vertical_, abs(y - origin.y) > abs(x - origin.x)),
origin= recenter_mouse(revolution, x, y)
if (rows > 1) var
if (rows > 1 && !get(_rowlock_)) var
space_y= get(_dimensions_).y,
revolution_y= get(_revolution_y_),
start= get(_clicked_tier_),
@@ -1896,7 +1918,7 @@
loops= opt.loops
set(_lo_, loops ? 0 : - fraction * revolution);
set(_hi_, loops ? revolution : revolution - fraction * revolution);
return x && set(_clicked_location_, { x: x, y: y }) || undefined
return x !== undefined && set(_clicked_location_, { x: x, y: y }) || undefined
},
slidable= true,
@@ -2389,10 +2411,10 @@
_annotations_= 'annotations',
_area_= 'area', _auto_= 'auto', _backup_= 'backup', _backwards_= 'backwards', _bit_= 'bit', _brake_= 'brake', _cache_= 'cache', _cached_=_cache_+'d',
_center_= 'center', _clicked_= 'clicked', _clicked_location_= 'clicked_location', _clicked_on_= 'clicked_on', _clicked_tier_= 'clicked_tier',
_cwish_= 'cwish', _dimensions_= 'dimensions', _fraction_= 'fraction', _frame_= 'frame',
_cwish_= 'cwish', _dimensions_= 'dimensions', _fraction_= 'fraction', _frame_= 'frame', _framelock_= 'framelock',
_frames_= 'frames', _hi_= 'hi', _hidden_= 'hidden', _image_= 'image', _images_= 'images', _opening_= 'opening', _opening_ticks_= _opening_+'_ticks',
_lo_= 'lo', _options_= 'options', _playing_= 'playing', _preloaded_= 'preloaded', _reeling_= 'reeling', _reeled_= 'reeled', _revolution_= 'revolution',
_revolution_y_= 'revolution_y', _row_= 'row', _rows_= 'rows', _spacing_= 'spacing', _speed_= 'speed', _stage_= 'stage',
_revolution_y_= 'revolution_y', _row_= 'row', _rowlock_= 'rowlock', _rows_= 'rows', _spacing_= 'spacing', _speed_= 'speed', _stage_= 'stage',
_stitched_shift_= 'stitched_shift', _stitched_travel_= 'stitched_travel', _stopped_= 'stopped', _style_= 'style', _tempo_= 'tempo', _ticks_= 'ticks',
_tier_= 'tier', _velocity_= 'velocity', _vertical_= 'vertical',
View
@@ -26,6 +26,7 @@
'unit/computation.js',
'unit/api.js',
'unit/annotations.js',
'unit/interaction.js',
'unit/animation.js'
],
complete: function(){
View
@@ -27,7 +27,7 @@
$.each($.reel.def, function(){ count++ });
expect(count + 7);
equal( count, 49, 'Total number of options');
equal( count, 51, 'Total number of options');
// Version 1.0 options
equal( $.reel.def.footage, 6, 'number of frames per line/column' );
@@ -91,6 +91,8 @@
// Version 1.3 options (in development)
equal( $.reel.def.duration, undefined, 'duration of animation (in seconds)' );
equal( $.reel.def.framelock, false, 'enables mouse interaction lock on frame' );
equal( $.reel.def.rowlock, false, 'enables mouse interaction lock on row' );
});
test( 'jQuery of currently living instances is referenced as `$.reel.instances`', function()
View
@@ -26,6 +26,7 @@
dimensions: 'Object',
fraction: 'Number',
frame: 'Number',
framelock: 'Boolean',
frames: 'Number',
hi: 'Number',
id: 'String',
@@ -42,6 +43,7 @@
revolution: 'Number',
revolution_y: 'Number',
row: 'Number',
rowlock: 'Boolean',
rows: 'Number',
spacing: 'Number',
speed: 'Number',
View
@@ -5,4 +5,58 @@
module('Interaction', reel_test_module_routine);
asyncTest( 'Multirow row lock', function(){
expect(4);
var
frame= 2,
row= 2,
$reel= $('#image').reel({
frames: 3,
frame: 2,
rows: 3,
rowlock: true,
row: row
})
$(document).bind('loaded.test', function(){
equal( $reel.reel('rowlock'), true, 'Rowlock engaged');
equal( $reel.reel('row'), row, 'Locked on row');
$reel.trigger('down', [0, 0]);
$reel.trigger('pan', [200, 200]);
$reel.trigger('up', [200, 200]);
equal( $reel.reel('row'), row, 'Holding the locked row after diagonal drag');
ok( $reel.reel('frame') != frame, 'Frame has changed');
start();
});
});
asyncTest( 'Multirow frame lock', function(){
expect(4);
var
frame= 2,
row= 2,
$reel= $('#image').reel({
frames: 3,
framelock: true,
frame: frame,
rows: 3,
row: row
})
$(document).bind('loaded.test', function(){
equal( $reel.reel('framelock'), true, 'Framelock engaged');
equal( $reel.reel('frame'), 3 + frame, 'Locked on frame ('+frame+' row compensated)');
$reel.trigger('down', [0, 0]);
$reel.trigger('pan', [200, 200]);
$reel.trigger('up', [200, 200]);
equal( $reel.reel('frame'), 3 + 3 + frame, 'Holding the locked frame ('+frame+' row compensated) after diagonal drag');
ok( $reel.reel('row') != row, 'Row has changed');
start();
});
});
})(jQuery);

0 comments on commit e0e921b

Please sign in to comment.