diff options
-rw-r--r-- | src/client/views/DocumentDecorations.tsx | 19 | ||||
-rw-r--r-- | src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx | 4 |
2 files changed, 8 insertions, 15 deletions
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<Partial<collection for (let i = 0; i < docDragData.droppedDocuments.length; i++) { const d = docDragData.droppedDocuments[i]; const layoutDoc = Doc.Layout(d); - const delta = Utils.rotPt(x - dropPos[0], y - dropPos[1], -NumCast(this.rootDoc.rotation) * (Math.PI / 180)); + const delta = Utils.rotPt(x - dropPos[0], y - dropPos[1], -this.props.ScreenToLocalTransform().Rotate); if (this.Document._currentFrame !== undefined) { CollectionFreeFormDocumentView.setupKeyframes([d], NumCast(this.Document._currentFrame), false); const pvals = CollectionFreeFormDocumentView.getValues(d, NumCast(d.activeFrame, 1000)); // get filled in values (uses defaults when not value is specified) for position @@ -732,7 +732,7 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection PresBox.Instance?.pauseAutoPres(); this.props.DocumentView?.().clearViewTransition(); const [dxi, dyi] = this.screenToLocalXf.transformDirection(e.clientX - this._lastX, e.clientY - this._lastY); - const { x: dx, y: dy } = Utils.rotPt(dxi, dyi, -NumCast(this.rootDoc.rotation) * (Math.PI / 180)); + const { x: dx, y: dy } = Utils.rotPt(dxi, dyi, -this.props.ScreenToLocalTransform().Rotate); this.setPan(NumCast(this.Document[this.panXFieldKey]) - (ctrlKey ? 0 : dx), NumCast(this.Document[this.panYFieldKey]) - (shiftKey ? 0 : dy), 0, true); this._lastX = e.clientX; this._lastY = e.clientY; |