aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2024-10-01 14:03:00 -0400
committerbobzel <zzzman@gmail.com>2024-10-01 14:03:00 -0400
commit19f0184da33b5080f301baf78cf8e6f6d113d79a (patch)
tree285ab907d6f576ad56c2f98dc52119bdcf18acf7
parentbb40454262a2d915a334d7a26555d25d649d4317 (diff)
fixed some lint errors. fixed how drawings are added to pdfs. fixed testing for ink in propertiesView.
-rw-r--r--src/client/views/PropertiesView.tsx23
-rw-r--r--src/client/views/pdf/PDFViewer.tsx2
2 files changed, 11 insertions, 14 deletions
diff --git a/src/client/views/PropertiesView.tsx b/src/client/views/PropertiesView.tsx
index fcac4d464..722086aea 100644
--- a/src/client/views/PropertiesView.tsx
+++ b/src/client/views/PropertiesView.tsx
@@ -18,11 +18,12 @@ import { Id } from '../../fields/FieldSymbols';
import { InkField } from '../../fields/InkField';
import { List } from '../../fields/List';
import { ComputedField } from '../../fields/ScriptField';
-import { BoolCast, Cast, DocCast, NumCast, StrCast } from '../../fields/Types';
+import { Cast, DocCast, NumCast, StrCast } from '../../fields/Types';
import { GetEffectiveAcl, SharingPermissions, normalizeEmail } from '../../fields/util';
import { CollectionViewType, DocumentType } from '../documents/DocumentTypes';
import { GroupManager } from '../util/GroupManager';
import { LinkManager } from '../util/LinkManager';
+import { SettingsManager } from '../util/SettingsManager';
import { SharingManager } from '../util/SharingManager';
import { SnappingManager } from '../util/SnappingManager';
import { Transform } from '../util/Transform';
@@ -30,6 +31,7 @@ import { UndoManager, undoBatch, undoable } from '../util/UndoManager';
import { EditableView } from './EditableView';
import { FilterPanel } from './FilterPanel';
import { InkStrokeProperties } from './InkStrokeProperties';
+import { InkingStroke } from './InkingStroke';
import { ObservableReactComponent } from './ObservableReactComponent';
import { PropertiesButtons } from './PropertiesButtons';
import { PropertiesDocBacklinksSelector } from './PropertiesDocBacklinksSelector';
@@ -41,9 +43,6 @@ import { DocumentView } from './nodes/DocumentView';
import { StyleProviderFuncType } from './nodes/FieldView';
import { OpenWhere } from './nodes/OpenWhere';
import { PresBox, PresEffect, PresEffectDirection } from './nodes/trails';
-import { InkingStroke } from './InkingStroke';
-import { SettingsManager } from '../util/SettingsManager';
-import { MarqueeOptionsMenu } from './collections/collectionFreeForm';
import { SmartDrawHandler } from './smartdraw/SmartDrawHandler';
interface PropertiesViewProps {
@@ -75,6 +74,10 @@ export class PropertiesView extends ObservableReactComponent<PropertiesViewProps
return 200;
}
+ @computed get containsInkDoc() {
+ return this.containsInk(this.selectedDoc);
+ }
+
@computed get selectedDoc() {
return DocumentView.SelectedSchemaDoc() || this.selectedDocumentView?.Document || Doc.ActiveDashboard;
}
@@ -118,7 +121,6 @@ export class PropertiesView extends ObservableReactComponent<PropertiesViewProps
@observable openSlideOptions: boolean = false;
// For ink groups
- @observable containsInkDoc: boolean = false;
@observable inkDoc: Doc | undefined = undefined;
@observable _controlButton: boolean = false;
@@ -1276,19 +1278,16 @@ export class PropertiesView extends ObservableReactComponent<PropertiesViewProps
@computed get filtersSubMenu() {
return (
- // prettier-ignore
<PropertiesSection title="Filters" isOpen={this.openFilters} setIsOpen={action(bool => { this.openFilters = bool; })} onDoubleClick={this.CloseAll}>
<div className="propertiesView-content filters" style={{ position: 'relative', height: 'auto' }}>
<FilterPanel Document={this.selectedDoc ?? Doc.ActiveDashboard!} />
</div>
</PropertiesSection>
- );
+ ); // prettier-ignore
}
@computed get inkSubMenu() {
- this.containsInkDoc = false;
return (
- // prettier-ignore
<>
<PropertiesSection title="Appearance" isOpen={this.openAppearance} setIsOpen={bool => { this.openAppearance = bool; }} onDoubleClick={this.CloseAll}>
{this.selectedLayoutDoc?.layout_isSvg ? this.appearanceEditor : null}
@@ -1297,7 +1296,7 @@ export class PropertiesView extends ObservableReactComponent<PropertiesViewProps
{this.transformEditor}
</PropertiesSection>
</>
- );
+ ); // prettier-ignore
}
/**
@@ -1306,14 +1305,12 @@ export class PropertiesView extends ObservableReactComponent<PropertiesViewProps
*/
containsInk = (selectedDoc: Doc) => {
const childDocs: Doc[] = DocListCast(selectedDoc[DocData].data);
- for (var i = 0; i < childDocs.length; i++) {
+ for (let i = 0; i < childDocs.length; i++) {
if (DocumentView.getDocumentView(childDocs[i])?.layoutDoc?.layout_isSvg) {
this.inkDoc = childDocs[i];
- this.containsInkDoc = true;
return true;
}
}
- this.containsInkDoc = false;
return false;
};
diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx
index 20719442a..01242ba48 100644
--- a/src/client/views/pdf/PDFViewer.tsx
+++ b/src/client/views/pdf/PDFViewer.tsx
@@ -430,7 +430,7 @@ export class PDFViewer extends ObservableReactComponent<IViewerProps> {
addDrawingAnnotation = (drawing: Doc) => {
// drawing[DocData].x = this._props.pdfBox.ScreenToLocalBoxXf().TranslateX
// const scaleX = this._mainCont.current.offsetWidth / boundingRect.width;
- drawing.y = (drawing.y as number) + (this._props.Document.data_sidebar_panY as number);
+ drawing.y = NumCast(drawing.y) + NumCast(this._props.Document.layout_scrollTop);
this._props.addDocument?.(drawing);
};