var addedActions = [],
contextParams = {},
- contextDefer = {},
- duringClick = false,
document, canvas;
var view = {
group.append(view.dom);
view.on('actionExecuted', function(action, ret) {
sandbox.publish('actionExecuted', action, ret);
- duringClick = false;
- _.pairs(contextDefer).forEach(function(pair) {
- var what = pair[0],
- deferred = pair[1];
- if(deferred) {
- refreshContextParam(what);
- }
- });
- });
- view.on('mousedown', function() {
- duringClick = true;
});
view.on('hover', function() {
var setContextParam = function(what, ctx) {
contextParams[what] = ctx;
- if(duringClick) {
- contextDefer[what] = true;
- } else {
- refreshContextParam(what);
- }
- };
-
- var refreshContextParam = function(what) {
addedActions.forEach(function(action) {
action.updateContextParam(what, contextParams[what]);
});