Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 1349: Geometry Edit Freeze #1379

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions ui/src/draw/CesiumDraw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class CesiumDraw extends EventTarget {
private leftPressedPixel_: Cartesian2 | undefined;
private sketchPoints_: Entity[] = [];
private isDoubleClick = false;
private singleClickTimer;
private singleClickTimer: NodeJS.Timeout | null = null;
private segmentsInfo: SegmentInfo[] = [];
type: GeometryTypes | undefined;
julianDate = new JulianDate();
Expand Down Expand Up @@ -462,11 +462,17 @@ export class CesiumDraw extends EventTarget {
this.finishDrawing();
} else if (this.type === 'line') {
if (!this.isDoubleClick) {
this.singleClickTimer = setTimeout(() => {
this.isDoubleClick = false;
const prevPoint = Cartesian3.clone(this.activePoints_[this.activePoints_.length - 1]);
this.sketchPoints_.push(this.createSketchPoint_(prevPoint));
}, 250);
if (this.singleClickTimer) {
clearTimeout(this.singleClickTimer);
this.singleClickTimer = null;
} else {
this.singleClickTimer = setTimeout(() => {
this.isDoubleClick = false;
const prevPoint = Cartesian3.clone(this.activePoints_[this.activePoints_.length - 1]);
this.sketchPoints_.push(this.createSketchPoint_(prevPoint));
this.singleClickTimer = null;
}, 250);
}
}
}
}
Expand Down Expand Up @@ -616,7 +622,9 @@ export class CesiumDraw extends EventTarget {

onDoubleClick_() {
this.isDoubleClick = true;
clearTimeout(this.singleClickTimer);
if (this.singleClickTimer) {
clearTimeout(this.singleClickTimer);
}
if (!this.activeDistances_.includes(this.activeDistance_)) {
this.activeDistances_.push(this.activeDistance_);
}
Expand Down
Loading