diff options
author | bobzel <zzzman@gmail.com> | 2021-09-04 00:46:41 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2021-09-04 00:46:41 -0400 |
commit | 9a4bd3ca5dbe192eec20bf405a9904ef8b546de6 (patch) | |
tree | dedb50e4979820099db02912d187ae740c59a995 /src | |
parent | 85345138396771a30f9d0e7a26837edc0a972bee (diff) |
added top/left clip bounds to ink decorations
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/ComponentDecorations.tsx | 4 | ||||
-rw-r--r-- | src/client/views/InkingStroke.tsx | 3 | ||||
-rw-r--r-- | src/client/views/MainView.tsx | 4 | ||||
-rw-r--r-- | src/client/views/nodes/DocumentView.tsx | 2 |
4 files changed, 7 insertions, 6 deletions
diff --git a/src/client/views/ComponentDecorations.tsx b/src/client/views/ComponentDecorations.tsx index 66f81fe4f..66d1bd63d 100644 --- a/src/client/views/ComponentDecorations.tsx +++ b/src/client/views/ComponentDecorations.tsx @@ -4,11 +4,11 @@ import './ComponentDecorations.scss'; import React = require("react"); @observer -export class ComponentDecorations extends React.Component { +export class ComponentDecorations extends React.Component<{ boundsTop: number, boundsLeft: number }, { value: string }> { static Instance: ComponentDecorations; render() { const seldoc = SelectionManager.Views().lastElement(); - return seldoc?.ComponentView?.componentUI?.() ?? (null); + return seldoc?.ComponentView?.componentUI?.(this.props.boundsLeft, this.props.boundsTop) ?? (null); } }
\ No newline at end of file diff --git a/src/client/views/InkingStroke.tsx b/src/client/views/InkingStroke.tsx index 90eb52dd2..e713cedee 100644 --- a/src/client/views/InkingStroke.tsx +++ b/src/client/views/InkingStroke.tsx @@ -114,7 +114,7 @@ export class InkingStroke extends ViewBoxBaseComponent<FieldViewProps, InkDocume }; } - componentUI = () => { + componentUI = (boundsLeft: number, boundsTop: number) => { const { inkData, inkScaleX, inkScaleY, inkStrokeWidth } = this.inkScaledData(); const screenInkWidth = this.props.ScreenToLocalTransform().inverse().transformDirection(inkStrokeWidth, inkStrokeWidth); @@ -129,6 +129,7 @@ export class InkingStroke extends ViewBoxBaseComponent<FieldViewProps, InkDocume return <div className="inkstroke-UI" style={{ left: screenOrigin[0], top: screenOrigin[1], + clip: `rect(${boundsTop - screenOrigin[1]}px, 10000px, 10000px, ${boundsLeft - screenOrigin[0]}px)` }} > {InteractionUtils.CreatePolyline(screenPts, screenLeft, screenTop, Colors.MEDIUM_BLUE, screenInkWidth[0], overlayWidth, StrCast(inkDoc.strokeBezier), StrCast(inkDoc.fillColor, "none"), diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx index b81459075..f03124f0d 100644 --- a/src/client/views/MainView.tsx +++ b/src/client/views/MainView.tsx @@ -83,7 +83,7 @@ export class MainView extends React.Component { @observable private _sidebarContent: any = this.userDoc?.sidebar; @observable private _flyoutWidth: number = 0; - @computed private get topOffset() { return Number(SEARCH_PANEL_HEIGHT.replace("px", "")); } //TODO remove + @computed private get topOffset() { return 35 + Number(SEARCH_PANEL_HEIGHT.replace("px", "")); } //TODO remove @computed private get leftOffset() { return this.menuPanelWidth() - 2; } @computed private get userDoc() { return Doc.UserDoc(); } @computed private get darkScheme() { return BoolCast(CurrentUserUtils.ActiveDashboard?.darkScheme); } @@ -595,7 +595,7 @@ export class MainView extends React.Component { <GroupManager /> <GoogleAuthenticationManager /> <DocumentDecorations PanelWidth={this._windowWidth} PanelHeight={this._windowHeight} boundsLeft={this.leftOffset} boundsTop={this.topOffset} /> - <ComponentDecorations /> + <ComponentDecorations boundsLeft={this.leftOffset} boundsTop={this.topOffset + 25} /> {this.search} {LinkDescriptionPopup.descriptionPopup ? <LinkDescriptionPopup /> : null} {DocumentLinksButton.LinkEditorDocView ? <LinkMenu docView={DocumentLinksButton.LinkEditorDocView} changeFlyout={emptyFunction} /> : (null)} diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index 4e6ed40d1..a9b303294 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -88,7 +88,7 @@ export interface DocComponentView { setKeyFrameEditing?: (set: boolean) => void; // whether the document is in keyframe editing mode (if it is, then all hidden documents that are not active at the keyframe time will still be shown) playFrom?: (time: number, endTime?: number) => void; setFocus?: () => void; - componentUI?: () => JSX.Element; + componentUI?: (boundsLeft: number, boundsTop: number) => JSX.Element; } export interface DocumentViewSharedProps { renderDepth: number; |