refactor(node-resizer): apply min width and height with aspect ratio
Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -42,7 +42,7 @@ const aspectRatio = computed(() => {
|
|||||||
if (props.keepAspectRatio === true && startValues.value.width && startValues.value.height) {
|
if (props.keepAspectRatio === true && startValues.value.width && startValues.value.height) {
|
||||||
return startValues.value.width / startValues.value.height
|
return startValues.value.width / startValues.value.height
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof props.keepAspectRatio == 'number') {
|
if (typeof props.keepAspectRatio == 'number') {
|
||||||
return props.keepAspectRatio
|
return props.keepAspectRatio
|
||||||
}
|
}
|
||||||
@@ -115,9 +115,9 @@ watchEffect((onCleanup) => {
|
|||||||
const newHeight = width / aspectRatio.value
|
const newHeight = width / aspectRatio.value
|
||||||
|
|
||||||
if (distX > distY) {
|
if (distX > distY) {
|
||||||
height = newHeight
|
height = Math.max(newHeight, props.minHeight)
|
||||||
} else {
|
} else {
|
||||||
width = newWidth
|
width = Math.max(newWidth, props.minWidth)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user