From 2ea594a4c1ff221200e0795fb07d30b603177a67 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Wed, 3 Jan 2024 23:44:28 -0500
Subject: cleaned up screenToLocalTransform in several places by making it
 additional methods.  cleaned up styleProider api a bit to take
 DocumentViewInternalProps, not DocumentViewProps..

---
 src/client/views/DocComponent.tsx | 10 ++++++++++
 1 file changed, 10 insertions(+)

(limited to 'src/client/views/DocComponent.tsx')

diff --git a/src/client/views/DocComponent.tsx b/src/client/views/DocComponent.tsx
index b5bd17572..dfc298840 100644
--- a/src/client/views/DocComponent.tsx
+++ b/src/client/views/DocComponent.tsx
@@ -12,12 +12,14 @@ import { DocumentManager } from '../util/DocumentManager';
 import { ObservableReactComponent } from './ObservableReactComponent';
 import { CollectionFreeFormView } from './collections/collectionFreeForm';
 import { DocumentView } from './nodes/DocumentView';
+import { Transform } from '../util/Transform';
 
 ///  DocComponent returns a generic React base class used by views that don't have 'fieldKey' props (e.g.,CollectionFreeFormDocumentView, DocumentView)
 export interface DocComponentProps {
     Document: Doc;
     LayoutTemplate?: () => Opt<Doc>;
     LayoutTemplateString?: string;
+    ScreenToLocalTransform: () => Transform;
 }
 export function DocComponent<P extends DocComponentProps>() {
     class Component extends ObservableReactComponent<React.PropsWithChildren<P>> {
@@ -26,6 +28,8 @@ export function DocComponent<P extends DocComponentProps>() {
             makeObservable(this);
         }
 
+        ScreenToLocalBoxXf = () => this._props.ScreenToLocalTransform();
+
         //TODO This might be pretty inefficient if doc isn't observed, because computed doesn't cache then
         get Document() {
             return this._props.Document;
@@ -50,10 +54,13 @@ interface ViewBoxBaseProps {
     fieldKey: string;
     isSelected: () => boolean;
     isContentActive: () => boolean | undefined;
+    ScreenToLocalTransform: () => Transform;
     renderDepth: number;
 }
 export function ViewBoxBaseComponent<P extends ViewBoxBaseProps>() {
     class Component extends ObservableReactComponent<React.PropsWithChildren<P>> {
+        ScreenToLocalBoxXf = () => this._props.ScreenToLocalTransform();
+
         //TODO This might be pretty inefficient if doc isn't observed, because computed doesn't cache then
         get Document() {
             return this._props.Document;
@@ -83,6 +90,7 @@ export interface ViewBoxAnnotatableProps {
     isContentActive: () => boolean | undefined;
     select: (isCtrlPressed: boolean) => void;
     whenChildContentsActiveChanged: (isActive: boolean) => void;
+    ScreenToLocalTransform: () => Transform;
     isSelected: () => boolean;
     renderDepth: number;
     isAnnotationOverlay?: boolean;
@@ -94,6 +102,8 @@ export function ViewBoxAnnotatableComponent<P extends ViewBoxAnnotatableProps>()
             makeObservable(this);
         }
 
+        ScreenToLocalBoxXf = () => this._props.ScreenToLocalTransform();
+
         @observable _annotationKeySuffix = () => 'annotations';
         @observable _isAnyChildContentActive = false;
         //TODO This might be pretty inefficient if doc isn't observed, because computed doesn't cache then
-- 
cgit v1.2.3-70-g09d2

