aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2023-11-20 10:40:14 -0500
committerbobzel <zzzman@gmail.com>2023-11-20 10:40:14 -0500
commite02e229047ec95549e838c7601fc677fe6b3f146 (patch)
tree2cf151fbd48f5e90575009382b44f5b16fdbe8a8 /src
parent4d15bf1cf2e37d15214c3c57fbb59da5465f30c8 (diff)
cleaned up rotation references to use screentolocaltransform
Diffstat (limited to 'src')
-rw-r--r--src/client/views/DocumentDecorations.tsx19
-rw-r--r--src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx4
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;