Skip to content

Commit ad8cd91

Browse files
committed
Increase drag sensitivity for multi-selecting cube faces (#3322)
1 parent 55f7692 commit ad8cd91

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

js/uv/uv.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { editUVSizeDialog } from "./uv_size";
22
import { PointerTarget } from "../interface/pointer_target";
3+
import { dragHelper } from "../util/drag_helper";
34

45
// Image manipulation helpers for UV+texture transforms
56
function flipImageDataH(imageData) {
@@ -3366,14 +3367,17 @@ Interface.definePanels(function() {
33663367
}
33673368
let add_to_list = event.shiftKey || event.ctrlOrCmd || Pressing.overrides.shift || Pressing.overrides.ctrl;
33683369
if (keep_selection && selected_faces.includes(key)) {
3370+
console.log(1)
33693371

33703372
} else if (add_to_list) {
3373+
console.log(2)
33713374
if (selected_faces.includes(key)) {
33723375
selected_faces.remove(key);
33733376
} else {
33743377
selected_faces.push(key);
33753378
}
33763379
} else {
3380+
console.log(3)
33773381
selected_faces.replace([key]);
33783382
}
33793383
if (!element && key) {
@@ -3398,9 +3402,13 @@ Interface.definePanels(function() {
33983402
UVEditor.updateFaceSelection();
33993403

34003404
if (support_dragging) {
3401-
function drag(e1) {
3402-
if (e1.target && e1.target.nodeName == 'LI' && e1.target.parentElement.id == 'uv_cube_face_bar') {
3403-
let fkey = e1.target.attributes.face.value;
3405+
dragHelper(event, {
3406+
start_distance: 10,
3407+
onMove(arg) {
3408+
let e1 = arg.event;
3409+
if (!e1.target || e1.target.nodeName != 'LI' || e1.target.parentElement.id != 'uv_cube_face_bar') return;
3410+
let fkey = e1.target.attributes.face?.value;
3411+
if (!fkey) return;
34043412
for (let element of UVEditor.getMappableElements()) {
34053413
if (element.faces[fkey]) {
34063414
let selected_faces = UVEditor.getSelectedFaces(element, true);
@@ -3411,13 +3419,7 @@ Interface.definePanels(function() {
34113419
UVEditor.displayTools();
34123420
UVEditor.updateFaceSelection();
34133421
}
3414-
}
3415-
function stop() {
3416-
removeEventListeners(document, 'mousemove touchmove', drag);
3417-
removeEventListeners(document, 'mouseup touchend', stop);
3418-
}
3419-
addEventListeners(document, 'mousemove touchmove', drag);
3420-
addEventListeners(document, 'mouseup touchend', stop);
3422+
})
34213423
}
34223424
},
34233425
selectCube(cube, event) {

types/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "blockbench-types",
3-
"version": "5.1.0-beta.2-next.2",
3+
"version": "5.1.0-beta.3-next.0",
44
"description": "Blockbench typescript types",
55
"main": "",
66
"types": "./index.d.ts",

0 commit comments

Comments
 (0)