Conditionals fixes and tweaks

- Fixes #2772;
- Remove styling toolbar icons in Display Layouts;
- Fix regression error in tree items that was only allowing clicks on
the name to navigate;
This commit is contained in:
charlesh88 2020-03-25 11:12:54 -07:00
parent 07d101ac1c
commit 7f49a7bc99
2 changed files with 3 additions and 106 deletions

View File

@ -347,62 +347,6 @@ define(['lodash'], function (_) {
}; };
} }
function getFillMenu(selectedParent, selection) {
return {
control: "color-picker",
domainObject: selectedParent,
applicableSelectedItems: selection.filter(selectionPath => {
let type = selectionPath[0].context.layoutItem.type;
return type === 'text-view' ||
type === 'telemetry-view' ||
type === 'box-view';
}),
property: function (selectionPath) {
return getPath(selectionPath) + ".fill";
},
icon: "icon-paint-bucket",
title: "Set fill color"
};
}
function getStrokeMenu(selectedParent, selection) {
return {
control: "color-picker",
domainObject: selectedParent,
applicableSelectedItems: selection.filter(selectionPath => {
let type = selectionPath[0].context.layoutItem.type;
return type === 'text-view' ||
type === 'telemetry-view' ||
type === 'box-view' ||
type === 'image-view' ||
type === 'line-view';
}),
property: function (selectionPath) {
return getPath(selectionPath) + ".stroke";
},
icon: "icon-line-horz",
title: "Set border color"
};
}
function getTextColorMenu(selectedParent, selection) {
return {
control: "color-picker",
domainObject: selectedParent,
applicableSelectedItems: selection.filter(selectionPath => {
let type = selectionPath[0].context.layoutItem.type;
return type === 'text-view' || type === 'telemetry-view';
}),
property: function (selectionPath) {
return getPath(selectionPath) + ".color";
},
icon: "icon-font",
mandatory: true,
title: "Set text color",
preventNone: true
};
}
function getURLButton(selectedParent, selection) { function getURLButton(selectedParent, selection) {
return { return {
control: "button", control: "button",
@ -429,7 +373,7 @@ define(['lodash'], function (_) {
property: function (selectionPath) { property: function (selectionPath) {
return getPath(selectionPath); return getPath(selectionPath);
}, },
icon: "icon-gear", icon: "icon-font",
title: "Edit text properties", title: "Edit text properties",
dialog: DIALOG_FORM.text dialog: DIALOG_FORM.text
}; };
@ -505,14 +449,14 @@ define(['lodash'], function (_) {
let toolbar = { let toolbar = {
'add-menu': [], 'add-menu': [],
'text': [],
'url': [],
'toggle-frame': [], 'toggle-frame': [],
'display-mode': [], 'display-mode': [],
'telemetry-value': [], 'telemetry-value': [],
'style': [], 'style': [],
'text-style': [], 'text-style': [],
'position': [], 'position': [],
'text': [],
'url': [],
'remove': [] 'remove': []
}; };
@ -546,15 +490,8 @@ define(['lodash'], function (_) {
if (toolbar['telemetry-value'].length === 0) { if (toolbar['telemetry-value'].length === 0) {
toolbar['telemetry-value'] = [getTelemetryValueMenu(selectionPath, selectedObjects)]; toolbar['telemetry-value'] = [getTelemetryValueMenu(selectionPath, selectedObjects)];
} }
if (toolbar.style.length < 2) {
toolbar.style = [
getFillMenu(selectedParent, selectedObjects),
getStrokeMenu(selectedParent, selectedObjects)
];
}
if (toolbar['text-style'].length === 0) { if (toolbar['text-style'].length === 0) {
toolbar['text-style'] = [ toolbar['text-style'] = [
getTextColorMenu(selectedParent, selectedObjects),
getTextSizeMenu(selectedParent, selectedObjects) getTextSizeMenu(selectedParent, selectedObjects)
]; ];
} }
@ -571,15 +508,8 @@ define(['lodash'], function (_) {
toolbar.remove = [getRemoveButton(selectedParent, selectionPath, selectedObjects)]; toolbar.remove = [getRemoveButton(selectedParent, selectionPath, selectedObjects)];
} }
} else if (layoutItem.type === 'text-view') { } else if (layoutItem.type === 'text-view') {
if (toolbar.style.length < 2) {
toolbar.style = [
getFillMenu(selectedParent, selectedObjects),
getStrokeMenu(selectedParent, selectedObjects)
];
}
if (toolbar['text-style'].length === 0) { if (toolbar['text-style'].length === 0) {
toolbar['text-style'] = [ toolbar['text-style'] = [
getTextColorMenu(selectedParent, selectedObjects),
getTextSizeMenu(selectedParent, selectedObjects) getTextSizeMenu(selectedParent, selectedObjects)
]; ];
} }
@ -599,12 +529,6 @@ define(['lodash'], function (_) {
toolbar.remove = [getRemoveButton(selectedParent, selectionPath, selectedObjects)]; toolbar.remove = [getRemoveButton(selectedParent, selectionPath, selectedObjects)];
} }
} else if (layoutItem.type === 'box-view') { } else if (layoutItem.type === 'box-view') {
if (toolbar.style.length < 2) {
toolbar.style = [
getFillMenu(selectedParent, selectedObjects),
getStrokeMenu(selectedParent, selectedObjects)
];
}
if (toolbar.position.length === 0) { if (toolbar.position.length === 0) {
toolbar.position = [ toolbar.position = [
getStackOrder(selectedParent, selectionPath), getStackOrder(selectedParent, selectionPath),
@ -618,11 +542,6 @@ define(['lodash'], function (_) {
toolbar.remove = [getRemoveButton(selectedParent, selectionPath, selectedObjects)]; toolbar.remove = [getRemoveButton(selectedParent, selectionPath, selectedObjects)];
} }
} else if (layoutItem.type === 'image-view') { } else if (layoutItem.type === 'image-view') {
if (toolbar.style.length === 0) {
toolbar.style = [
getStrokeMenu(selectedParent, selectedObjects)
];
}
if (toolbar.position.length === 0) { if (toolbar.position.length === 0) {
toolbar.position = [ toolbar.position = [
getStackOrder(selectedParent, selectionPath), getStackOrder(selectedParent, selectionPath),
@ -639,11 +558,6 @@ define(['lodash'], function (_) {
toolbar.remove = [getRemoveButton(selectedParent, selectionPath, selectedObjects)]; toolbar.remove = [getRemoveButton(selectedParent, selectionPath, selectedObjects)];
} }
} else if (layoutItem.type === 'line-view') { } else if (layoutItem.type === 'line-view') {
if (toolbar.style.length === 0) {
toolbar.style = [
getStrokeMenu(selectedParent, selectedObjects)
];
}
if (toolbar.position.length === 0) { if (toolbar.position.length === 0) {
toolbar.position = [ toolbar.position = [
getStackOrder(selectedParent, selectionPath), getStackOrder(selectedParent, selectionPath),

View File

@ -92,32 +92,15 @@
// Object labels in trees // Object labels in trees
&__label { &__label {
// <a> tag that holds type icon and name.
// Draggable element.
/*border-radius: $controlCr;
display: flex;
align-items: center;
flex: 1 1 auto; flex: 1 1 auto;
overflow: hidden;
padding: $aPad;
white-space: nowrap;*/
} }
&__name { &__name {
// @include ellipsize();
// display: inline;
color: $colorItemTreeFg; color: $colorItemTreeFg;
// width: 100%;
} }
&__type-icon { &__type-icon {
// Type icon. Must be an HTML entity to allow inclusion of alias indicator.
// display: block;
// flex: 0 0 auto;
// font-size: 1.3em;
// margin-right: $interiorMarginSm;
color: $colorItemTreeIcon; color: $colorItemTreeIcon;
// width: $treeTypeIconW;
} }
&.is-alias { &.is-alias {