Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: fix scale-direction for element #94

Merged
merged 13 commits into from
Sep 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/core/examples/features/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ html, body {
background-image:
linear-gradient(#aaaaaa2a 1px, transparent 0),
linear-gradient(90deg, #aaaaaa2a 1px, transparent 0),
linear-gradient(#aaaaaa1a 1px, transparent 0),
linear-gradient(90deg, #aaaaaa1a 1px, transparent 0);
linear-gradient(#aaaaaa4a 1px, transparent 0),
linear-gradient(90deg, #aaaaaa4a 1px, transparent 0);
background-size: 10px 10px, 10px 10px, 50px 50px, 50px 50px;
}

Expand Down
10 changes: 5 additions & 5 deletions packages/core/examples/features/lib/data/rect.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ const data = {
},
{
name: "rect-003",
x: 160,
y: 160,
w: 200,
x: 250,
y: 150,
w: 150,
h: 20,
type: "rect",
angle: 45,
Expand All @@ -50,8 +50,8 @@ const data = {
},
{
name: "rect-004",
x: 400 - 10,
y: 300 - 10,
x: 400 - 50,
y: 300 - 50,
w: 200,
h: 100,
type: "rect",
Expand Down
15 changes: 7 additions & 8 deletions packages/core/examples/features/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const core = new Core(mount, {
color: '#e91e63',
dotSize: 8,
lineWidth: 1,
lineDash: [12, 12],
// lineDash: [12, 12],
},
});

Expand Down Expand Up @@ -84,13 +84,12 @@ function initEvent() {
core.on('screenDoubleClickElement', (p) => {
console.log('screenDoubleClickElement ===', p)
})
core.on('drawFrame', () => {
console.log(' === drawFrame === ')
})
core.on('drawFrameComplete', () => {
console.log(' === drawFrameComplete === ')
})

}

// // TODO
core.on('drawFrame', () => {
console.log(' === drawFrame === ')
})
core.on('drawFrameComplete', () => {
console.log(' === drawFrameComplete === ')
})
3 changes: 3 additions & 0 deletions packages/core/src/constant/element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ const elementTypes = {

export const elementNames = Object.keys(elementTypes);


// limitQbliqueAngle
export const LIMIT_QBLIQUE_ANGLE = 15;
4 changes: 2 additions & 2 deletions packages/core/src/constant/static.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ export enum Mode {

export enum CursorStatus {
DRAGGING = 'dragging',
NULL = 'null'
}
NULL = 'null',
}
20 changes: 14 additions & 6 deletions packages/core/src/lib/draw/wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,21 @@ export function drawElementWrapper(ctx: TypeContext, config: TypeHelperConfig) {
// draw wrapper's dots
ctx.setFillStyle(wrapper.color);
[
wrapper.dots.topLeft, wrapper.dots.top, wrapper.dots.topRight, wrapper.dots.right,
wrapper.dots.bottomRight, wrapper.dots.bottom, wrapper.dots.bottomLeft, wrapper.dots.left,
wrapper.dots.topLeft,
wrapper.dots.top,
wrapper.dots.topRight,
wrapper.dots.right,
wrapper.dots.bottomRight,
wrapper.dots.bottom,
wrapper.dots.bottomLeft,
wrapper.dots.left,
].forEach((dot) => {
ctx.beginPath();
ctx.arc(dot.x, dot.y, wrapper.dotSize, 0, Math.PI * 2);
ctx.fill();
ctx.closePath();
if (dot.invisible !== true) {
ctx.beginPath();
ctx.arc(dot.x, dot.y, wrapper.dotSize, 0, Math.PI * 2);
ctx.fill();
ctx.closePath();
}
});
} else {
// draw wrapper's lock dots,
Expand Down
Loading