mirror of
https://github.com/konvajs/konva.git
synced 2025-04-05 20:48:28 +08:00
fix bug with getAllIntersections and Text shape. close #224
This commit is contained in:
parent
8d1fd1218f
commit
865577b7e6
@ -4,6 +4,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
|
|
||||||
## [Not released][Not released]
|
## [Not released][Not released]
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- getAllIntersections now works ok for Text shapes (https://github.com/konvajs/konva/issues/224)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Konva a bit changed a way to detect pointer position. Now it should be OK to apply css transform on Konva container. https://github.com/konvajs/konva/pull/215
|
- Konva a bit changed a way to detect pointer position. Now it should be OK to apply css transform on Konva container. https://github.com/konvajs/konva/pull/215
|
||||||
|
|
||||||
|
4
konva.js
4
konva.js
@ -2,7 +2,7 @@
|
|||||||
* Konva JavaScript Framework v1.5.0
|
* Konva JavaScript Framework v1.5.0
|
||||||
* http://konvajs.github.io/
|
* http://konvajs.github.io/
|
||||||
* Licensed under the MIT or GPL Version 2 licenses.
|
* Licensed under the MIT or GPL Version 2 licenses.
|
||||||
* Date: Fri Mar 24 2017
|
* Date: Fri Apr 21 2017
|
||||||
*
|
*
|
||||||
* Original work Copyright (C) 2011 - 2013 by Eric Rowell (KineticJS)
|
* Original work Copyright (C) 2011 - 2013 by Eric Rowell (KineticJS)
|
||||||
* Modified work Copyright (C) 2014 - 2017 by Anton Lavrenov (Konva)
|
* Modified work Copyright (C) 2014 - 2017 by Anton Lavrenov (Konva)
|
||||||
@ -8281,7 +8281,7 @@
|
|||||||
var stage = this.getStage(), bufferHitCanvas = stage.bufferHitCanvas, p;
|
var stage = this.getStage(), bufferHitCanvas = stage.bufferHitCanvas, p;
|
||||||
|
|
||||||
bufferHitCanvas.getContext().clear();
|
bufferHitCanvas.getContext().clear();
|
||||||
this.drawScene(bufferHitCanvas);
|
this.drawHit(bufferHitCanvas);
|
||||||
p = bufferHitCanvas.context.getImageData(
|
p = bufferHitCanvas.context.getImageData(
|
||||||
Math.round(point.x),
|
Math.round(point.x),
|
||||||
Math.round(point.y),
|
Math.round(point.y),
|
||||||
|
4
konva.min.js
vendored
4
konva.min.js
vendored
File diff suppressed because one or more lines are too long
@ -183,7 +183,7 @@
|
|||||||
var stage = this.getStage(), bufferHitCanvas = stage.bufferHitCanvas, p;
|
var stage = this.getStage(), bufferHitCanvas = stage.bufferHitCanvas, p;
|
||||||
|
|
||||||
bufferHitCanvas.getContext().clear();
|
bufferHitCanvas.getContext().clear();
|
||||||
this.drawScene(bufferHitCanvas);
|
this.drawHit(bufferHitCanvas);
|
||||||
p = bufferHitCanvas.context.getImageData(
|
p = bufferHitCanvas.context.getImageData(
|
||||||
Math.round(point.x),
|
Math.round(point.x),
|
||||||
Math.round(point.y),
|
Math.round(point.y),
|
||||||
|
@ -467,6 +467,30 @@ suite('Stage', function() {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ======================================================
|
||||||
|
test('test getAllIntersections for text', function() {
|
||||||
|
var stage = addStage();
|
||||||
|
var layer = new Konva.Layer();
|
||||||
|
|
||||||
|
var text = new Konva.Text({
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
text: 'Hello world',
|
||||||
|
fontSize: 50,
|
||||||
|
name: 'intersectText'
|
||||||
|
});
|
||||||
|
|
||||||
|
layer.add(text);
|
||||||
|
stage.add(layer);
|
||||||
|
|
||||||
|
// test individual shapes
|
||||||
|
assert.equal(
|
||||||
|
stage.getAllIntersections({ x: 10, y: 10 }).length,
|
||||||
|
1,
|
||||||
|
'17) getAllIntersections should return one shape'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
// ======================================================
|
// ======================================================
|
||||||
test('scale stage after add layer', function() {
|
test('scale stage after add layer', function() {
|
||||||
var stage = addStage();
|
var stage = addStage();
|
||||||
|
Loading…
Reference in New Issue
Block a user