mirror of
https://github.com/logseq/logseq.git
synced 2026-04-24 14:14:55 +00:00
fix: preserve aspect ratio
This commit is contained in:
committed by
Gabriel Horner
parent
31a0ed40bc
commit
08f70c979e
@@ -69,17 +69,18 @@ export class CreatingState<
|
||||
if (!this.creatingShape) throw Error('Expected a creating shape.')
|
||||
const { initialBounds } = this
|
||||
const { currentPoint, originPoint, shiftKey } = this.app.inputs
|
||||
const isAspectRatioLocked = shiftKey ||
|
||||
this.creatingShape.props.isAspectRatioLocked ||
|
||||
!this.creatingShape.canChangeAspectRatio
|
||||
let bounds = BoundsUtils.getTransformedBoundingBox(
|
||||
initialBounds,
|
||||
TLResizeCorner.BottomRight,
|
||||
Vec.sub(currentPoint, originPoint),
|
||||
0,
|
||||
shiftKey ||
|
||||
this.creatingShape.props.isAspectRatioLocked ||
|
||||
!this.creatingShape.canChangeAspectRatio
|
||||
isAspectRatioLocked
|
||||
)
|
||||
|
||||
if (this.app.settings.snapToGrid) {
|
||||
if (this.app.settings.snapToGrid && !isAspectRatioLocked) {
|
||||
bounds = BoundsUtils.snapBoundsToGrid(bounds, GRID_SIZE)
|
||||
}
|
||||
|
||||
|
||||
@@ -218,7 +218,7 @@ export class ResizingState<
|
||||
// relativeBounds = BoundsUtils.centerBounds(relativeBounds, center)
|
||||
// }
|
||||
|
||||
if (this.app.settings.snapToGrid) {
|
||||
if (this.app.settings.snapToGrid && !isAspectRatioLocked) {
|
||||
relativeBounds = BoundsUtils.snapBoundsToGrid(relativeBounds, GRID_SIZE)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user