refactor: refactor offset of controller

This commit is contained in:
chenshenhai 2021-12-11 10:57:10 +08:00
parent aa224a92b7
commit b578014773
6 changed files with 18 additions and 13 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 772 KiB

After

Width:  |  Height:  |  Size: 762 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 386 KiB

After

Width:  |  Height:  |  Size: 384 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 203 KiB

After

Width:  |  Height:  |  Size: 204 KiB

View file

@ -31,7 +31,7 @@ const core = new Core(mount, {
},
elementWrapper: {
lockColor: '#009688',
color: '#e91e63',
color: '#009688',
controllerSize: 6,
lineWidth: 1,
// lineDash: [12, 12],

View file

@ -324,49 +324,53 @@ export class Helper implements TypeHelper {
if (typeof elem.angle === 'number' && Math.abs(elem.angle) > limitQbliqueAngle) {
hideObliqueDirection = true;
}
// TODO
// const controllerOffset = controllerSize;
const controllerOffset = lineWidth;
const wrapper: TypeHeplerSelectedElementWrapper = {
uuid: elem.uuid,
controllerSize: controllerSize,
controllerOffset: controllerOffset,
lock: elem?.operation?.lock === true,
controllers: {
topLeft: {
x: elem.x - controllerSize - bw,
y: elem.y - controllerSize - bw,
x: elem.x - controllerOffset - bw,
y: elem.y - controllerOffset - bw,
invisible: hideObliqueDirection || elem?.operation?.disbaleScale === true,
},
top: {
x: elem.x + elem.w / 2,
y: elem.y - controllerSize - bw,
y: elem.y - controllerOffset - bw,
invisible: elem?.operation?.disbaleScale === true,
},
topRight: {
x: elem.x + elem.w + controllerSize + bw,
y: elem.y - controllerSize - bw,
x: elem.x + elem.w + controllerOffset + bw,
y: elem.y - controllerOffset - bw,
invisible: hideObliqueDirection || elem?.operation?.disbaleScale === true,
},
right: {
x: elem.x + elem.w + controllerSize + bw,
x: elem.x + elem.w + controllerOffset + bw,
y: elem.y + elem.h / 2,
invisible: elem?.operation?.disbaleScale === true
},
bottomRight: {
x: elem.x + elem.w + controllerSize + bw,
y: elem.y + elem.h + controllerSize + bw,
x: elem.x + elem.w + controllerOffset + bw,
y: elem.y + elem.h + controllerOffset + bw,
invisible: hideObliqueDirection || elem?.operation?.disbaleScale === true,
},
bottom: {
x: elem.x + elem.w / 2,
y: elem.y + elem.h + controllerSize + bw,
y: elem.y + elem.h + controllerOffset + bw,
invisible: elem?.operation?.disbaleScale === true,
},
bottomLeft: {
x: elem.x - controllerSize - bw,
y: elem.y + elem.h + controllerSize + bw,
x: elem.x - controllerOffset - bw,
y: elem.y + elem.h + controllerOffset + bw,
invisible: hideObliqueDirection || elem?.operation?.disbaleScale === true,
},
left: {
x: elem.x - controllerSize - bw,
x: elem.x - controllerOffset - bw,
y: elem.y + elem.h / 2,
invisible: elem?.operation?.disbaleScale === true
},

View file

@ -10,6 +10,7 @@ type TypeController = TypePoint & {
type TypeHeplerSelectedElementWrapper = {
uuid: string;
controllerSize: number;
controllerOffset: number;
lock: boolean;
controllers: {
topLeft: TypeController,