Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2900fa9

Browse files
committed
Test commit
1 parent 6264f32 commit 2900fa9

File tree

1 file changed

+20
-23
lines changed

1 file changed

+20
-23
lines changed

src/dd-resizable.ts

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -251,29 +251,26 @@ export class DDResizable extends DDBaseImplement implements HTMLElementExtendOpt
251251

252252
if (typeof fixedAspectRatio !== 'undefined')
253253
{
254-
// Horizontal change is larger?
255-
if (offsetX > offsetY) {
256-
if (dir.indexOf('e') > -1) {
257-
newRect.width += offsetX;
258-
newRect.height += Math.round(offsetX / fixedAspectRatio);
259-
} else if (dir.indexOf('w') > -1) {
260-
newRect.width -= offsetX;
261-
newRect.left += offsetX;
262-
263-
newRect.height -= Math.round(offsetX / fixedAspectRatio);
264-
newRect.top += Math.round(offsetX / fixedAspectRatio);
265-
}
266-
} else {
267-
if (dir.indexOf('s') > -1) {
268-
newRect.height += offsetY;
269-
newRect.width += Math.round(offsetY * fixedAspectRatio);
270-
} else if (dir.indexOf('n') > -1) {
271-
newRect.height -= offsetY;
272-
newRect.top += offsetY;
273-
274-
newRect.width -= Math.round(offsetY * fixedAspectRatio);
275-
newRect.left += Math.round(offsetY * fixedAspectRatio);
276-
}
254+
if (dir.indexOf('e') > -1) {
255+
newRect.width += offsetX;
256+
newRect.height += Math.round(offsetX / fixedAspectRatio);
257+
} else if (dir.indexOf('w') > -1) {
258+
newRect.width -= offsetX;
259+
newRect.left += offsetX;
260+
261+
newRect.height -= Math.round(offsetX / fixedAspectRatio);
262+
newRect.top += Math.round(offsetX / fixedAspectRatio);
263+
}
264+
265+
if (dir.indexOf('s') > -1) {
266+
newRect.height += offsetY;
267+
newRect.width += Math.round(offsetY * fixedAspectRatio);
268+
} else if (dir.indexOf('n') > -1) {
269+
newRect.height -= offsetY;
270+
newRect.top += offsetY;
271+
272+
newRect.width -= Math.round(offsetY * fixedAspectRatio);
273+
newRect.left += Math.round(offsetY * fixedAspectRatio);
277274
}
278275
}
279276
else

0 commit comments

Comments
 (0)