private moveWhole(point: Point): void {
const snapshot = this.dragStateSnapshot;
if (!snapshot || !this.dragStartPoint) {
return;
}
if (
snapshot.startTime === null ||
snapshot.endTime === null ||
snapshot.startPrice === null ||
snapshot.endPrice === null
) {
return;
}
const offsetX = point.x - this.dragStartPoint.x;
const offsetY = point.y - this.dragStartPoint.y;
const nextStartTime = this.shiftTime(snapshot.startTime, offsetX);
const nextEndTime = this.shiftTime(snapshot.endTime, offsetX);
if (nextStartTime === null || nextEndTime === null) {
return;
}
const priceOffset = this.getPriceDelta(this.dragStartPoint.y, this.dragStartPoint.y + offsetY);
this.startTime = nextStartTime;
this.endTime = nextEndTime;
this.startPrice = snapshot.startPrice + priceOffset;
this.endPrice = snapshot.endPrice + priceOffset;
}