mirror of
https://github.com/konvajs/konva.git
synced 2025-06-28 15:23:44 +08:00
fix pointer events
This commit is contained in:
parent
a6bbbff406
commit
272627a2da
@ -3,6 +3,8 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
## 8.2.2
|
## 8.2.2
|
||||||
|
|
||||||
- Fix `Konva.Arrow` rendering when it has two pointers
|
- Fix `Konva.Arrow` rendering when it has two pointers
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
"test:build": "parcel build ./test/unit-tests.html --dist-dir test-build --target none --public-url ./ --no-source-maps",
|
"test:build": "parcel build ./test/unit-tests.html --dist-dir test-build --target none --public-url ./ --no-source-maps",
|
||||||
"test:browser": "npm run test:build && mocha-headless-chrome -f ./test-build/unit-tests.html -a disable-web-security",
|
"test:browser": "npm run test:build && mocha-headless-chrome -f ./test-build/unit-tests.html -a disable-web-security",
|
||||||
"test:node": "env TS_NODE_PROJECT=\"./test/tsconfig.json\" mocha -r ts-node/register test/unit/**/*.ts --exit && npm run test:import",
|
"test:node": "env TS_NODE_PROJECT=\"./test/tsconfig.json\" mocha -r ts-node/register test/unit/**/*.ts --exit && npm run test:import",
|
||||||
"test:watch": "rm -rf ./parcel-cache && parcel serve ./test/unit-tests.html ./test/manual-tests.html",
|
"test:watch": "rm -rf ./parcel-cache && parcel serve ./test/unit-tests.html ./test/manual-tests.html ./test/sandbox.html",
|
||||||
"tsc": "tsc --removeComments && tsc --build ./tsconfig-cmj.json",
|
"tsc": "tsc --removeComments && tsc --build ./tsconfig-cmj.json",
|
||||||
"rollup": "rollup -c",
|
"rollup": "rollup -c",
|
||||||
"clean": "rm -rf ./lib && rm -rf ./types && rm -rf ./cmj && rm -rf ./test-build",
|
"clean": "rm -rf ./lib && rm -rf ./types && rm -rf ./cmj && rm -rf ./test-build",
|
||||||
|
@ -965,8 +965,8 @@ export const Util = {
|
|||||||
},
|
},
|
||||||
_getFirstPointerId(evt) {
|
_getFirstPointerId(evt) {
|
||||||
if (!evt.touches) {
|
if (!evt.touches) {
|
||||||
// fake id for mouse
|
// try to use pointer id or fake id
|
||||||
return 999;
|
return evt.pointerId || 999;
|
||||||
} else {
|
} else {
|
||||||
return evt.changedTouches[0].identifier;
|
return evt.changedTouches[0].identifier;
|
||||||
}
|
}
|
||||||
|
@ -22,9 +22,53 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
Some text
|
|
||||||
<div id="container"></div>
|
<div id="container"></div>
|
||||||
<script src="../src/index.ts" type="module"></script>
|
<script type="module">
|
||||||
<script></script>
|
import Konva from '../src/index.ts';
|
||||||
|
const stage = new Konva.Stage({
|
||||||
|
container: 'container',
|
||||||
|
width: window.innerWidth,
|
||||||
|
height: window.innerHeight,
|
||||||
|
});
|
||||||
|
|
||||||
|
const layer = new Konva.Layer();
|
||||||
|
stage.add(layer);
|
||||||
|
|
||||||
|
for (var i = 0; i < 1; i++) {
|
||||||
|
const group = new Konva.Group();
|
||||||
|
layer.add(group);
|
||||||
|
for (var j = 0; j < 1; j++) {
|
||||||
|
const shape = new Konva.Circle({
|
||||||
|
x: stage.width() / 2,
|
||||||
|
y: stage.height() / 2,
|
||||||
|
radius: 50,
|
||||||
|
fill: 'green',
|
||||||
|
});
|
||||||
|
group.add(shape);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage.on('click', () => {
|
||||||
|
console.time('rect');
|
||||||
|
for (var i = 0; i < 50; i++) {
|
||||||
|
stage.getClientRect();
|
||||||
|
}
|
||||||
|
console.timeEnd('rect');
|
||||||
|
console.log('click');
|
||||||
|
});
|
||||||
|
|
||||||
|
// document.querySelector('canvas').addEventListener('pointerdown', (e) => {
|
||||||
|
// e.target.setPointerCapture(e.pointerId);
|
||||||
|
// });
|
||||||
|
|
||||||
|
stage.on('pointerup', () => {
|
||||||
|
console.log('stage pointer up');
|
||||||
|
});
|
||||||
|
window.onpointerup = () => {
|
||||||
|
console.log('window pointer up');
|
||||||
|
};
|
||||||
|
|
||||||
|
window.stage = stage;
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue
Block a user