Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve labels #687

Merged
merged 3 commits into from
Sep 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/phoenix-event-display/src/helpers/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ export const loadFile = (
};

inputFile.oninput = fileSelected;
inputFile.onchange = fileSelected;
// inputFile.onchange = fileSelected;
inputFile.click();
};
4 changes: 3 additions & 1 deletion packages/phoenix-event-display/src/loaders/phoenix-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,9 @@ export class PhoenixLoader implements EventDataLoader {
this.labelsObject[eventDataType][collection] || {};

this.labelsObject[eventDataType][collection][indexInCollection] = label;

const tmp =
this.eventData[eventDataType][collection][indexInCollection];
tmp.labelText = label;
return getLabelTitle(eventDataType, collection, indexInCollection);
}
}
Expand Down
10 changes: 10 additions & 0 deletions packages/phoenix-event-display/src/managers/ui-manager/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -566,10 +566,20 @@ export class UIManager {
const labelsObject = eventDataLoader?.getLabelsObject();
if (eventDataLoader && labelsObject) {
loadFile((data) => {
console.log('UIManager: loading Labels');
const labelsObject = JSON.parse(data);
// This contains the names of the labels, but not their colours.
for (const eventDataType of Object.keys(labelsObject)) {
for (const collection of Object.keys(labelsObject[eventDataType])) {
const collectionObject = eventDataLoader.getCollection(collection);
if (!collectionObject) {
console.log(
'WARNING - cannot find ',
collection,
' in eventDataLoader. Skipping.',
);
continue;
}
for (const labelIndex of Object.keys(
labelsObject[eventDataType][collection],
)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,12 @@ export class PhoenixMenuNode {
// Apply configs of different config types - manual
if (config.type === 'checkbox' && config?.['isChecked']) {
config.onChange?.(config?.['isChecked']);
} else if (
config.type === 'color' &&
config?.['color'] &&
config.group !== undefined
) {
// Ignore color by options with `!config.group`, otherwise the collection color is overridden
config.onChange?.(config?.['color']);
} else if (config.type === 'color' && config?.['color']) {
if (config.group !== undefined || this.name === 'Labels') {
// Ignore color by options with `!config.group`, otherwise the collection color is overridden
// Exception for Labels node, which should always have color applied
config.onChange?.(config?.['color']);
}
} else if (config.type === 'slider' && config?.['value']) {
config.onChange?.(config?.['value']);
} else if (
Expand Down Expand Up @@ -216,8 +215,6 @@ export class PhoenixMenuNode {
nodeConfig.type === configState['type'] &&
nodeConfig.label === configState['label'],
);
// configs: PhoenixMenuConfigs[keyof PhoenixMenuConfigs][] = [];

if (nodeConfigs.length > 1) {
console.error(
'Multiple configs found with same label and type in phoenix menu node.',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
<input
class="form-control form-control-sm"
type="text"
value="{{ object.labelText }}"
[id]="'label' + i"
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class CollectionsInfoOverlayComponent implements OnInit {
}));

this.collectionColumns = Object.keys(this.showingCollection[0]).filter(
(column) => !['uuid', 'hits', 'isCut'].includes(column), // FIXME - this is an ugly hack. But currently hits from tracks make track collections unusable. Better to have exlusion list passed in.
(column) => !['uuid', 'hits', 'isCut', 'labelText'].includes(column), // FIXME - this is an ugly hack. But currently hits from tracks make track collections unusable. Better to have exlusion list passed in.
);
}

Expand Down
Loading