Skip to content

Commit

Permalink
ideas about how to handle different kinds of
Browse files Browse the repository at this point in the history
internal states (mouse vs. keyboard). removed
console.logs
  • Loading branch information
swannodette committed Oct 24, 2009
1 parent d34678a commit 71b9b43
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
3 changes: 0 additions & 3 deletions FxGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ Fx.Graph = new Class({
of triggering the morph to that state.
*/
setState: function(name, animate) {
console.log('setState', name);
this.transitionState = name;
if(animate === false) return;
var state = this.graph[name];
Expand All @@ -85,10 +84,8 @@ Fx.Graph = new Class({
onStateArrive: function() {
this.currentState = this.transitionState;
var state = this.graph[this.currentState];
console.log('onStateArrive', this.currentState);
if(state.onComplete) state.onComplete();
if(state.hold) {
console.log('hold!')
this.delays.push(this.setState.delay(state.hold.duration, this, [state[this.direction]]));
} else if(state[this.direction]) {
this.setState(state[this.direction]);
Expand Down
20 changes: 13 additions & 7 deletions examples/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ function init() {
next: 'step1',
selector: '.start',
events: [
{type:'shiftdown', direction:'next'},
{type:'shiftup', state:'start', direction:'previous'}
{type: 'mouseover', direction: 'next', flag: 'mouse'},
{type: 'mouseout', direction: 'previous', unflag: 'mouse'},
{type: 'shiftdown', direction: 'next', condition: {not: ['mouse']}},
{type: 'shiftup', state: 'start', direction: 'previous', condition: {not: ['mouse']}}
]
},
step1: {
Expand All @@ -47,8 +49,10 @@ function init() {
selector: '.step1',
hold: {duration: 1000},
events: [
{type:'shiftdown', direction:'next'},
{type:'shiftup', state:'start', direction:'previous'}
{type: 'mouseover', direction: 'next', flag: 'mouse'},
{type: 'mouseout', state: 'start', direction: 'previous', unflag: 'mouse'},
{type: 'shiftdown', direction: 'next', condition: {not: ['mouse']}},
{type: 'shiftup', state: 'start', direction: 'previous', condition: {not: ['mouse']}}
]
},
step2: {
Expand All @@ -57,15 +61,17 @@ function init() {
selector: '.step2',
hold: {duration: 1000},
events: [
{type:'shiftdown', direction:'next'},
{type:'shiftup', direction:'previous'}
{type: 'mouseover', direction: 'next', flag: 'mouse'},
{type: 'mouseout', direction: 'previous', unflag: 'mouse'},
{type: 'shiftdown', direction: 'next', condition: {not: ['mouse']}},
{type: 'shiftup', direction: 'previous', condition: {not: ['mouse']}}
]
},
step3: {
previous: 'step2',
selector: '.step3',
events: [
{type:'reset', state:'step1'}
{type: 'reset', state: 'step1'}
]
}
}
Expand Down

0 comments on commit 71b9b43

Please sign in to comment.