Skip to content

Commit

Permalink
Add ability to have more than one transition data for a view
Browse files Browse the repository at this point in the history
  • Loading branch information
fedegratti committed Feb 24, 2022
1 parent ee2f519 commit ffccf35
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v6.3.2
v6.3.3
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ohzi-core",
"version": "6.3.2",
"version": "6.3.3",
"description": "OHZI Core Library",
"source": "src/index.js",
"module": "build/index.module.js",
Expand Down
16 changes: 13 additions & 3 deletions src/view_components/transition/TransitionTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,29 @@ export default class TransitionTable
this.initial_state_data = {};
}

get(to_state, current_context)
get(from_state_name, to_state_name, current_context)
{
for (let i = 0; i < this.transitions.length; i++)
{
if (this.transitions[i].to === to_state)
if (this.transitions[i].from === from_state_name && this.transitions[i].to === to_state_name)
{
const action_sequencer = new ActionSequencerBuilder(this.initial_state_data).from_animation_sheet(this.transitions[i].data, current_context);

return action_sequencer;
}
}

console.error('TransitionTable.get no data found for: ', to_state);
for (let i = 0; i < this.transitions.length; i++)
{
if (this.transitions[i].to === to_state_name)
{
const action_sequencer = new ActionSequencerBuilder(this.initial_state_data).from_animation_sheet(this.transitions[i].data, current_context);

return action_sequencer;
}
}

console.error('TransitionTable.get no data found for: ', from_state_name, to_state_name);
return undefined;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default class ViewStateTransitionHandler
this.last_state.before_exit();
this.current_state.show();

this.action_sequencer = this.transition_table.get(this.current_state.name, this.current_state_data);
this.action_sequencer = this.transition_table.get(this.last_state.name, this.current_state.name, this.current_state_data);
this.current_state.before_enter();

this.action_sequencer.play();
Expand Down

0 comments on commit ffccf35

Please sign in to comment.