Skip to content

Commit

Permalink
Merge pull request #3270 from wowsims/apl
Browse files Browse the repository at this point in the history
Fix multiple UI bugs with APL
  • Loading branch information
jimmyt857 committed Jul 8, 2023
2 parents 13646a9 + c7ebca3 commit 99f29f7
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 24 deletions.
6 changes: 2 additions & 4 deletions ui/core/components/individual_sim_ui/apl_rotation_picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,8 @@ class APLListItemPicker extends Input<Player<any>, APLListItem> {
}

constructor(parent: HTMLElement, player: Player<any>, config: ListItemPickerConfig<Player<any>, APLListItem>, index: number) {
super(parent, 'apl-list-item-picker-root', player, {
...config,
enableWhen: () => !this.getItem().hide,
});
config.enableWhen = () => !this.getItem().hide;
super(parent, 'apl-list-item-picker-root', player, config);
this.player = player;
this.index = index;

Expand Down
6 changes: 3 additions & 3 deletions ui/core/components/individual_sim_ui/rotation_tab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,13 @@ export class RotationTab extends SimTab {
header: {title: 'Saved Rotations'},
storageKey: this.simUI.getSavedRotationStorageKey(),
getData: (player: Player<any>) => SavedRotation.create({
rotation: player.aplRotation,
rotation: APLRotation.clone(player.aplRotation),
specRotationOptionsJson: JSON.stringify(player.specTypeFunctions.rotationToJson(player.getRotation())),
cooldowns: player.getCooldowns(),
}),
setData: (eventID: EventID, player: Player<any>, newRotation: SavedRotation) => {
TypedEvent.freezeAllAndDo(() => {
player.aplRotation = newRotation.rotation || APLRotation.create();
player.setAplRotation(eventID, newRotation.rotation || APLRotation.create());
if (newRotation.specRotationOptionsJson) {
try {
const json = JSON.parse(newRotation.specRotationOptionsJson);
Expand Down Expand Up @@ -209,5 +209,5 @@ export class RotationTab extends SimTab {
});
});
});
}
}
}
17 changes: 10 additions & 7 deletions ui/core/components/individual_sim_ui/settings_tab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,8 @@ export class SettingsTab extends SimTab {
debuffs: simUI.sim.raid.getDebuffs(),
consumes: player.getConsumes(),
race: player.getRace(),
cooldowns: player.getCooldowns(),
rotationJson: JSON.stringify(player.specTypeFunctions.rotationToJson(player.getRotation())),
cooldowns: aplLaunchStatuses[simUI.player.spec] == LaunchStatus.Unlaunched ? player.getCooldowns() : undefined,
rotationJson: aplLaunchStatuses[simUI.player.spec] == LaunchStatus.Unlaunched ? JSON.stringify(player.specTypeFunctions.rotationToJson(player.getRotation())) : undefined,
});
},
setData: (eventID: EventID, simUI: IndividualSimUI<any>, newSettings: SavedSettings) => {
Expand All @@ -407,9 +407,11 @@ export class SettingsTab extends SimTab {
simUI.player.setBuffs(eventID, newSettings.playerBuffs || IndividualBuffs.create());
simUI.player.setConsumes(eventID, newSettings.consumes || Consumes.create());
simUI.player.setRace(eventID, newSettings.race);
simUI.player.setCooldowns(eventID, newSettings.cooldowns || Cooldowns.create());
if (newSettings.rotationJson) {
simUI.player.setRotation(eventID, simUI.player.specTypeFunctions.rotationFromJson(JSON.parse(newSettings.rotationJson)));
if (aplLaunchStatuses[simUI.player.spec] == LaunchStatus.Unlaunched) {
simUI.player.setCooldowns(eventID, newSettings.cooldowns || Cooldowns.create());
if (newSettings.rotationJson) {
simUI.player.setRotation(eventID, simUI.player.specTypeFunctions.rotationFromJson(JSON.parse(newSettings.rotationJson)));
}
}
});
},
Expand All @@ -420,9 +422,10 @@ export class SettingsTab extends SimTab {
this.simUI.player.buffsChangeEmitter,
this.simUI.player.consumesChangeEmitter,
this.simUI.player.raceChangeEmitter,
].concat(aplLaunchStatuses[this.simUI.player.spec] == LaunchStatus.Unlaunched ? [
this.simUI.player.cooldownsChangeEmitter,
this.simUI.player.rotationChangeEmitter,
],
] : []),
equals: (a: SavedSettings, b: SavedSettings) => SavedSettings.equals(a, b),
toJson: (a: SavedSettings) => SavedSettings.toJson(a),
fromJson: (obj: any) => SavedSettings.fromJson(obj),
Expand All @@ -432,7 +435,7 @@ export class SettingsTab extends SimTab {
savedEncounterManager.loadUserData();
savedSettingsManager.loadUserData();
});
}
}

private configureInputSection(sectionElem: HTMLElement, sectionConfig: InputSection) {
sectionConfig.inputs.forEach(inputConfig => {
Expand Down
2 changes: 1 addition & 1 deletion ui/core/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ export class Player<SpecType extends Spec> {
if (APLRotation.equals(newRotation, this.aplRotation))
return;

this.aplRotation = newRotation;
this.aplRotation = APLRotation.clone(newRotation);
this.rotationChangeEmitter.emit(eventID);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@import "./apl_helpers";

.apl-rotation-picker-root {
.input-root.apl-list-item-picker {
.apl-list-item-picker {
flex-wrap: wrap;
align-items: flex-start !important;

Expand All @@ -13,15 +13,20 @@
border: 0;
}

.list-picker-items {
width: unset;
}

.list-picker-new-button {
width: 100%;
}
}

.apl-list-item-picker > * > .list-picker-item-container {
background-color: rgba(21, 23, 30, 0.8);
padding: 5px;
}

.apl-list-item-picker > * > * > .list-picker-item {
flex-grow: 1;
}

.adaptive-string-picker-root > input {
text-align: center;
}
Expand Down Expand Up @@ -76,10 +81,6 @@
}
}

.apl-list-item-picker > * > * > .list-picker-item {
flex-grow: 1;
}

.apl-action-picker-action {
display: flex;
flex-direction: row;
Expand Down

0 comments on commit 99f29f7

Please sign in to comment.