Skip to content

Commit 59bb319

Browse files
committed
🐛 Update group deselection logic for Blockbench 4.12.0
1 parent 06f6c55 commit 59bb319

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
@@ -143,9 +143,8 @@ export class BlockDisplay extends ResizableOutlinerElement {
143143
}
144144

145145
select() {
146-
if (Group.first_selected) {
147-
Group.first_selected.unselect()
148-
}
146+
Group.all.forEachReverse(el => el.unselect())
147+
149148
if (!Pressing.ctrl && !Pressing.shift) {
150149
if (Cube.selected.length) {
151150
Cube.selected.forEachReverse(el => el.unselect())
@@ -426,7 +425,7 @@ export const CREATE_ACTION = createAction(`${PACKAGE.name}:create_block_display`
426425
}
427426

428427
selected.forEachReverse(el => el.unselect())
429-
Group.first_selected && Group.first_selected.unselect()
428+
Group.all.forEachReverse(el => el.unselect())
430429
vanillaBlockDisplay.select()
431430

432431
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
@@ -152,9 +152,8 @@ export class ItemDisplay extends ResizableOutlinerElement {
152152
}
153153

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

428427
selected.forEachReverse(el => el.unselect())
429-
Group.first_selected && Group.first_selected.unselect()
428+
Group.all.forEachReverse(el => el.unselect())
430429
vanillaItemDisplay.select()
431430

432431
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)