mirror of
https://github.com/konvajs/konva.git
synced 2025-06-28 15:23:44 +08:00
make tests smaller
This commit is contained in:
parent
ac6de95024
commit
a82116d2ea
@ -3,6 +3,11 @@
|
|||||||
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.4.4 (2023-04-05)
|
||||||
|
|
||||||
|
- Some fixes for `Konva.TextPath` calculations and rendering.
|
||||||
|
- Resolve "willReadFrequently" warning in Chrome
|
||||||
|
|
||||||
### 8.4.3 (2023-03-23)
|
### 8.4.3 (2023-03-23)
|
||||||
|
|
||||||
- Typescript fixes
|
- Typescript fixes
|
||||||
|
13
konva.js
13
konva.js
@ -2060,9 +2060,11 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
class SceneContext extends Context {
|
class SceneContext extends Context {
|
||||||
constructor(canvas) {
|
constructor(canvas, { willReadFrequently = false } = {}) {
|
||||||
super(canvas);
|
super(canvas);
|
||||||
this._context = canvas._canvas.getContext('2d');
|
this._context = canvas._canvas.getContext('2d', {
|
||||||
|
willReadFrequently,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
_fillColor(shape) {
|
_fillColor(shape) {
|
||||||
var fill = shape.fill();
|
var fill = shape.fill();
|
||||||
@ -2357,9 +2359,11 @@
|
|||||||
*/
|
*/
|
||||||
Factory.addGetterSetter(Canvas, 'pixelRatio', undefined, getNumberValidator());
|
Factory.addGetterSetter(Canvas, 'pixelRatio', undefined, getNumberValidator());
|
||||||
class SceneCanvas extends Canvas {
|
class SceneCanvas extends Canvas {
|
||||||
constructor(config = { width: 0, height: 0 }) {
|
constructor(config = { width: 0, height: 0, willReadFrequently: false }) {
|
||||||
super(config);
|
super(config);
|
||||||
this.context = new SceneContext(this);
|
this.context = new SceneContext(this, {
|
||||||
|
willReadFrequently: config.willReadFrequently,
|
||||||
|
});
|
||||||
this.setSize(config.width, config.height);
|
this.setSize(config.width, config.height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2722,6 +2726,7 @@
|
|||||||
pixelRatio: pixelRatio,
|
pixelRatio: pixelRatio,
|
||||||
width: 0,
|
width: 0,
|
||||||
height: 0,
|
height: 0,
|
||||||
|
willReadFrequently: true,
|
||||||
}), cachedHitCanvas = new HitCanvas({
|
}), cachedHitCanvas = new HitCanvas({
|
||||||
pixelRatio: hitCanvasPixelRatio,
|
pixelRatio: hitCanvasPixelRatio,
|
||||||
width: width,
|
width: width,
|
||||||
|
2
konva.min.js
vendored
2
konva.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1168,7 +1168,7 @@ describe('Path', function () {
|
|||||||
stage.add(layer);
|
stage.add(layer);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('get point at path - bezier', function () {
|
it.only('get point at path - bezier', function () {
|
||||||
var stage = addStage();
|
var stage = addStage();
|
||||||
var layer = new Konva.Layer();
|
var layer = new Konva.Layer();
|
||||||
const data =
|
const data =
|
||||||
@ -1185,7 +1185,7 @@ describe('Path', function () {
|
|||||||
'path'
|
'path'
|
||||||
) as SVGPathElement;
|
) as SVGPathElement;
|
||||||
SVGPath.setAttribute('d', data);
|
SVGPath.setAttribute('d', data);
|
||||||
for (var i = 0; i < path.getLength(); i += 1) {
|
for (var i = 0; i < path.getLength(); i += 10) {
|
||||||
var p = path.getPointAtLength(i);
|
var p = path.getPointAtLength(i);
|
||||||
var circle = new Konva.Circle({
|
var circle = new Konva.Circle({
|
||||||
x: p.x,
|
x: p.x,
|
||||||
@ -1207,7 +1207,7 @@ describe('Path', function () {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var points = [];
|
var points = [];
|
||||||
for (var i = 0; i < path.getLength(); i += 100) {
|
for (var i = 0; i < path.getLength(); i += 500) {
|
||||||
var p = path.getPointAtLength(i);
|
var p = path.getPointAtLength(i);
|
||||||
points.push(p);
|
points.push(p);
|
||||||
var circle = new Konva.Circle({
|
var circle = new Konva.Circle({
|
||||||
@ -1219,7 +1219,6 @@ describe('Path', function () {
|
|||||||
});
|
});
|
||||||
layer.add(circle);
|
layer.add(circle);
|
||||||
}
|
}
|
||||||
console.log(points);
|
|
||||||
|
|
||||||
assert.deepEqual(points, [
|
assert.deepEqual(points, [
|
||||||
{ x: 100, y: 250 },
|
{ x: 100, y: 250 },
|
||||||
|
Loading…
Reference in New Issue
Block a user