diff options
author | bob <bcz@cs.brown.edu> | 2019-01-28 12:58:20 -0500 |
---|---|---|
committer | bob <bcz@cs.brown.edu> | 2019-01-28 12:58:20 -0500 |
commit | 5e1171dd68c227ad6e3a618dd77d0dcd97b2003c (patch) | |
tree | 511f2b211a7bdd29547e3e35e1b7e461744248d9 /src/DocumentDecorations.tsx | |
parent | a777df0f814019de6d1efb373b57b0c7049d2022 (diff) |
got rid of force update for doc decs and adjusted point transforms to account for collection border width.
Diffstat (limited to 'src/DocumentDecorations.tsx')
-rw-r--r-- | src/DocumentDecorations.tsx | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/DocumentDecorations.tsx b/src/DocumentDecorations.tsx index cf7c6d8b5..28d6dc377 100644 --- a/src/DocumentDecorations.tsx +++ b/src/DocumentDecorations.tsx @@ -1,8 +1,8 @@ -import { observable, computed } from "mobx"; +import {observable, computed} from "mobx"; import React = require("react"); -import { DocumentView } from "./views/nodes/DocumentView"; -import { SelectionManager } from "./util/SelectionManager"; -import { observer } from "mobx-react"; +import {DocumentView} from "./views/nodes/DocumentView"; +import {SelectionManager} from "./util/SelectionManager"; +import {observer} from "mobx-react"; import './DocumentDecorations.scss' @observer @@ -14,21 +14,25 @@ export class DocumentDecorations extends React.Component { DocumentDecorations.Instance = this } + @computed get x(): number { - return SelectionManager.SelectedDocuments().reduce((left, element) => Math.min(element.screenRect.left, left), Number.MAX_VALUE); + return SelectionManager.SelectedDocuments().reduce((left, element) => Math.min(element.TransformToScreenPoint(0, 0).ScreenX, left), Number.MAX_VALUE); } + @computed get y(): number { - return SelectionManager.SelectedDocuments().reduce((top, element) => Math.min(element.screenRect.top, top), Number.MAX_VALUE); + return SelectionManager.SelectedDocuments().reduce((top, element) => Math.min(element.TransformToScreenPoint(0, 0).ScreenY, top), Number.MAX_VALUE); } + @computed get height(): number { - return (SelectionManager.SelectedDocuments().reduce((bottom, element) => Math.max(element.screenRect.bottom, bottom), + return (SelectionManager.SelectedDocuments().reduce((bottom, element) => Math.max(element.TransformToScreenPoint(0, element.height).ScreenY, bottom), Number.MIN_VALUE)) - this.y; } + @computed get width(): number { - return SelectionManager.SelectedDocuments().reduce((right, element) => Math.max(element.screenRect.right, right), + return SelectionManager.SelectedDocuments().reduce((right, element) => Math.max(element.TransformToScreenPoint(element.width, 0).ScreenX, right), Number.MIN_VALUE) - this.x; } @@ -117,8 +121,6 @@ export class DocumentDecorations extends React.Component { element.height = actualdH; } }) - - this.forceUpdate() } onPointerUp = (e: PointerEvent): void => { |