Comments (1)
I think i made it work with this code:
_transformedRect(rect, top) {
let points = [
{ x: rect.x, y: rect.y },
{ x: rect.x + rect.width, y: rect.y },
{ x: rect.x + rect.width, y: rect.y + rect.height },
{ x: rect.x, y: rect.y + rect.height },
];
let trans = this.getAbsoluteTransform(top);
points = points.map(function (point) {
return trans.point(point);
});
let centerX = (points[0].x + points[1].x + points[2].x + points[3].x) / 4;
let centerY = (points[0].y + points[1].y + points[2].y + points[3].y) / 4;
let minX = centerX - rect.width / 2;
let minY = centerY - rect.height / 2;
let maxX = centerX + rect.width / 2;
let maxY = centerY + rect.height / 2;
return {
x: minX,
y: minY,
width: maxX - minX,
height: maxY - minY,
};
}
from konva.
Related Issues (20)
- Event when you mousedown and move outside canvas. HOT 1
- Can we draw an un-closed ellipse like below? HOT 1
- Text wrong line break if have Chinese and english word HOT 1
- Broken shadow after crop in safari HOT 3
- Problem with Loading Video (Konva.Node.create) HOT 1
- After caching the lines, if there is a scaling factor, the line width may appear abnormal
- Vertical text position is different between Safari and other browsers HOT 5
- Konva React Text - Cannot use SVG for text pattern HOT 1
- Different scaling behavior on SVGs in different browsers HOT 1
- path fill miss somre area HOT 2
- Mouseup triggered the click event for the image, and I hope he doesn't trigger it๏ผIt's not as simple as imagined HOT 1
- `pointerclick` is fired on drag enq but `click` is not HOT 3
- Request: add package-lock.json file (`npm run build` broken) HOT 2
- Position of group not not consistent between stages after drag HOT 1
- shape.getClientRect() is not updated after layer.cache() HOT 2
- Strange behavior when fillingPatternImage and clone update HOT 2
- Terminal Error: Command failed with exit code 3221225477. HOT 2
- Cannot read 'isDragging' even though importing (unused) Core HOT 4
- HTML canvas disappears in Chrome after browser window/tab becomes inactive HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from konva.