mirror of
https://github.com/idrawjs/idraw
synced 2026-05-24 10:08:34 +00:00
fix: scale-direction for element when it rotated
This commit is contained in:
parent
23ffe970b1
commit
d06864a90b
4 changed files with 13 additions and 7 deletions
|
|
@ -10,3 +10,6 @@ const elementTypes = {
|
|||
|
||||
export const elementNames = Object.keys(elementTypes);
|
||||
|
||||
|
||||
// limitQbliqueAngle
|
||||
export const LIMIT_QBLIQUE_ANGLE = 15;
|
||||
|
|
@ -8,5 +8,5 @@ export enum Mode {
|
|||
|
||||
export enum CursorStatus {
|
||||
DRAGGING = 'dragging',
|
||||
NULL = 'null'
|
||||
}
|
||||
NULL = 'null',
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,9 +10,10 @@ import util from '@idraw/util';
|
|||
import { rotateElement } from './transform';
|
||||
import { calcRadian, calcElementCenter, parseRadianToAngle } from './calculate';
|
||||
import { limitAngle, limitNum } from './value';
|
||||
import { LIMIT_QBLIQUE_ANGLE } from './../constant/element';
|
||||
|
||||
const { createUUID } = util.uuid;
|
||||
const limitQbliqueAngle = 30;
|
||||
const limitQbliqueAngle = LIMIT_QBLIQUE_ANGLE;
|
||||
|
||||
export class Element {
|
||||
private _ctx: TypeContext;
|
||||
|
|
@ -246,8 +247,9 @@ function calcuScaleElemPosition(
|
|||
break;
|
||||
}
|
||||
case 'top-right': {
|
||||
if (p.h - moveY > 0) {
|
||||
if (p.h - moveY > 0 && p.w + moveX > 0) {
|
||||
p.y += moveY;
|
||||
p.w += moveX;
|
||||
p.h -= moveY;
|
||||
}
|
||||
// // TODO
|
||||
|
|
@ -532,8 +534,6 @@ function parseRadian(angle: number) {
|
|||
return angle * Math.PI / 180;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function calcMoveDist(moveX: number, moveY: number) {
|
||||
return Math.sqrt(moveX * moveX + moveY * moveY);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,9 @@ import Board from '@idraw/board';
|
|||
import util from '@idraw/util';
|
||||
import { parseAngleToRadian, calcElementCenter } from './calculate';
|
||||
import { rotateContext, rotateElement } from './transform';
|
||||
import { LIMIT_QBLIQUE_ANGLE } from './../constant/element';
|
||||
|
||||
const limitQbliqueAngle = LIMIT_QBLIQUE_ANGLE;
|
||||
|
||||
const { deepClone } = util.data;
|
||||
|
||||
|
|
@ -315,7 +318,7 @@ export class Helper implements TypeHelper {
|
|||
// @ts-ignore
|
||||
const bw = elem.desc?.borderWidth || 0;
|
||||
let hideObliqueDirection = false;
|
||||
if (typeof elem.angle === 'number' && Math.abs(elem.angle) > 30) {
|
||||
if (typeof elem.angle === 'number' && Math.abs(elem.angle) > limitQbliqueAngle) {
|
||||
hideObliqueDirection = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue