aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/DocumentDecorations.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2024-08-20 19:11:00 -0400
committerbobzel <zzzman@gmail.com>2024-08-20 19:11:00 -0400
commit5196009ec6bcb673fd2a4519c54442df218841f7 (patch)
tree79f4b1d559c20a6bfd9b4759a5cbe9d8f8c00fe1 /src/client/views/DocumentDecorations.tsx
parent0e975569e5686138e52bdc554b3f0391f42aeead (diff)
parente57584a1be9d428fb40fc789494a7ac0ac14fb84 (diff)
fixed up a bunch of things in face recognition
Diffstat (limited to 'src/client/views/DocumentDecorations.tsx')
-rw-r--r--src/client/views/DocumentDecorations.tsx23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx
index bd6952620..ce1138b7a 100644
--- a/src/client/views/DocumentDecorations.tsx
+++ b/src/client/views/DocumentDecorations.tsx
@@ -34,6 +34,7 @@ import { DocumentView } from './nodes/DocumentView';
import { ImageBox } from './nodes/ImageBox';
import { OpenWhere, OpenWhereMod } from './nodes/OpenWhere';
import { FormattedTextBox } from './nodes/formattedText/FormattedTextBox';
+import { IconProp } from '@fortawesome/fontawesome-svg-core';
interface DocumentDecorationsProps {
PanelWidth: number;
@@ -146,7 +147,7 @@ export class DocumentDecorations extends ObservableReactComponent<DocumentDecora
titleEntered = (e: React.KeyboardEvent) => {
if (e.key === 'Enter') {
e.stopPropagation();
- (e.target as any).blur();
+ (e.target as HTMLElement).blur?.();
}
};
@@ -240,7 +241,7 @@ export class DocumentDecorations extends ObservableReactComponent<DocumentDecora
}
});
if (!this._iconifyBatch) {
- (document.activeElement as any).blur?.();
+ (document.activeElement as HTMLElement).blur?.();
this._iconifyBatch = UndoManager.StartBatch(forceDeleteOrIconify ? 'delete selected docs' : 'iconifying');
} else {
// eslint-disable-next-line no-param-reassign
@@ -255,7 +256,7 @@ export class DocumentDecorations extends ObservableReactComponent<DocumentDecora
setupMoveUpEvents(this, e, () => DragManager.StartWindowDrag?.(e, [DocumentView.SelectedDocs().lastElement()]) ?? false, emptyFunction, this.onMaximizeClick, false, false);
e.stopPropagation();
};
- onMaximizeClick = (e: any): void => {
+ onMaximizeClick = (e: PointerEvent): void => {
const selView = DocumentView.Selected()[0];
if (selView) {
if (e.ctrlKey) {
@@ -350,8 +351,10 @@ export class DocumentDecorations extends ObservableReactComponent<DocumentDecora
setupMoveUpEvents(
this,
e,
- (moveEv: PointerEvent, down: number[], delta: number[]) => // return false to keep getting events
- this.setRotateCenter(seldocview, [this.rotCenter[0] + delta[0], this.rotCenter[1] + delta[1]]) as any as boolean,
+ (moveEv: PointerEvent, down: number[], delta: number[]) => {
+ this.setRotateCenter(seldocview, [this.rotCenter[0] + delta[0], this.rotCenter[1] + delta[1]]);
+ return false;
+ },
action(() => { this._isRotating = false; }), // upEvent
action(() => { seldocview.Document._rotation_centerX = seldocview.Document._rotation_centerY = 0; }),
true
@@ -431,7 +434,7 @@ export class DocumentDecorations extends ObservableReactComponent<DocumentDecora
setupMoveUpEvents(this, e, this.onPointerMove, this.onPointerUp, emptyFunction);
e.stopPropagation();
const id = (this._resizeHdlId = e.currentTarget.className);
- const pad = id.includes('Left') || id.includes('Right') ? Number(getComputedStyle(e.target as any).width.replace('px', '')) / 2 : 0;
+ const pad = id.includes('Left') || id.includes('Right') ? Number(getComputedStyle(e.target as HTMLElement).width?.replace('px', '')) / 2 : 0;
const bounds = e.currentTarget.getBoundingClientRect();
this._offset = {
x: id.toLowerCase().includes('left') ? bounds.right - e.clientX - pad : bounds.left - e.clientX + pad, //
@@ -479,7 +482,7 @@ export class DocumentDecorations extends ObservableReactComponent<DocumentDecora
const scaleAspect = {x:scale.x === 1 && hasFixedAspect ? scale.y : scale.x, y: scale.x !== 1 && hasFixedAspect ? scale.x : scale.y};
DocumentView.Selected().forEach(docView =>
this.resizeView(docView, refPt, scaleAspect, { dragHdl, ctrlKey:e.ctrlKey })); // prettier-ignore
- await new Promise<any>(res => { setTimeout(() => { res(this._interactionLock = undefined)})});
+ await new Promise<void>(res => { setTimeout(() => { res(this._interactionLock = undefined)})});
}); // prettier-ignore
return false;
@@ -683,10 +686,10 @@ export class DocumentDecorations extends ObservableReactComponent<DocumentDecora
const collectionAcl = docView.containerViewPath?.()?.lastElement() ? GetEffectiveAcl(docView.containerViewPath?.().lastElement().dataDoc) : AclEdit;
return collectionAcl !== AclAdmin && collectionAcl !== AclEdit && GetEffectiveAcl(docView.Document) !== AclAdmin;
});
- const topBtn = (key: string, icon: string, pointerDown: undefined | ((e: React.PointerEvent) => void), click: undefined | ((e: any) => void), title: string) => (
+ const topBtn = (key: string, icon: IconProp, pointerDown: undefined | ((e: React.PointerEvent) => void), click: undefined | ((e: PointerEvent) => void), title: string) => (
<Tooltip key={key} title={<div className="dash-tooltip">{title}</div>} placement="top">
- <div className={`documentDecorations-${key}Button`} onContextMenu={e => e.preventDefault()} onPointerDown={pointerDown ?? (e => setupMoveUpEvents(this, e, returnFalse, emptyFunction, clickEv => click!(clickEv)))}>
- <FontAwesomeIcon icon={icon as any} />
+ <div className={`documentDecorations-${key}Button`} onContextMenu={e => e.preventDefault()} onPointerDown={pointerDown ?? (e => setupMoveUpEvents(this, e, returnFalse, emptyFunction, clickEv => click?.(clickEv)))}>
+ <FontAwesomeIcon icon={icon} />
</div>
</Tooltip>
);