Changeset View
Changeset View
Standalone View
Standalone View
webroot/rsrc/js/application/projects/Workboard.js
Show All 13 Lines | |||||
JX.install('Workboard', { | JX.install('Workboard', { | ||||
construct: function(config) { | construct: function(config) { | ||||
this._config = config; | this._config = config; | ||||
this._boardNodes = {}; | this._boardNodes = {}; | ||||
this._setupCoverImageHandlers(); | this._setupCoverImageHandlers(); | ||||
this._setupPanHandlers(); | |||||
}, | }, | ||||
members: { | members: { | ||||
_config: null, | _config: null, | ||||
_boardNodes: null, | _boardNodes: null, | ||||
_currentBoard: null, | _currentBoard: null, | ||||
_panOrigin: null, | |||||
_panNode: null, | |||||
_panX: null, | |||||
addBoard: function(board_phid, board_node) { | addBoard: function(board_phid, board_node) { | ||||
this._currentBoard = board_phid; | this._currentBoard = board_phid; | ||||
this._boardNodes[board_phid] = board_node; | this._boardNodes[board_phid] = board_node; | ||||
}, | }, | ||||
_getConfig: function() { | _getConfig: function() { | ||||
return this._config; | return this._config; | ||||
}, | }, | ||||
Show All 31 Lines | _setupCoverImageHandlers: function() { | ||||
new JX.Workflow(config.coverURI, data) | new JX.Workflow(config.coverURI, data) | ||||
.setHandler(function(r) { | .setHandler(function(r) { | ||||
JX.DOM.replace(node, JX.$H(r.task)); | JX.DOM.replace(node, JX.$H(r.task)); | ||||
}) | }) | ||||
.start(); | .start(); | ||||
}); | }); | ||||
drop.start(); | drop.start(); | ||||
}, | |||||
_setupPanHandlers: function() { | |||||
var mousedown = JX.bind(this, this._onpanmousedown); | |||||
var mousemove = JX.bind(this, this._onpanmousemove); | |||||
var mouseup = JX.bind(this, this._onpanmouseup); | |||||
JX.Stratcom.listen('mousedown', 'workboard-shadow', mousedown); | |||||
JX.Stratcom.listen('mousemove', null, mousemove); | |||||
JX.Stratcom.listen('mouseup', null, mouseup); | |||||
}, | |||||
_onpanmousedown: function(e) { | |||||
if (!JX.Device.isDesktop()) { | |||||
return; | |||||
} | |||||
if (e.getNode('workpanel')) { | |||||
return; | |||||
} | |||||
if (JX.Stratcom.pass()) { | |||||
return; | |||||
} | } | ||||
e.kill(); | |||||
this._panOrigin = JX.$V(e); | |||||
this._panNode = e.getNode('workboard-shadow'); | |||||
this._panX = this._panNode.scrollLeft; | |||||
}, | |||||
_onpanmousemove: function(e) { | |||||
if (!this._panOrigin) { | |||||
return; | |||||
} | |||||
var cursor = JX.$V(e); | |||||
this._panNode.scrollLeft = this._panX + (this._panOrigin.x - cursor.x); | |||||
}, | |||||
_onpanmouseup: function() { | |||||
this._panOrigin = null; | |||||
} | |||||
} | } | ||||
}); | }); |