Skip to content

Commit

Permalink
Merge pull request #603 from OpenGeoscience/refactor-interactor-actions
Browse files Browse the repository at this point in the history
Refactor how actions are specified and detected.
  • Loading branch information
manthey authored Aug 29, 2016
2 parents 0a6efce + 136e2d5 commit 12a68a2
Show file tree
Hide file tree
Showing 6 changed files with 614 additions and 222 deletions.
17 changes: 17 additions & 0 deletions src/action.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//////////////////////////////////////////////////////////////////////////////
/**
* Common object containing all action types that are provided by the GeoJS
* API.
*/
//////////////////////////////////////////////////////////////////////////////
var geo_action = {
momentum: 'geo_action_momentum',
pan: 'geo_action_pan',
rotate: 'geo_action_rotate',
select: 'geo_action_select',
unzoomselect: 'geo_action_unzoomselect',
zoom: 'geo_action_zoom',
zoomselect: 'geo_action_zoomselect'
};

module.exports = geo_action;
57 changes: 57 additions & 0 deletions src/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,63 @@ geo_event.zoomselect = 'geo_zoomselect';
//////////////////////////////////////////////////////////////////////////////
geo_event.unzoomselect = 'geo_unzoomselect';

//////////////////////////////////////////////////////////////////////////////
/**
* Triggered when an action is initiated with mouse down
*
* @property {object} state The action state
* @property {geo.mouseState} mouse The mouse state
* @property {object} event The triggering event
*/
//////////////////////////////////////////////////////////////////////////////
geo_event.actiondown = 'geo_actiondown';

//////////////////////////////////////////////////////////////////////////////
/**
* Triggered when an action is being processed during mouse movement.
*
* @property {object} state The action state
* @property {geo.mouseState} mouse The mouse state
* @property {object} event The triggering event
*/
//////////////////////////////////////////////////////////////////////////////
geo_event.actionmove = 'geo_actionmove';

//////////////////////////////////////////////////////////////////////////////
/**
* Triggered when an action is ended with a mouse up.
*
* @property {object} state The action state
* @property {geo.mouseState} mouse The mouse state
* @property {object} event The triggering event
*/
//////////////////////////////////////////////////////////////////////////////
geo_event.actionup = 'geo_actionup';

//////////////////////////////////////////////////////////////////////////////
/**
* Triggered when an action results in a selection.
*
* @property {object} state The action state
* @property {geo.mouseState} mouse The mouse state
* @property {object} event The triggering event
* @property {object} lowerLeft Lower left of selection in screen coordinates
* @property {object} upperRight Upper right of selection in screen coordinates
*/
//////////////////////////////////////////////////////////////////////////////
geo_event.actionselection = 'geo_actionselection';

//////////////////////////////////////////////////////////////////////////////
/**
* Triggered when an action is triggered with a mouse wheel event.
*
* @property {object} state The action state
* @property {geo.mouseState} mouse The mouse state
* @property {object} event The triggering event
*/
//////////////////////////////////////////////////////////////////////////////
geo_event.actionwheel = 'geo_actionwheel';

//////////////////////////////////////////////////////////////////////////////
/**
* Triggered before a map navigation animation begins. Set
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ module.exports = $.extend({
featureLayer: require('./featureLayer'),
fetchQueue: require('./fetchQueue'),
fileReader: require('./fileReader'),
geo_action: require('./action'),
geomFeature: require('./geomFeature'),
graphFeature: require('./graphFeature'),
imageTile: require('./imageTile'),
Expand Down
Loading

0 comments on commit 12a68a2

Please sign in to comment.