diff options
author | bobzel <zzzman@gmail.com> | 2021-03-29 13:20:14 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2021-03-29 13:20:14 -0400 |
commit | fa6aa3f3d13cade1cd46d954dbfee6f8566bcc86 (patch) | |
tree | 9c4b8d3d15134db833af87ce6b427fa643a3d6c9 /src/client/views/DocComponent.tsx | |
parent | a1a9803096adde0cd932e703080948ef1d1724f7 (diff) |
initial changes to cleanup pointer events.
Diffstat (limited to 'src/client/views/DocComponent.tsx')
-rw-r--r-- | src/client/views/DocComponent.tsx | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/client/views/DocComponent.tsx b/src/client/views/DocComponent.tsx index be1eab86b..3f6715560 100644 --- a/src/client/views/DocComponent.tsx +++ b/src/client/views/DocComponent.tsx @@ -77,7 +77,7 @@ export interface ViewBoxAnnotatableProps { layerProvider?: (doc: Doc) => boolean; active: () => boolean; select: (isCtrlPressed: boolean) => void; - whenActiveChanged: (isActive: boolean) => void; + whenChildContentsActiveChanged: (isActive: boolean) => void; isSelected: (outsideReaction?: boolean) => boolean; rootSelected: (outsideReaction?: boolean) => boolean; renderDepth: number; @@ -86,7 +86,7 @@ export function ViewBoxAnnotatableComponent<P extends ViewBoxAnnotatableProps, T class Component extends Touchable<P> { @observable _annotationKey: string = "annotations"; - @observable _isChildActive = false; + @observable _isAnyChildContentActive = false; //TODO This might be pretty inefficient if doc isn't observed, because computed doesn't cache then @computed get Document(): T { return schemaCtor(this.props.Document); } @@ -201,13 +201,12 @@ export function ViewBoxAnnotatableComponent<P extends ViewBoxAnnotatableProps, T return true; } - whenActiveChanged = action((isActive: boolean) => this.props.whenActiveChanged(this._isChildActive = isActive)); + whenChildContentsActiveChanged = action((isActive: boolean) => this.props.whenChildContentsActiveChanged(this._isAnyChildContentActive = isActive)); active = (outsideReaction?: boolean) => (CurrentUserUtils.SelectedTool === InkTool.None && - (this.props.rootSelected(outsideReaction) || - this.props.Document.forceActive || this.props.isSelected(outsideReaction) || this._isChildActive || this.props.renderDepth === 0) ? true : false) + (this.props.Document.forceActive || this.props.isSelected(outsideReaction) || this._isAnyChildContentActive || this.props.renderDepth === 0 || this.props.rootSelected(outsideReaction)) ? true : false) annotationsActive = (outsideReaction?: boolean) => (CurrentUserUtils.SelectedTool !== InkTool.None || (this.props.layerProvider?.(this.props.Document) === false && this.props.active()) || - (this.props.Document.forceActive || this.props.isSelected(outsideReaction) || this._isChildActive || this.props.renderDepth === 0) ? true : false) + (this.props.Document.forceActive || this.props.isSelected(outsideReaction) || this._isAnyChildContentActive || this.props.renderDepth === 0) ? true : false) } return Component; }
\ No newline at end of file |