Display Layout toolbar refinements for units (#5197)

* Fixes #3197
- Moved position of hide/show units toggle button.
- Added labels to many toolbar buttons, including hide/show units, hide/show frame, edit text, more.
- Added label to toolbar-toggle-button.vue.
- Added separator between stackOrder button and position inputs.

* Fixes #3197
- Removed unwanted margin in alphanumerics when label is hidden.

Co-authored-by: Shefali Joshi <simplyrender@gmail.com>
This commit is contained in:
Charles Hacskaylo
2022-06-03 09:53:21 -07:00
committed by GitHub
parent 40a7451064
commit 1c525f50c8
4 changed files with 40 additions and 22 deletions

View File

@ -211,13 +211,15 @@ define(['lodash'], function (_) {
options: [ options: [
{ {
value: false, value: false,
icon: 'icon-frame-show', icon: 'icon-frame-hide',
title: "Frame visible" title: "Frame visible",
label: 'Hide frame'
}, },
{ {
value: true, value: true,
icon: 'icon-frame-hide', icon: 'icon-frame-show',
title: "Frame hidden" title: "Frame hidden",
label: 'Show frame'
} }
] ]
}; };
@ -401,6 +403,7 @@ define(['lodash'], function (_) {
}, },
icon: "icon-pencil", icon: "icon-pencil",
title: "Edit text properties", title: "Edit text properties",
label: "Edit text",
dialog: DIALOG_FORM.text dialog: DIALOG_FORM.text
}; };
} }
@ -514,12 +517,14 @@ define(['lodash'], function (_) {
{ {
value: true, value: true,
icon: 'icon-eye-open', icon: 'icon-eye-open',
title: "Show units" title: "Show units",
label: "Show units"
}, },
{ {
value: false, value: false,
icon: 'icon-eye-disabled', icon: 'icon-eye-disabled',
title: "Hide units" title: "Hide units",
label: "Hide units"
} }
] ]
}; };
@ -562,6 +567,7 @@ define(['lodash'], function (_) {
domainObject: selectedParent, domainObject: selectedParent,
icon: "icon-object", icon: "icon-object",
title: "Switch the way this telemetry is displayed", title: "Switch the way this telemetry is displayed",
label: "View type",
options: viewOptions, options: viewOptions,
method: function (option) { method: function (option) {
displayLayoutContext.switchViewType(selectedItemContext, option.value, selection); displayLayoutContext.switchViewType(selectedItemContext, option.value, selection);
@ -662,9 +668,9 @@ define(['lodash'], function (_) {
'display-mode': [], 'display-mode': [],
'telemetry-value': [], 'telemetry-value': [],
'style': [], 'style': [],
'unit-toggle': [],
'position': [], 'position': [],
'duplicate': [], 'duplicate': [],
'unit-toggle': [],
'remove': [], 'remove': [],
'toggle-grid': [] 'toggle-grid': []
}; };
@ -689,6 +695,7 @@ define(['lodash'], function (_) {
if (toolbar.position.length === 0) { if (toolbar.position.length === 0) {
toolbar.position = [ toolbar.position = [
getStackOrder(selectedParent, selectionPath), getStackOrder(selectedParent, selectionPath),
getSeparator(),
getXInput(selectedParent, selectedObjects), getXInput(selectedParent, selectedObjects),
getYInput(selectedParent, selectedObjects), getYInput(selectedParent, selectedObjects),
getHeightInput(selectedParent, selectedObjects), getHeightInput(selectedParent, selectedObjects),
@ -712,9 +719,17 @@ define(['lodash'], function (_) {
toolbar['telemetry-value'] = [getTelemetryValueMenu(selectionPath, selectedObjects)]; toolbar['telemetry-value'] = [getTelemetryValueMenu(selectionPath, selectedObjects)];
} }
if (toolbar['unit-toggle'].length === 0) {
let toggleUnitsButton = getToggleUnitsButton(selectedParent, selectedObjects);
if (toggleUnitsButton) {
toolbar['unit-toggle'] = [toggleUnitsButton];
}
}
if (toolbar.position.length === 0) { if (toolbar.position.length === 0) {
toolbar.position = [ toolbar.position = [
getStackOrder(selectedParent, selectionPath), getStackOrder(selectedParent, selectionPath),
getSeparator(),
getXInput(selectedParent, selectedObjects), getXInput(selectedParent, selectedObjects),
getYInput(selectedParent, selectedObjects), getYInput(selectedParent, selectedObjects),
getHeightInput(selectedParent, selectedObjects), getHeightInput(selectedParent, selectedObjects),
@ -729,17 +744,11 @@ define(['lodash'], function (_) {
if (toolbar.viewSwitcher.length === 0) { if (toolbar.viewSwitcher.length === 0) {
toolbar.viewSwitcher = [getViewSwitcherMenu(selectedParent, selectionPath, selectedObjects)]; toolbar.viewSwitcher = [getViewSwitcherMenu(selectedParent, selectionPath, selectedObjects)];
} }
if (toolbar['unit-toggle'].length === 0) {
let toggleUnitsButton = getToggleUnitsButton(selectedParent, selectedObjects);
if (toggleUnitsButton) {
toolbar['unit-toggle'] = [toggleUnitsButton];
}
}
} else if (layoutItem.type === 'text-view') { } else if (layoutItem.type === 'text-view') {
if (toolbar.position.length === 0) { if (toolbar.position.length === 0) {
toolbar.position = [ toolbar.position = [
getStackOrder(selectedParent, selectionPath), getStackOrder(selectedParent, selectionPath),
getSeparator(),
getXInput(selectedParent, selectedObjects), getXInput(selectedParent, selectedObjects),
getYInput(selectedParent, selectedObjects), getYInput(selectedParent, selectedObjects),
getHeightInput(selectedParent, selectedObjects), getHeightInput(selectedParent, selectedObjects),
@ -758,6 +767,7 @@ define(['lodash'], function (_) {
if (toolbar.position.length === 0) { if (toolbar.position.length === 0) {
toolbar.position = [ toolbar.position = [
getStackOrder(selectedParent, selectionPath), getStackOrder(selectedParent, selectionPath),
getSeparator(),
getXInput(selectedParent, selectedObjects), getXInput(selectedParent, selectedObjects),
getYInput(selectedParent, selectedObjects), getYInput(selectedParent, selectedObjects),
getHeightInput(selectedParent, selectedObjects), getHeightInput(selectedParent, selectedObjects),
@ -772,6 +782,7 @@ define(['lodash'], function (_) {
if (toolbar.position.length === 0) { if (toolbar.position.length === 0) {
toolbar.position = [ toolbar.position = [
getStackOrder(selectedParent, selectionPath), getStackOrder(selectedParent, selectionPath),
getSeparator(),
getXInput(selectedParent, selectedObjects), getXInput(selectedParent, selectedObjects),
getYInput(selectedParent, selectedObjects), getYInput(selectedParent, selectedObjects),
getHeightInput(selectedParent, selectedObjects), getHeightInput(selectedParent, selectedObjects),
@ -786,6 +797,7 @@ define(['lodash'], function (_) {
if (toolbar.position.length === 0) { if (toolbar.position.length === 0) {
toolbar.position = [ toolbar.position = [
getStackOrder(selectedParent, selectionPath), getStackOrder(selectedParent, selectionPath),
getSeparator(),
getXInput(selectedParent, selectedObjects), getXInput(selectedParent, selectedObjects),
getYInput(selectedParent, selectedObjects), getYInput(selectedParent, selectedObjects),
getX2Input(selectedParent, selectedObjects), getX2Input(selectedParent, selectedObjects),

View File

@ -17,14 +17,14 @@
} }
} }
> * + * {
margin-left: $interiorMargin;
}
&__value { &__value {
@include isLimit(); @include isLimit();
} }
&__label {
margin-right: $interiorMargin;
}
.c-frame & { .c-frame & {
@include abs(); @include abs();
border: 1px solid transparent; border: 1px solid transparent;

View File

@ -351,7 +351,7 @@ describe('the plugin', function () {
it('provides controls including separators', () => { it('provides controls including separators', () => {
const displayLayoutToolbar = openmct.toolbars.get(selection); const displayLayoutToolbar = openmct.toolbars.get(selection);
expect(displayLayoutToolbar.length).toBe(7); expect(displayLayoutToolbar.length).toBe(8);
}); });
}); });
}); });

View File

@ -5,9 +5,15 @@
:title="nextValue.title" :title="nextValue.title"
:class="[nextValue.icon, {'c-icon-button--mixed': nonSpecific}]" :class="[nextValue.icon, {'c-icon-button--mixed': nonSpecific}]"
@click="cycle" @click="cycle"
></div> >
</div> <div
</template> v-if="nextValue.label"
class="c-icon-button__label"
>
{{ nextValue.label }}
</div>
</div>
</div></template>
<script> <script>
export default { export default {