Skip to content

Commit

Permalink
Add center handle to draggable box
Browse files Browse the repository at this point in the history
  • Loading branch information
mbloch committed Mar 1, 2024
1 parent f6e5633 commit 8c6d7ea
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/gui/gui-highlight-box.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,17 @@ export function HighlightBox(gui, optsArg) {
var scale = gui.map.getExtent().getPixelSize();
var dx = (xy.x - prevXY.x) * scale;
var dy = -(xy.y - prevXY.y) * scale;
if (activeHandle.col == 'left') {
var center = activeHandle.col == 'center' && activeHandle.row == 'center';
if (activeHandle.col == 'left' || center) {
boxCoords[0] += dx;
} else if (activeHandle.col == 'right') {
}
if (activeHandle.col == 'right' || center) {
boxCoords[2] += dx;
}
if (activeHandle.row == 'top') {
if (activeHandle.row == 'top' || center) {
boxCoords[3] += dy;
} else if (activeHandle.row == 'bottom') {
}
if (activeHandle.row == 'bottom' || center) {
boxCoords[1] += dy;
}
prevXY = xy;
Expand Down Expand Up @@ -178,7 +181,7 @@ function fixBounds(bbox) {
function initHandles(el) {
var handles = [];
for (var i=0; i<9; i++) {
if (i == 4) continue;
// if (i == 4) continue; // skip middle handle
var c = Math.floor(i / 3);
var r = i % 3;
handles.push({
Expand Down

0 comments on commit 8c6d7ea

Please sign in to comment.