Skip to content

Commit

Permalink
ドラッグ後の座標に電荷があると、選択解除イベントが走らないバグを修正
Browse files Browse the repository at this point in the history
  • Loading branch information
CaseyNelson314 committed Jan 22, 2024
1 parent 885bc14 commit dcacb1c
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions app/script/dragger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,23 @@ export class Dragger {

if (intersects.length > 0) {

// オブジェクトを選択
this.selected = intersects[0]!.object as Charge;
const object = intersects[0]!.object as Charge;

if (object !== this.transControls.object) {

// 既に選択されているオブジェクトがあれば選択を解除
if (this.selected !== null) {
this.transControls.detach();
for (let listener of this.listeners) {
if (listener.type === 'object-unselected') {
listener.listener();
}
}
}

// オブジェクトを選択
this.selected = object;

if (this.selected !== this.transControls.object) {
this.transControls.attach(this.selected);

// オブジェクトが選択されたことを通知
Expand Down Expand Up @@ -109,6 +122,7 @@ export class Dragger {

}
});

}

// 選択されているオブジェクトを取得
Expand Down

0 comments on commit dcacb1c

Please sign in to comment.