mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-08-11 16:34:01 +02:00
Update drag select.
This commit is contained in:
@@ -1,4 +1,10 @@
|
|||||||
|
|
||||||
|
|
||||||
|
html.drag-select, html.drag-select * {
|
||||||
|
cursor: move !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#selection-rect {
|
#selection-rect {
|
||||||
display: none;
|
display: none;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
@@ -11,6 +11,7 @@ modulejs.define('ext/select', ['_', '$', 'core/settings', 'core/resource', 'core
|
|||||||
var isDragSelect, isCtrlPressed;
|
var isDragSelect, isCtrlPressed;
|
||||||
var shrink = 1/3;
|
var shrink = 1/3;
|
||||||
var $document = $(document);
|
var $document = $(document);
|
||||||
|
var $html = $('html');
|
||||||
var $selectionRect = $('<div id="selection-rect"/>');
|
var $selectionRect = $('<div id="selection-rect"/>');
|
||||||
|
|
||||||
|
|
||||||
@@ -56,17 +57,22 @@ modulejs.define('ext/select', ['_', '$', 'core/settings', 'core/resource', 'core
|
|||||||
|
|
||||||
function selectionUpdate(ev) {
|
function selectionUpdate(ev) {
|
||||||
|
|
||||||
|
l = Math.min(x, ev.pageX);
|
||||||
|
t = Math.min(y, ev.pageY);
|
||||||
|
w = Math.abs(x - ev.pageX);
|
||||||
|
h = Math.abs(y - ev.pageY);
|
||||||
|
|
||||||
|
if (!isDragSelect && w < 4 && h < 4) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!isDragSelect && !isCtrlPressed) {
|
if (!isDragSelect && !isCtrlPressed) {
|
||||||
$('#items .item').removeClass('selected');
|
$('#items .item').removeClass('selected');
|
||||||
publish();
|
publish();
|
||||||
}
|
}
|
||||||
|
|
||||||
isDragSelect = true;
|
isDragSelect = true;
|
||||||
|
$html.addClass('drag-select');
|
||||||
l = Math.min(x, ev.pageX);
|
|
||||||
t = Math.min(y, ev.pageY);
|
|
||||||
w = Math.abs(x - ev.pageX);
|
|
||||||
h = Math.abs(y - ev.pageY);
|
|
||||||
|
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
$selectionRect
|
$selectionRect
|
||||||
@@ -99,6 +105,7 @@ modulejs.define('ext/select', ['_', '$', 'core/settings', 'core/resource', 'core
|
|||||||
$('#items .item.selecting').removeClass('selecting').addClass('selected');
|
$('#items .item.selecting').removeClass('selecting').addClass('selected');
|
||||||
publish();
|
publish();
|
||||||
|
|
||||||
|
$html.removeClass('drag-select');
|
||||||
$selectionRect
|
$selectionRect
|
||||||
.stop(true, true)
|
.stop(true, true)
|
||||||
.animate(
|
.animate(
|
||||||
|
Reference in New Issue
Block a user