From e02e229047ec95549e838c7601fc677fe6b3f146 Mon Sep 17 00:00:00 2001 From: bobzel Date: Mon, 20 Nov 2023 10:40:14 -0500 Subject: cleaned up rotation references to use screentolocaltransform --- src/client/views/DocumentDecorations.tsx | 19 ++++++------------- .../collectionFreeForm/CollectionFreeFormView.tsx | 4 ++-- 2 files changed, 8 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx index dc5839bdd..3782a8878 100644 --- a/src/client/views/DocumentDecorations.tsx +++ b/src/client/views/DocumentDecorations.tsx @@ -627,22 +627,15 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P return SelectionManager.Views().length > 1 ? '-multiple-' : '-unset-'; } - @computed get hasIcons() { - return SelectionManager.Views().some(docView => docView.rootDoc.layout_fieldKey === 'layout_icon'); - } - @computed get rotCenter() { - if (SelectionManager.Views().length) { - const seldocview = SelectionManager.Views()[0]; - const loccenter = Utils.rotPt( - NumCast(seldocview.rootDoc.rotation_centerX) * NumCast(seldocview.layoutDoc._width), - NumCast(seldocview.rootDoc.rotation_centerY) * NumCast(seldocview.layoutDoc._height), - (NumCast(seldocview.rootDoc._rotation) / 180) * Math.PI - ); - return seldocview.props + const lastView = SelectionManager.Views().lastElement(); + if (lastView) { + const seldoc = lastView.layoutDoc; + const loccenter = Utils.rotPt(NumCast(seldoc.rotation_centerX) * NumCast(seldoc._width), NumCast(seldoc.rotation_centerY) * NumCast(seldoc._height), lastView.props.ScreenToLocalTransform().Rotate); + return lastView.props .ScreenToLocalTransform() .inverse() - .transformPoint(loccenter.x + NumCast(seldocview.layoutDoc._width) / 2, loccenter.y + NumCast(seldocview.layoutDoc._height) / 2); + .transformPoint(loccenter.x + NumCast(seldoc._width) / 2, loccenter.y + NumCast(seldoc._height) / 2); } return this._rotCenter; } diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx index 75e27aa43..1b3bbdd18 100644 --- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx +++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx @@ -341,7 +341,7 @@ export class CollectionFreeFormView extends CollectionSubView