aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/button/FontIconBox.tsx
diff options
context:
space:
mode:
authorJames Hu <51237606+jameshu111@users.noreply.github.com>2023-05-04 10:36:59 -0400
committerJames Hu <51237606+jameshu111@users.noreply.github.com>2023-05-04 10:36:59 -0400
commit725bf38dc018cb218d8a88605234e95a2beee446 (patch)
tree9150905cf1b67b06c03fdd8d10ac6da6e8246832 /src/client/views/nodes/button/FontIconBox.tsx
parent96465f2dccc974a821fa912c90def988b76808e5 (diff)
parent1c24114bbe8f69f61948f7531277305457926498 (diff)
Merge branch 'master' into james-server-stats
Diffstat (limited to 'src/client/views/nodes/button/FontIconBox.tsx')
-rw-r--r--src/client/views/nodes/button/FontIconBox.tsx30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/client/views/nodes/button/FontIconBox.tsx b/src/client/views/nodes/button/FontIconBox.tsx
index 1a75a7e76..f04678d8b 100644
--- a/src/client/views/nodes/button/FontIconBox.tsx
+++ b/src/client/views/nodes/button/FontIconBox.tsx
@@ -62,6 +62,7 @@ export class FontIconBox extends DocComponent<ButtonProps>() {
public static LayoutString(fieldKey: string) {
return FieldView.LayoutString(FontIconBox, fieldKey);
}
+ @observable noTooltip = false;
showTemplate = (): void => {
const dragFactory = Cast(this.layoutDoc.dragFactory, Doc, null);
dragFactory && this.props.addDocTab(dragFactory, OpenWhere.addRight);
@@ -166,6 +167,7 @@ export class FontIconBox extends DocComponent<ButtonProps>() {
onPointerDown={e => e.stopPropagation()}
onClick={action(() => {
this.rootDoc.dropDownOpen = !this.rootDoc.dropDownOpen;
+ this.noTooltip = this.rootDoc.dropDownOpen;
Doc.UnBrushAllDocs();
})}>
{checkResult}
@@ -206,6 +208,7 @@ export class FontIconBox extends DocComponent<ButtonProps>() {
}}
onClick={action(() => {
this.rootDoc.dropDownOpen = !this.rootDoc.dropDownOpen;
+ this.noTooltip = this.rootDoc.dropDownOpen;
Doc.UnBrushAllDocs();
})}>
<input style={{ width: 30 }} className="button-input" type="number" value={checkResult} onChange={undoBatch(action(e => setValue(Number(e.target.value))))} />
@@ -224,6 +227,7 @@ export class FontIconBox extends DocComponent<ButtonProps>() {
onClick={e => {
e.stopPropagation();
this.rootDoc.dropDownOpen = false;
+ this.noTooltip = false;
Doc.UnBrushAllDocs();
}}
/>
@@ -249,6 +253,7 @@ export class FontIconBox extends DocComponent<ButtonProps>() {
style={{ color: color, backgroundColor: backgroundColor, borderBottomLeftRadius: this.dropdown ? 0 : undefined }}
onClick={action(() => {
this.rootDoc.dropDownOpen = !this.rootDoc.dropDownOpen;
+ this.noTooltip = this.rootDoc.dropDownOpen;
Doc.UnBrushAllDocs();
})}>
{this.Icon(color)}
@@ -333,6 +338,7 @@ export class FontIconBox extends DocComponent<ButtonProps>() {
dropdown
? () => {
this.rootDoc.dropDownOpen = !this.rootDoc.dropDownOpen;
+ this.noTooltip = this.rootDoc.dropDownOpen;
Doc.UnBrushAllDocs();
}
: undefined
@@ -355,6 +361,7 @@ export class FontIconBox extends DocComponent<ButtonProps>() {
onClick={e => {
e.stopPropagation();
this.rootDoc.dropDownOpen = false;
+ this.noTooltip = false;
Doc.UnBrushAllDocs();
}}
/>
@@ -400,6 +407,7 @@ export class FontIconBox extends DocComponent<ButtonProps>() {
style={{ color: color, borderBottomLeftRadius: this.dropdown ? 0 : undefined }}
onClick={action(e => {
this.colorPickerClosed = !this.colorPickerClosed;
+ this.noTooltip = !this.colorPickerClosed;
setTimeout(() => Doc.UnBrushAllDocs());
e.stopPropagation();
})}
@@ -419,6 +427,7 @@ export class FontIconBox extends DocComponent<ButtonProps>() {
e.preventDefault();
e.stopPropagation();
this.colorPickerClosed = true;
+ this.noTooltip = false;
Doc.UnBrushAllDocs();
})}
/>
@@ -516,10 +525,10 @@ export class FontIconBox extends DocComponent<ButtonProps>() {
// prettier-ignore
switch (this.type) {
- case ButtonType.DropdownList: return this.dropdownListButton;
- case ButtonType.ColorButton: return this.colorButton;
- case ButtonType.NumberButton: return this.numberButton;
case ButtonType.EditableText: return this.editableText;
+ case ButtonType.DropdownList: button = this.dropdownListButton; break;
+ case ButtonType.ColorButton: button = this.colorButton; break;
+ case ButtonType.NumberButton: button = this.numberButton; break;
case ButtonType.DropdownButton: button = this.dropdownButton; break;
case ButtonType.ToggleButton: button = this.toggleButton; break;
case ButtonType.TextButton:
@@ -552,7 +561,7 @@ export class FontIconBox extends DocComponent<ButtonProps>() {
break;
}
- return !this.layoutDoc.toolTip ? button : <Tooltip title={<div className="dash-tooltip">{StrCast(this.layoutDoc.toolTip)}</div>}>{button}</Tooltip>;
+ return !this.layoutDoc.toolTip || this.noTooltip ? button : <Tooltip title={<div className="dash-tooltip">{StrCast(this.layoutDoc.toolTip)}</div>}>{button}</Tooltip>;
}
}
@@ -565,7 +574,12 @@ ScriptingGlobals.add(function setView(view: string) {
// toggle: Set overlay status of selected document
ScriptingGlobals.add(function setBackgroundColor(color?: string, checkResult?: boolean) {
const selectedViews = SelectionManager.Views();
- if (selectedViews.length) {
+ if (Doc.ActiveTool !== InkTool.None) {
+ if (checkResult) {
+ return ActiveFillColor();
+ }
+ SetActiveFillColor(color ?? 'transparent');
+ } else if (selectedViews.length) {
if (checkResult) {
const selView = selectedViews.lastElement();
const layoutFrameNumber = Cast(selView.props.docViewPath().lastElement()?.rootDoc?._currentFrame, 'number'); // frame number that container is at which determines layout frame values
@@ -610,16 +624,16 @@ ScriptingGlobals.add(function toggleOverlay(checkResult?: boolean) {
selected ? selected.props.CollectionFreeFormDocumentView?.().float() : console.log('[FontIconBox.tsx] toggleOverlay failed');
});
-ScriptingGlobals.add(function showFreeform(attr: 'grid' | 'snap lines' | 'clusters' | 'arrange' | 'viewAll', checkResult?: boolean) {
+ScriptingGlobals.add(function showFreeform(attr: 'grid' | 'snapline' | 'clusters' | 'arrange' | 'viewAll', checkResult?: boolean) {
const selected = SelectionManager.Docs().lastElement();
// prettier-ignore
- const map: Map<'grid' | 'snap lines' | 'clusters' | 'arrange'| 'viewAll', { undo: boolean, checkResult: (doc:Doc) => any; setDoc: (doc:Doc) => void;}> = new Map([
+ const map: Map<'grid' | 'snapline' | 'clusters' | 'arrange'| 'viewAll', { undo: boolean, checkResult: (doc:Doc) => any; setDoc: (doc:Doc) => void;}> = new Map([
['grid', {
undo: false,
checkResult: (doc:Doc) => doc._backgroundGridShow,
setDoc: (doc:Doc) => doc._backgroundGridShow = !doc._backgroundGridShow,
}],
- ['snap lines', {
+ ['snapline', {
undo: false,
checkResult: (doc:Doc) => doc.showSnapLines,
setDoc: (doc:Doc) => doc._showSnapLines = !doc._showSnapLines,