aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2024-10-29 13:39:16 -0400
committerbobzel <zzzman@gmail.com>2024-10-29 13:39:16 -0400
commit1a444532d026a208817c6997f00022a3e09ead23 (patch)
treef5bc8a9dda9b3c9b80700930398a9664acad6115 /src
parent63f9f9573dab9745d2f570e1917b325a474fdd93 (diff)
fixes to allow typing and drawing without a mode switch.
Diffstat (limited to 'src')
-rw-r--r--src/client/documents/DocUtils.ts4
-rw-r--r--src/client/views/GestureOverlay.tsx8
-rw-r--r--src/client/views/nodes/formattedText/RichTextMenu.tsx1
3 files changed, 10 insertions, 3 deletions
diff --git a/src/client/documents/DocUtils.ts b/src/client/documents/DocUtils.ts
index e3cb5e72c..dae3e48ad 100644
--- a/src/client/documents/DocUtils.ts
+++ b/src/client/documents/DocUtils.ts
@@ -678,8 +678,8 @@ export namespace DocUtils {
...(defaultTextTemplate
? {} // if the new doc will inherit from a template, don't set any layout fields since that would block the inheritance
: {
- _width: width || 200,
- _height: BoolCast(Doc.UserDoc().fitBox) ? 70 : 35,
+ _width: width || BoolCast(Doc.UserDoc().fitBox) ? Number(StrCast(Doc.UserDoc().fontSize).replace('px', '')) * 1.5 * 6 : 200,
+ _height: BoolCast(Doc.UserDoc().fitBox) ? Number(StrCast(Doc.UserDoc().fontSize).replace('px', '')) * 1.5 : 35,
_layout_centered: BoolCast(Doc.UserDoc()._layout_centered),
_layout_fitWidth: true,
_layout_autoHeight: true,
diff --git a/src/client/views/GestureOverlay.tsx b/src/client/views/GestureOverlay.tsx
index afeecaa63..402a7c20a 100644
--- a/src/client/views/GestureOverlay.tsx
+++ b/src/client/views/GestureOverlay.tsx
@@ -95,6 +95,8 @@ export class GestureOverlay extends ObservableReactComponent<React.PropsWithChil
}
@action
onPointerDown = (e: React.PointerEvent) => {
+ DocumentView.DeselectAll();
+ (document.activeElement as HTMLElement)?.blur();
if (!(e.target as HTMLElement)?.className?.toString().startsWith('lm_')) {
if ([InkTool.Highlighter, InkTool.Pen, InkTool.Write].includes(Doc.ActiveTool)) {
this._points.push({ X: e.clientX, Y: e.clientY });
@@ -244,8 +246,9 @@ export class GestureOverlay extends ObservableReactComponent<React.PropsWithChil
this.dispatchGesture(Gestures.Stroke);
};
@action
- onPointerUp = () => {
+ onPointerUp = (e: PointerEvent) => {
const ffView = DocumentView.DownDocView?.ComponentView instanceof CollectionFreeFormView && DocumentView.DownDocView.ComponentView;
+ const downView = DocumentView.DownDocView;
DocumentView.DownDocView = undefined;
if (this._points.length > 1) {
const B = this.svgBounds;
@@ -286,6 +289,9 @@ export class GestureOverlay extends ObservableReactComponent<React.PropsWithChil
this.dryInk();
}
}
+ } else {
+ (downView?.ComponentView as CollectionFreeFormView)?._marqueeViewRef?.current?.setPreviewCursor?.(this._points[0].X, this._points[0].Y, false, false, undefined);
+ e.preventDefault();
}
this._points.length = 0;
};
diff --git a/src/client/views/nodes/formattedText/RichTextMenu.tsx b/src/client/views/nodes/formattedText/RichTextMenu.tsx
index 65a415a23..33cfbb510 100644
--- a/src/client/views/nodes/formattedText/RichTextMenu.tsx
+++ b/src/client/views/nodes/formattedText/RichTextMenu.tsx
@@ -378,6 +378,7 @@ export class RichTextMenu extends AntimodeMenu<AntimodeMenuProps> {
this.view.focus();
} else {
Doc.UserDoc()[fontField] = value;
+ this.updateMenu(undefined, undefined, undefined, this.dataDoc);
}
};