mirror of
https://github.com/idrawjs/idraw
synced 2026-05-24 10:08:34 +00:00
Merge pull request #125 from idrawjs/dev
refactor: refactor offset of controller
This commit is contained in:
commit
afc45670a5
13 changed files with 37 additions and 32 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 |
|
|
@ -7,5 +7,5 @@
|
|||
"packages/core",
|
||||
"packages/idraw"
|
||||
],
|
||||
"version": "0.2.0-alpha.23"
|
||||
"version": "0.2.0-alpha.24"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@idraw/board",
|
||||
"version": "0.2.0-alpha.23",
|
||||
"version": "0.2.0-alpha.24",
|
||||
"description": "",
|
||||
"main": "dist/index.cjs.js",
|
||||
"module": "dist/index.es.js",
|
||||
|
|
@ -24,10 +24,10 @@
|
|||
"author": "chenshenhai",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@idraw/types": "^0.2.0-alpha.23"
|
||||
"@idraw/types": "^0.2.0-alpha.24"
|
||||
},
|
||||
"dependencies": {
|
||||
"@idraw/util": "^0.2.0-alpha.23"
|
||||
"@idraw/util": "^0.2.0-alpha.24"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ const core = new Core(mount, {
|
|||
},
|
||||
elementWrapper: {
|
||||
lockColor: '#009688',
|
||||
color: '#e91e63',
|
||||
color: '#009688',
|
||||
controllerSize: 6,
|
||||
lineWidth: 1,
|
||||
// lineDash: [12, 12],
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@idraw/core",
|
||||
"version": "0.2.0-alpha.23",
|
||||
"version": "0.2.0-alpha.24",
|
||||
"description": "",
|
||||
"main": "dist/index.cjs.js",
|
||||
"module": "dist/index.es.js",
|
||||
|
|
@ -24,12 +24,12 @@
|
|||
"author": "chenshenhai",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@idraw/types": "^0.2.0-alpha.23"
|
||||
"@idraw/types": "^0.2.0-alpha.24"
|
||||
},
|
||||
"dependencies": {
|
||||
"@idraw/board": "^0.2.0-alpha.23",
|
||||
"@idraw/renderer": "^0.2.0-alpha.23",
|
||||
"@idraw/util": "^0.2.0-alpha.23"
|
||||
"@idraw/board": "^0.2.0-alpha.24",
|
||||
"@idraw/renderer": "^0.2.0-alpha.24",
|
||||
"@idraw/util": "^0.2.0-alpha.24"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "idraw",
|
||||
"version": "0.2.0-alpha.23",
|
||||
"version": "0.2.0-alpha.24",
|
||||
"description": "",
|
||||
"main": "dist/index.cjs.js",
|
||||
"module": "dist/index.es.js",
|
||||
|
|
@ -24,11 +24,11 @@
|
|||
"author": "chenshenhai",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@idraw/types": "^0.2.0-alpha.23"
|
||||
"@idraw/types": "^0.2.0-alpha.24"
|
||||
},
|
||||
"dependencies": {
|
||||
"@idraw/core": "^0.2.0-alpha.23",
|
||||
"@idraw/util": "^0.2.0-alpha.23"
|
||||
"@idraw/core": "^0.2.0-alpha.24",
|
||||
"@idraw/util": "^0.2.0-alpha.24"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@idraw/renderer",
|
||||
"version": "0.2.0-alpha.23",
|
||||
"version": "0.2.0-alpha.24",
|
||||
"description": "",
|
||||
"main": "dist/index.cjs.js",
|
||||
"module": "dist/index.es.js",
|
||||
|
|
@ -24,10 +24,10 @@
|
|||
"author": "chenshenhai",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@idraw/types": "^0.2.0-alpha.23"
|
||||
"@idraw/types": "^0.2.0-alpha.24"
|
||||
},
|
||||
"dependencies": {
|
||||
"@idraw/util": "^0.2.0-alpha.23"
|
||||
"@idraw/util": "^0.2.0-alpha.24"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@idraw/types",
|
||||
"version": "0.2.0-alpha.23",
|
||||
"version": "0.2.0-alpha.24",
|
||||
"description": "",
|
||||
"main": "src/index.ts",
|
||||
"types": "src/index.ts",
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ type TypeController = TypePoint & {
|
|||
type TypeHeplerSelectedElementWrapper = {
|
||||
uuid: string;
|
||||
controllerSize: number;
|
||||
controllerOffset: number;
|
||||
lock: boolean;
|
||||
controllers: {
|
||||
topLeft: TypeController,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@idraw/util",
|
||||
"version": "0.2.0-alpha.23",
|
||||
"version": "0.2.0-alpha.24",
|
||||
"description": "",
|
||||
"main": "dist/index.cjs.js",
|
||||
"module": "dist/index.es.js",
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
"author": "chenshenhai",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@idraw/types": "^0.2.0-alpha.23"
|
||||
"@idraw/types": "^0.2.0-alpha.24"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
|
|
|||
Loading…
Reference in a new issue