Changeset View
Changeset View
Standalone View
Standalone View
webroot/rsrc/js/application/projects/WorkboardBoard.js
| Show All 37 Lines | members: { | ||||
| _root: null, | _root: null, | ||||
| _columns: null, | _columns: null, | ||||
| _headers: null, | _headers: null, | ||||
| _cards: null, | _cards: null, | ||||
| _dropPreviewNode: null, | _dropPreviewNode: null, | ||||
| _dropPreviewListNode: null, | _dropPreviewListNode: null, | ||||
| _previewPHID: null, | _previewPHID: null, | ||||
| _hidePreivew: false, | _hidePreivew: false, | ||||
| _previewPositionVector: null, | |||||
| _previewDimState: false, | |||||
| getRoot: function() { | getRoot: function() { | ||||
| return this._root; | return this._root; | ||||
| }, | }, | ||||
| getColumns: function() { | getColumns: function() { | ||||
| return this._columns; | return this._columns; | ||||
| }, | }, | ||||
| ▲ Show 20 Lines • Show All 89 Lines • ▼ Show 20 Lines | _buildColumns: function() { | ||||
| this._columns[phid] = new JX.WorkboardColumn(this, phid, node); | this._columns[phid] = new JX.WorkboardColumn(this, phid, node); | ||||
| } | } | ||||
| var on_over = JX.bind(this, this._showTriggerPreview); | var on_over = JX.bind(this, this._showTriggerPreview); | ||||
| var on_out = JX.bind(this, this._hideTriggerPreview); | var on_out = JX.bind(this, this._hideTriggerPreview); | ||||
| JX.Stratcom.listen('mouseover', 'trigger-preview', on_over); | JX.Stratcom.listen('mouseover', 'trigger-preview', on_over); | ||||
| JX.Stratcom.listen('mouseout', 'trigger-preview', on_out); | JX.Stratcom.listen('mouseout', 'trigger-preview', on_out); | ||||
| var on_move = JX.bind(this, this._dimPreview); | |||||
| JX.Stratcom.listen('mousemove', null, on_move); | |||||
| }, | |||||
| _dimPreview: function(e) { | |||||
| var p = this._previewPositionVector; | |||||
| if (!p) { | |||||
| return; | |||||
| } | |||||
| // When the mouse cursor gets near the drop preview element, fade it | |||||
| // out so you can see through it. We can't do this with ":hover" because | |||||
| // we disable cursor events. | |||||
| var cursor = JX.$V(e); | |||||
| var margin = 64; | |||||
| var near_x = (cursor.x > (p.x - margin)); | |||||
| var near_y = (cursor.y > (p.y - margin)); | |||||
| var should_dim = (near_x && near_y); | |||||
| this._setPreviewDimState(should_dim); | |||||
| }, | |||||
| _setPreviewDimState: function(is_dim) { | |||||
| if (is_dim === this._previewDimState) { | |||||
| return; | |||||
| } | |||||
| this._previewDimState = is_dim; | |||||
| var node = this._getDropPreviewNode(); | |||||
| JX.DOM.alterClass(node, 'workboard-drop-preview-fade', is_dim); | |||||
| }, | }, | ||||
| _showTriggerPreview: function(e) { | _showTriggerPreview: function(e) { | ||||
| if (this._disablePreview) { | if (this._disablePreview) { | ||||
| return; | return; | ||||
| } | } | ||||
| var target = e.getTarget(); | var target = e.getTarget(); | ||||
| ▲ Show 20 Lines • Show All 161 Lines • ▼ Show 20 Lines | _didChangeDropTarget: function(src_list, src_node, dst_list, dst_node) { | ||||
| this._showEffects(effects); | this._showEffects(effects); | ||||
| }, | }, | ||||
| _showEffects: function(effects) { | _showEffects: function(effects) { | ||||
| var node = this._getDropPreviewNode(); | var node = this._getDropPreviewNode(); | ||||
| if (!effects.length) { | if (!effects.length) { | ||||
| JX.DOM.remove(node); | JX.DOM.remove(node); | ||||
| this._previewPositionVector = null; | |||||
| return; | return; | ||||
| } | } | ||||
| var items = []; | var items = []; | ||||
| for (var ii = 0; ii < effects.length; ii++) { | for (var ii = 0; ii < effects.length; ii++) { | ||||
| var effect = effects[ii]; | var effect = effects[ii]; | ||||
| items.push(effect.newNode()); | items.push(effect.newNode()); | ||||
| } | } | ||||
| JX.DOM.setContent(this._getDropPreviewListNode(), items); | JX.DOM.setContent(this._getDropPreviewListNode(), items); | ||||
| document.body.appendChild(node); | document.body.appendChild(node); | ||||
| // Undim the drop preview element if it was previously dimmed. | |||||
| this._setPreviewDimState(false); | |||||
| this._previewPositionVector = JX.$V(node); | |||||
| }, | }, | ||||
| _getDropPreviewNode: function() { | _getDropPreviewNode: function() { | ||||
| if (!this._dropPreviewNode) { | if (!this._dropPreviewNode) { | ||||
| var attributes = { | var attributes = { | ||||
| className: 'workboard-drop-preview' | className: 'workboard-drop-preview' | ||||
| }; | }; | ||||
| ▲ Show 20 Lines • Show All 291 Lines • Show Last 20 Lines | |||||