Skip to content

Commit 39a48ad

Browse files
committed
🐛 Update group deselection logic for Blockbench 4.12.0
1 parent 1b4d36b commit 39a48ad

File tree

3 files changed

+10
-14
lines changed

3 files changed

+10
-14
lines changed

src/blockbench-additions/outliner-elements/blockDisplay.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,8 @@ export class BlockDisplay extends ResizableOutlinerElement {
154154
}
155155

156156
select() {
157-
if (Group.first_selected) {
158-
Group.first_selected.unselect()
159-
}
157+
Group.all.forEachReverse(el => el.unselect())
158+
160159
if (!Pressing.ctrl && !Pressing.shift) {
161160
if (Cube.selected.length) {
162161
Cube.selected.forEachReverse(el => el.unselect())
@@ -437,7 +436,7 @@ export const CREATE_ACTION = createAction(`${PACKAGE.name}:create_block_display`
437436
}
438437

439438
selected.forEachReverse(el => el.unselect())
440-
Group.first_selected && Group.first_selected.unselect()
439+
Group.all.forEachReverse(el => el.unselect())
441440
vanillaBlockDisplay.select()
442441

443442
Undo.finishEdit('Create Vanilla Block Display', {

src/blockbench-additions/outliner-elements/itemDisplay.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,8 @@ export class ItemDisplay extends ResizableOutlinerElement {
151151
}
152152

153153
select() {
154-
if (Group.first_selected) {
155-
Group.first_selected.unselect()
156-
}
154+
Group.all.forEachReverse(el => el.unselect())
155+
157156
if (!Pressing.ctrl && !Pressing.shift) {
158157
if (Cube.selected.length) {
159158
Cube.selected.forEachReverse(el => el.unselect())
@@ -425,7 +424,7 @@ export const CREATE_ACTION = createAction(`${PACKAGE.name}:create_item_display`,
425424
}
426425

427426
selected.forEachReverse(el => el.unselect())
428-
Group.first_selected && Group.first_selected.unselect()
427+
Group.all.forEachReverse(el => el.unselect())
429428
vanillaItemDisplay.select()
430429

431430
Undo.finishEdit('Create Vanilla Item Display', {

src/blockbench-additions/outliner-elements/textDisplay.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,7 @@ export class TextDisplay extends ResizableOutlinerElement {
209209
}
210210

211211
select() {
212-
if (Group.first_selected) {
213-
Group.first_selected.unselect()
214-
}
212+
Group.all.forEachReverse(el => el.unselect())
215213

216214
if (!Pressing.ctrl && !Pressing.shift) {
217215
if (Cube.selected.length) {
@@ -544,13 +542,13 @@ export const CREATE_ACTION = createAction(`${PACKAGE.name}:create_text_display`,
544542
textDisplay.extend({ position: group.origin.slice() as ArrayVector3 })
545543
}
546544

547-
textDisplay.forEachReverse(el => el.unselect())
548-
Group.first_selected && Group.first_selected.unselect()
545+
selected.forEachReverse(el => el.unselect())
546+
Group.all.forEachReverse(el => el.unselect())
549547
textDisplay.select()
550548

551549
Undo.finishEdit('Create Text Display', {
552550
outliner: true,
553-
elements: textDisplay,
551+
elements: selected,
554552
selection: true,
555553
})
556554

0 commit comments

Comments
 (0)