Skip to content

Commit

Permalink
Code editor: update previous selection not current selection when upd…
Browse files Browse the repository at this point in the history
…ating from room editor
  • Loading branch information
icewolfz committed Jul 2, 2018
1 parent df2e9ec commit 6a03093
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- Update terrain color scale after using short customs +/- or when new descriptions added
- Fixed room editor/room preview breaking when no items
- Fixed removing northwest exit of connected room when room deleted or cut
- Fixed room edits when switching selected rooms, was updating new selection instead of previous
- Make diff navigation buttons visible but disabled when not in use as you can not hide the menu due to a limitation in election not allowing hiding of separators

## 0.4.53 2018-06-30
Expand Down
10 changes: 7 additions & 3 deletions src/common/editor/virtual.editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2526,13 +2526,13 @@ export class VirtualEditor extends EditorBase {
this.emit('browse-file', e);
});
this.$roomEditor.on('value-changed', (prop, newValue, oldValue) => {
const selected = this.$selectedRooms;
const selected = this.$roomEditor.objects;
let sl = selected.length;
const first = selected[0];
items:
while (sl--) {
const old = selected[sl].clone();
const curr = selected[sl];
const old = this.getRoom(curr.x, curr.y, curr.z);
let data;
switch (prop) {
case 'external':
Expand Down Expand Up @@ -2616,11 +2616,15 @@ export class VirtualEditor extends EditorBase {
else //else just redraw the current room
this.DrawRoom(this.$mapContext, curr, true, curr.at(this.$mouse.rx, this.$mouse.ry));
this.RoomChanged(curr, old, true);
if (curr.item === newValue)
old.item = newValue;
old[prop] = newValue;
break;
default:
curr[prop] = newValue;
this.DrawRoom(this.$mapContext, curr, true, curr.at(this.$mouse.rx, this.$mouse.ry));
this.RoomChanged(curr, old, true);
old[prop] = newValue;
break;
}
}
Expand Down Expand Up @@ -2878,7 +2882,7 @@ export class VirtualEditor extends EditorBase {
}

private formatExternal(prop, value, data) {
if (!data) return 'None';
if (!data || data.length === 0) return 'None';
const ee = data[0].ee;
if (ee === 0)
return 'None';
Expand Down

0 comments on commit 6a03093

Please sign in to comment.