mirror of
https://github.com/konvajs/konva.git
synced 2025-04-05 20:48:28 +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.
|
||||
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)
|
||||
|
||||
- Typescript fixes
|
||||
|
13
konva.js
13
konva.js
@ -2060,9 +2060,11 @@
|
||||
});
|
||||
});
|
||||
class SceneContext extends Context {
|
||||
constructor(canvas) {
|
||||
constructor(canvas, { willReadFrequently = false } = {}) {
|
||||
super(canvas);
|
||||
this._context = canvas._canvas.getContext('2d');
|
||||
this._context = canvas._canvas.getContext('2d', {
|
||||
willReadFrequently,
|
||||
});
|
||||
}
|
||||
_fillColor(shape) {
|
||||
var fill = shape.fill();
|
||||
@ -2357,9 +2359,11 @@
|
||||
*/
|
||||
Factory.addGetterSetter(Canvas, 'pixelRatio', undefined, getNumberValidator());
|
||||
class SceneCanvas extends Canvas {
|
||||
constructor(config = { width: 0, height: 0 }) {
|
||||
constructor(config = { width: 0, height: 0, willReadFrequently: false }) {
|
||||
super(config);
|
||||
this.context = new SceneContext(this);
|
||||
this.context = new SceneContext(this, {
|
||||
willReadFrequently: config.willReadFrequently,
|
||||
});
|
||||
this.setSize(config.width, config.height);
|
||||
}
|
||||
}
|
||||
@ -2722,6 +2726,7 @@
|
||||
pixelRatio: pixelRatio,
|
||||
width: 0,
|
||||
height: 0,
|
||||
willReadFrequently: true,
|
||||
}), cachedHitCanvas = new HitCanvas({
|
||||
pixelRatio: hitCanvasPixelRatio,
|
||||
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);
|
||||
});
|
||||
|
||||
it('get point at path - bezier', function () {
|
||||
it.only('get point at path - bezier', function () {
|
||||
var stage = addStage();
|
||||
var layer = new Konva.Layer();
|
||||
const data =
|
||||
@ -1185,7 +1185,7 @@ describe('Path', function () {
|
||||
'path'
|
||||
) as SVGPathElement;
|
||||
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 circle = new Konva.Circle({
|
||||
x: p.x,
|
||||
@ -1207,7 +1207,7 @@ describe('Path', function () {
|
||||
}
|
||||
} else {
|
||||
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);
|
||||
points.push(p);
|
||||
var circle = new Konva.Circle({
|
||||
@ -1219,7 +1219,6 @@ describe('Path', function () {
|
||||
});
|
||||
layer.add(circle);
|
||||
}
|
||||
console.log(points);
|
||||
|
||||
assert.deepEqual(points, [
|
||||
{ x: 100, y: 250 },
|
||||
|
Loading…
Reference in New Issue
Block a user