Adds ctrl-click file selection.

This commit is contained in:
Lars Jung 2012-09-18 18:56:50 +02:00
parent 9545ec2894
commit 8520658c34

View file

@ -31,7 +31,8 @@ modulejs.define('ext/select', ['_', '$', 'core/settings', 'core/event'], functio
event.preventDefault(); event.preventDefault();
$selectionRect $selectionRect
.stop(true, true) .stop(true, true)
.css({left: l, top: t, width: w, height: h}); .css({left: l, top: t, width: w, height: h, opacity: 1})
.show();
var selRect = $selectionRect.fracs('rect'); var selRect = $selectionRect.fracs('rect');
$('#extended .entry').removeClass('selecting').each(function () { $('#extended .entry').removeClass('selecting').each(function () {
@ -76,30 +77,23 @@ modulejs.define('ext/select', ['_', '$', 'core/settings', 'core/event'], functio
x = event.pageX; x = event.pageX;
y = event.pageY; y = event.pageY;
l = x;
t = y;
w = 0;
h = 0;
// only on left button and don't block the scrollbars // only on left button and don't block the scrollbars
if (event.button !== 0 || l >= view.right || t >= view.bottom) { if (event.button !== 0 || x >= view.right || y >= view.bottom) {
return; return;
} }
event.preventDefault();
$(':focus').blur(); $(':focus').blur();
if (!event.ctrlKey && !event.metaKey) { if (!event.ctrlKey && !event.metaKey) {
$('#extended .entry').removeClass('selected'); $('#extended .entry').removeClass('selected');
publish(); publish();
} }
$selectionRect
.stop(true, true)
.css({left: l, top: t, width: w, height: h, opacity: 1})
.show();
$document $document
.on('mousemove', selectionUpdate) .on('mousemove', selectionUpdate)
.one('mouseup', selectionEnd); .one('mouseup', selectionEnd);
selectionUpdate(event);
}, },
noSelection = function (event) { noSelection = function (event) {