Changeset View
Changeset View
Standalone View
Standalone View
webroot/rsrc/js/application/diff/DiffChangesetList.js
Show All 23 Lines | construct: function() { | ||||
JX.Stratcom.listen('click', 'reveal-inline', onexpand); | JX.Stratcom.listen('click', 'reveal-inline', onexpand); | ||||
var onresize = JX.bind(this, this._ifawake, this._onresize); | var onresize = JX.bind(this, this._ifawake, this._onresize); | ||||
JX.Stratcom.listen('resize', null, onresize); | JX.Stratcom.listen('resize', null, onresize); | ||||
var onscroll = JX.bind(this, this._ifawake, this._onscroll); | var onscroll = JX.bind(this, this._ifawake, this._onscroll); | ||||
JX.Stratcom.listen('scroll', null, onscroll); | JX.Stratcom.listen('scroll', null, onscroll); | ||||
JX.enableDispatch(window, 'selectstart'); | |||||
var onselect = JX.bind(this, this._ifawake, this._onselect); | var onselect = JX.bind(this, this._ifawake, this._onselect); | ||||
JX.Stratcom.listen( | JX.Stratcom.listen( | ||||
'mousedown', | ['mousedown', 'selectstart'], | ||||
['differential-inline-comment', 'differential-inline-header'], | ['differential-inline-comment', 'differential-inline-header'], | ||||
onselect); | onselect); | ||||
var onhover = JX.bind(this, this._ifawake, this._onhover); | var onhover = JX.bind(this, this._ifawake, this._onhover); | ||||
JX.Stratcom.listen( | JX.Stratcom.listen( | ||||
['mouseover', 'mouseout'], | ['mouseover', 'mouseout'], | ||||
'differential-inline-comment', | 'differential-inline-comment', | ||||
onhover); | onhover); | ||||
▲ Show 20 Lines • Show All 669 Lines • ▼ Show 20 Lines | selectChangeset: function(changeset, scroll) { | ||||
} else { | } else { | ||||
this._setSelectionState(null, false); | this._setSelectionState(null, false); | ||||
} | } | ||||
return this; | return this; | ||||
}, | }, | ||||
_setSelectionState: function(item, scroll) { | _setSelectionState: function(item, scroll) { | ||||
var old = this._cursorItem; | |||||
if (old) { | |||||
if (old.type === 'comment') { | |||||
old.target.setIsSelected(false); | |||||
} | |||||
} | |||||
this._cursorItem = item; | this._cursorItem = item; | ||||
if (item) { | |||||
if (item.type === 'comment') { | |||||
item.target.setIsSelected(true); | |||||
} | |||||
} | |||||
this._redrawSelection(scroll); | this._redrawSelection(scroll); | ||||
return this; | return this; | ||||
}, | }, | ||||
_redrawSelection: function(scroll) { | _redrawSelection: function(scroll) { | ||||
var cursor = this._cursorItem; | var cursor = this._cursorItem; | ||||
if (!cursor) { | if (!cursor) { | ||||
▲ Show 20 Lines • Show All 392 Lines • ▼ Show 20 Lines | |||||
_onselect: function(e) { | _onselect: function(e) { | ||||
// If the user clicked some element inside the header, like an action | // If the user clicked some element inside the header, like an action | ||||
// icon, ignore the event. They have to click the header element itself. | // icon, ignore the event. They have to click the header element itself. | ||||
if (e.getTarget() !== e.getNode('differential-inline-header')) { | if (e.getTarget() !== e.getNode('differential-inline-header')) { | ||||
return; | return; | ||||
} | } | ||||
// If the user has double-clicked or triple-clicked a header, we want to | |||||
// toggle the inline selection mode, not select text. Kill select events | |||||
// originating with this element as the target. | |||||
if (e.getType() === 'selectstart') { | |||||
e.kill(); | |||||
return; | |||||
} | |||||
var inline = this._getInlineForEvent(e); | var inline = this._getInlineForEvent(e); | ||||
if (!inline) { | if (!inline) { | ||||
return; | return; | ||||
} | } | ||||
// NOTE: Don't kill or prevent the event. In particular, we want this | // NOTE: Don't kill or prevent the event. In particular, we want this | ||||
// click to clear any text selection as it normally would. | // click to clear any text selection as it normally would. | ||||
▲ Show 20 Lines • Show All 1,610 Lines • Show Last 20 Lines |