Skip to content

Commit

Permalink
fix: improve behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
oterral committed Oct 14, 2024
1 parent b11ade5 commit 6f6c554
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@
showSnapPoints: true,
showSnapLines: false,
});
// cad.updateDialog();
}
});

Expand Down Expand Up @@ -227,7 +226,7 @@
if (!cad.getActive()) {
cad.activate();
}
} else if (cad.getActive()) {
} else if (cad.getActive() && !draw.getActive() && !drawLine.getActive() && !drawPoly.getActive()) {
cad.deactivate();
}
});
Expand All @@ -241,13 +240,32 @@
});
});

modify.moveInteraction.on('movestart', function () {
const features = modify.selectMove.getFeatures();
const length = features?.getLength();
const firstFeature = features?.item(0);
if (length > 1 || firstFeature?.getGeometry()?.getType() !== 'Point') {
return;
}
cad.setProperties({
showSnapPoints: true,
showSnapLines: false,
});
cad.activate();
});

modify.moveInteraction.on('moveend', function () {
cad.deactivate();
});

modify.modifyInteraction.on('modifystart', function () {
cad.setProperties({
showSnapPoints: false,
showSnapLines: true,
});
cad.activate();
});

modify.modifyInteraction.on('modifyend', function () {
cad.deactivate();
});
Expand Down

0 comments on commit 6f6c554

Please sign in to comment.