Skip to content

Commit

Permalink
fix: remove wrong fix code
Browse files Browse the repository at this point in the history
  • Loading branch information
Kim716 committed Jun 27, 2024
1 parent 60ef523 commit 8d1b12e
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions packages/perseus/src/util/interactive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,7 @@ _.extend(GraphUtils.Graphie.prototype, {
},
options,
);

const initialX = movablePoint.coord[0];
let isInitial = true;

Expand Down Expand Up @@ -670,17 +671,9 @@ _.extend(GraphUtils.Graphie.prototype, {

// snap coordinates to grid
if (movablePoint.snapX !== 0) {
// 讓座標是根據移動起始點去計算,而非從 0
coordX =
Math.round(
(coordX - movablePoint.start) / movablePoint.snapX,
) *
movablePoint.snapX +
movablePoint.start;

coordX = coordX > movablePoint.end ? movablePoint.end : coordX;
coordX =
coordX < movablePoint.start ? movablePoint.start : coordX;
Math.round(coordX / movablePoint.snapX) *
movablePoint.snapX;

// 即便點的初始位置不在可以拖動的路徑上,仍先可以放置於上面,避免使用者困惑,拖動後就只能放置在安排好的位置
if (isInitial) {
Expand Down

0 comments on commit 8d1b12e

Please sign in to comment.