mirror of
https://github.com/konvajs/konva.git
synced 2025-09-18 09:50:05 +08:00
chore: apply prettier formatting
This commit is contained in:
@@ -1413,7 +1413,6 @@ That changes are private and internal specific. They should not break most of `K
|
|||||||
Differences from last official `KineticJS` release
|
Differences from last official `KineticJS` release
|
||||||
|
|
||||||
- Bug Fixes
|
- Bug Fixes
|
||||||
|
|
||||||
- `strokeScaleEnabled = false` is disabled for text as I can not find a way to implement this
|
- `strokeScaleEnabled = false` is disabled for text as I can not find a way to implement this
|
||||||
- `strokeScaleEnabled = false` for Line now creates a correct hit graph
|
- `strokeScaleEnabled = false` for Line now creates a correct hit graph
|
||||||
- working "this-example" as name for nodes
|
- working "this-example" as name for nodes
|
||||||
|
@@ -66,7 +66,7 @@ At the current moment `Konva` doesn't work in IE11 directly. To make it work you
|
|||||||
|
|
||||||
# Debugging
|
# Debugging
|
||||||
|
|
||||||
The Chrome inspector simply shows the canvas element. To see the Konva objects and their details, install the konva-dev extension at https://github.com/konvajs/konva-devtool.
|
The Chrome inspector simply shows the canvas element. To see the Konva objects and their details, install the konva-dev extension at https://github.com/konvajs/konva-devtool.
|
||||||
|
|
||||||
# Loading and installing Konva
|
# Loading and installing Konva
|
||||||
|
|
||||||
|
@@ -1,28 +1,28 @@
|
|||||||
{
|
{
|
||||||
"path" : "ink-docstrap",
|
"path": "ink-docstrap",
|
||||||
"tags" : {
|
"tags": {
|
||||||
"allowUnknownTags" : true
|
"allowUnknownTags": true
|
||||||
},
|
},
|
||||||
"plugins" : ["plugins/markdown"],
|
"plugins": ["plugins/markdown"],
|
||||||
|
|
||||||
"templates" : {
|
"templates": {
|
||||||
"cleverLinks" : false,
|
"cleverLinks": false,
|
||||||
"monospaceLinks" : false,
|
"monospaceLinks": false,
|
||||||
"dateFormat" : "ddd MMM Do YYYY",
|
"dateFormat": "ddd MMM Do YYYY",
|
||||||
"outputSourceFiles" : true,
|
"outputSourceFiles": true,
|
||||||
"outputSourcePath" : true,
|
"outputSourcePath": true,
|
||||||
"systemName" : "Konva",
|
"systemName": "Konva",
|
||||||
"footer" : "",
|
"footer": "",
|
||||||
"copyright" : "Konva Copyright © 2015 The contributors to the Konva project.",
|
"copyright": "Konva Copyright © 2015 The contributors to the Konva project.",
|
||||||
"navType" : "vertical",
|
"navType": "vertical",
|
||||||
"theme" : "cosmo",
|
"theme": "cosmo",
|
||||||
"linenums" : true,
|
"linenums": true,
|
||||||
"collapseSymbols" : false,
|
"collapseSymbols": false,
|
||||||
"inverseNav" : true,
|
"inverseNav": true,
|
||||||
"highlightTutorialCode" : true
|
"highlightTutorialCode": true
|
||||||
},
|
},
|
||||||
"markdown" : {
|
"markdown": {
|
||||||
"parser" : "gfm",
|
"parser": "gfm",
|
||||||
"hardwrap" : true
|
"hardwrap": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -30,7 +30,7 @@ export interface ContainerConfig extends NodeConfig {
|
|||||||
* @@containerParams
|
* @@containerParams
|
||||||
*/
|
*/
|
||||||
export abstract class Container<
|
export abstract class Container<
|
||||||
ChildType extends Node = Node
|
ChildType extends Node = Node,
|
||||||
> extends Node<ContainerConfig> {
|
> extends Node<ContainerConfig> {
|
||||||
children: Array<ChildType> = [];
|
children: Array<ChildType> = [];
|
||||||
|
|
||||||
|
@@ -46,12 +46,10 @@ type ValidatorFunc<T> = (val: ExtractGetSet<T>, attr: string) => T;
|
|||||||
/**
|
/**
|
||||||
* Extracts the "components" (keys) of a GetSet value. The value must be an object.
|
* Extracts the "components" (keys) of a GetSet value. The value must be an object.
|
||||||
*/
|
*/
|
||||||
type ExtractComponents<T extends Constructor, U extends Attr<T>> = Value<
|
type ExtractComponents<T extends Constructor, U extends Attr<T>> =
|
||||||
T,
|
Value<T, U> extends Record<string, any>
|
||||||
U
|
? EnforceString<keyof Value<T, U>>[]
|
||||||
> extends Record<string, any>
|
: never;
|
||||||
? EnforceString<keyof Value<T, U>>[]
|
|
||||||
: never;
|
|
||||||
|
|
||||||
export const Factory = {
|
export const Factory = {
|
||||||
addGetterSetter<T extends Constructor, U extends Attr<T>>(
|
addGetterSetter<T extends Constructor, U extends Attr<T>>(
|
||||||
|
@@ -30,10 +30,10 @@ export const glob: any =
|
|||||||
typeof global !== 'undefined'
|
typeof global !== 'undefined'
|
||||||
? global
|
? global
|
||||||
: typeof window !== 'undefined'
|
: typeof window !== 'undefined'
|
||||||
? window
|
? window
|
||||||
: typeof WorkerGlobalScope !== 'undefined'
|
: typeof WorkerGlobalScope !== 'undefined'
|
||||||
? self
|
? self
|
||||||
: {};
|
: {};
|
||||||
|
|
||||||
export const Konva = {
|
export const Konva = {
|
||||||
_global: glob,
|
_global: glob,
|
||||||
|
@@ -188,7 +188,7 @@ function _clearRadialGradientCache(this: Node) {
|
|||||||
*});
|
*});
|
||||||
*/
|
*/
|
||||||
export class Shape<
|
export class Shape<
|
||||||
Config extends ShapeConfig = ShapeConfig
|
Config extends ShapeConfig = ShapeConfig,
|
||||||
> extends Node<Config> {
|
> extends Node<Config> {
|
||||||
_centroid: boolean;
|
_centroid: boolean;
|
||||||
colorKey: string;
|
colorKey: string;
|
||||||
|
27
src/Util.ts
27
src/Util.ts
@@ -1068,16 +1068,16 @@ export const Util = {
|
|||||||
);
|
);
|
||||||
context.lineTo(xOrigin, yOrigin + topLeft);
|
context.lineTo(xOrigin, yOrigin + topLeft);
|
||||||
context.arc(
|
context.arc(
|
||||||
xOrigin + topLeft,
|
xOrigin + topLeft,
|
||||||
yOrigin + topLeft,
|
yOrigin + topLeft,
|
||||||
topLeft,
|
topLeft,
|
||||||
Math.PI,
|
Math.PI,
|
||||||
(Math.PI * 3) / 2,
|
(Math.PI * 3) / 2,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
drawRoundedPolygonPath(
|
drawRoundedPolygonPath(
|
||||||
context: Context,
|
context: Context,
|
||||||
points: Vector2d[],
|
points: Vector2d[],
|
||||||
sides: number,
|
sides: number,
|
||||||
radius: number,
|
radius: number,
|
||||||
@@ -1088,8 +1088,8 @@ export const Util = {
|
|||||||
const prev = points[(i - 1 + sides) % sides];
|
const prev = points[(i - 1 + sides) % sides];
|
||||||
const curr = points[i];
|
const curr = points[i];
|
||||||
const next = points[(i + 1) % sides];
|
const next = points[(i + 1) % sides];
|
||||||
const vec1 = {x: curr.x - prev.x, y: curr.y - prev.y};
|
const vec1 = { x: curr.x - prev.x, y: curr.y - prev.y };
|
||||||
const vec2 = {x: next.x - curr.x, y: next.y - curr.y};
|
const vec2 = { x: next.x - curr.x, y: next.y - curr.y };
|
||||||
const len1 = Math.hypot(vec1.x, vec1.y);
|
const len1 = Math.hypot(vec1.x, vec1.y);
|
||||||
const len2 = Math.hypot(vec2.x, vec2.y);
|
const len2 = Math.hypot(vec2.x, vec2.y);
|
||||||
let currCornerRadius;
|
let currCornerRadius;
|
||||||
@@ -1100,9 +1100,10 @@ export const Util = {
|
|||||||
}
|
}
|
||||||
const maxCornerRadius = radius * Math.cos(Math.PI / sides);
|
const maxCornerRadius = radius * Math.cos(Math.PI / sides);
|
||||||
// cornerRadius creates perfect circle at 1/2 radius
|
// cornerRadius creates perfect circle at 1/2 radius
|
||||||
currCornerRadius = maxCornerRadius * Math.min(1, (currCornerRadius / radius) * 2);
|
currCornerRadius =
|
||||||
const normalVec1 = {x: vec1.x / len1, y: vec1.y / len1};
|
maxCornerRadius * Math.min(1, (currCornerRadius / radius) * 2);
|
||||||
const normalVec2 = {x: vec2.x / len2, y: vec2.y / len2};
|
const normalVec1 = { x: vec1.x / len1, y: vec1.y / len1 };
|
||||||
|
const normalVec2 = { x: vec2.x / len2, y: vec2.y / len2 };
|
||||||
const p1 = {
|
const p1 = {
|
||||||
x: curr.x - normalVec1.x * currCornerRadius,
|
x: curr.x - normalVec1.x * currCornerRadius,
|
||||||
y: curr.y - normalVec1.y * currCornerRadius,
|
y: curr.y - normalVec1.y * currCornerRadius,
|
||||||
@@ -1118,5 +1119,5 @@ export const Util = {
|
|||||||
}
|
}
|
||||||
context.arcTo(curr.x, curr.y, p2.x, p2.y, currCornerRadius);
|
context.arcTo(curr.x, curr.y, p2.x, p2.y, currCornerRadius);
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
@@ -31,7 +31,7 @@ export const Emboss: Filter = function (imageData) {
|
|||||||
w = imageData.width,
|
w = imageData.width,
|
||||||
h = imageData.height,
|
h = imageData.height,
|
||||||
w4 = w * 4;
|
w4 = w * 4;
|
||||||
let dirY = 0,
|
let dirY = 0,
|
||||||
dirX = 0,
|
dirX = 0,
|
||||||
y = h;
|
y = h;
|
||||||
|
|
||||||
|
@@ -2,7 +2,13 @@ import { Factory } from '../Factory';
|
|||||||
import { Node, Filter } from '../Node';
|
import { Node, Filter } from '../Node';
|
||||||
import { getNumberValidator } from '../Validators';
|
import { getNumberValidator } from '../Validators';
|
||||||
|
|
||||||
function remap(fromValue: number, fromMin: number, fromMax: number, toMin: number, toMax: number) {
|
function remap(
|
||||||
|
fromValue: number,
|
||||||
|
fromMin: number,
|
||||||
|
fromMax: number,
|
||||||
|
toMin: number,
|
||||||
|
toMax: number
|
||||||
|
) {
|
||||||
// Compute the range of the data
|
// Compute the range of the data
|
||||||
const fromRange = fromMax - fromMin,
|
const fromRange = fromMax - fromMin,
|
||||||
toRange = toMax - toMin;
|
toRange = toMax - toMin;
|
||||||
|
@@ -116,7 +116,8 @@ const FromPolar = function (src, dst, opt) {
|
|||||||
const dx = x - xMid;
|
const dx = x - xMid;
|
||||||
const dy = y - yMid;
|
const dy = y - yMid;
|
||||||
const radius = (Math.sqrt(dx * dx + dy * dy) * rSize) / rMax;
|
const radius = (Math.sqrt(dx * dx + dy * dy) * rSize) / rMax;
|
||||||
let theta = ((Math.atan2(dy, dx) * 180) / Math.PI + 360 + phaseShift) % 360;
|
let theta =
|
||||||
|
((Math.atan2(dy, dx) * 180) / Math.PI + 360 + phaseShift) % 360;
|
||||||
theta = (theta * tSize) / 360;
|
theta = (theta * tSize) / 360;
|
||||||
x1 = Math.floor(theta);
|
x1 = Math.floor(theta);
|
||||||
y1 = Math.floor(radius);
|
y1 = Math.floor(radius);
|
||||||
|
@@ -138,7 +138,17 @@ function dilateMask(mask, sw, sh) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function smoothEdgeMask(mask, sw: number, sh: number) {
|
function smoothEdgeMask(mask, sw: number, sh: number) {
|
||||||
const weights = [1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9];
|
const weights = [
|
||||||
|
1 / 9,
|
||||||
|
1 / 9,
|
||||||
|
1 / 9,
|
||||||
|
1 / 9,
|
||||||
|
1 / 9,
|
||||||
|
1 / 9,
|
||||||
|
1 / 9,
|
||||||
|
1 / 9,
|
||||||
|
1 / 9,
|
||||||
|
];
|
||||||
const side = Math.round(Math.sqrt(weights.length));
|
const side = Math.round(Math.sqrt(weights.length));
|
||||||
const halfSide = Math.floor(side / 2);
|
const halfSide = Math.floor(side / 2);
|
||||||
|
|
||||||
|
@@ -97,7 +97,7 @@ export interface LineConfig extends ShapeConfig {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
export class Line<
|
export class Line<
|
||||||
Config extends LineConfig = LineConfig
|
Config extends LineConfig = LineConfig,
|
||||||
> extends Shape<Config> {
|
> extends Shape<Config> {
|
||||||
constructor(config?: Config) {
|
constructor(config?: Config) {
|
||||||
super(config);
|
super(config);
|
||||||
|
@@ -1,7 +1,10 @@
|
|||||||
import { Factory } from '../Factory';
|
import { Factory } from '../Factory';
|
||||||
import { Shape, ShapeConfig } from '../Shape';
|
import { Shape, ShapeConfig } from '../Shape';
|
||||||
import { GetSet, Vector2d } from '../types';
|
import { GetSet, Vector2d } from '../types';
|
||||||
import { getNumberOrArrayOfNumbersValidator, getNumberValidator } from '../Validators';
|
import {
|
||||||
|
getNumberOrArrayOfNumbersValidator,
|
||||||
|
getNumberValidator,
|
||||||
|
} from '../Validators';
|
||||||
import { _registerNode } from '../Global';
|
import { _registerNode } from '../Global';
|
||||||
import { Context } from '../Context';
|
import { Context } from '../Context';
|
||||||
import { Util } from '../Util';
|
import { Util } from '../Util';
|
||||||
|
@@ -416,8 +416,8 @@ export class Text extends Shape<TextConfig> {
|
|||||||
const str = Util._isString(text)
|
const str = Util._isString(text)
|
||||||
? text
|
? text
|
||||||
: text === null || text === undefined
|
: text === null || text === undefined
|
||||||
? ''
|
? ''
|
||||||
: text + '';
|
: text + '';
|
||||||
this._setAttr(TEXT, str);
|
this._setAttr(TEXT, str);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
|
|||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<style>
|
<style>
|
||||||
|
@@ -1,14 +1,16 @@
|
|||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8" />
|
||||||
<title>KonvaJS Sandbox</title>
|
<title>KonvaJS Sandbox</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=1.0, minimum-scale=1.0, maximum-scale=1.0">
|
<meta
|
||||||
</head>
|
name="viewport"
|
||||||
|
content="width=device-width, initial-scale=1.0, user-scalable=1.0, minimum-scale=1.0, maximum-scale=1.0"
|
||||||
<body>
|
/>
|
||||||
<!-- testing Konva inside iframe -->
|
</head>
|
||||||
<iframe src="./sandbox.html"></iframe>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<!-- testing Konva inside iframe -->
|
||||||
|
<iframe src="./sandbox.html"></iframe>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<style>
|
<style>
|
||||||
@@ -39,13 +39,13 @@
|
|||||||
var canvas = document.getElementById('canvas');
|
var canvas = document.getElementById('canvas');
|
||||||
canvas.width = width;
|
canvas.width = width;
|
||||||
canvas.height = height;
|
canvas.height = height;
|
||||||
|
|
||||||
var ctx = canvas.getContext('2d');
|
var ctx = canvas.getContext('2d');
|
||||||
|
|
||||||
stats = new Stats();
|
stats = new Stats();
|
||||||
|
|
||||||
wabbitTexture = new Image();
|
wabbitTexture = new Image();
|
||||||
wabbitTexture.onload = function() {
|
wabbitTexture.onload = function () {
|
||||||
_handleTextureLoaded();
|
_handleTextureLoaded();
|
||||||
};
|
};
|
||||||
wabbitTexture.src = '../assets/bunny.png';
|
wabbitTexture.src = '../assets/bunny.png';
|
||||||
@@ -66,12 +66,11 @@
|
|||||||
count = startBunnyCount;
|
count = startBunnyCount;
|
||||||
counter.innerHTML = startBunnyCount + ' BUNNIES';
|
counter.innerHTML = startBunnyCount + ' BUNNIES';
|
||||||
|
|
||||||
|
canvas.addEventListener('mousedown', function () {
|
||||||
canvas.addEventListener('mousedown', function() {
|
|
||||||
isAdding = true;
|
isAdding = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
canvas.addEventListener('mouseup', function() {
|
canvas.addEventListener('mouseup', function () {
|
||||||
isAdding = false;
|
isAdding = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -84,8 +83,8 @@
|
|||||||
x: 10,
|
x: 10,
|
||||||
y: 10,
|
y: 10,
|
||||||
speedX: Math.random() * 10,
|
speedX: Math.random() * 10,
|
||||||
speedY: Math.random() * 10 - 5
|
speedY: Math.random() * 10 - 5,
|
||||||
}
|
};
|
||||||
bunnys.push(bunny);
|
bunnys.push(bunny);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -108,8 +107,8 @@
|
|||||||
x: 10,
|
x: 10,
|
||||||
y: 10,
|
y: 10,
|
||||||
speedX: Math.random() * 10,
|
speedX: Math.random() * 10,
|
||||||
speedY: Math.random() * 10 - 5
|
speedY: Math.random() * 10 - 5,
|
||||||
}
|
};
|
||||||
bunnys.push(bunny);
|
bunnys.push(bunny);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
@@ -124,28 +123,27 @@
|
|||||||
bunny.speedY += gravity;
|
bunny.speedY += gravity;
|
||||||
if (bunny.x > maxX - wabbitTexture.width) {
|
if (bunny.x > maxX - wabbitTexture.width) {
|
||||||
bunny.speedX *= -1;
|
bunny.speedX *= -1;
|
||||||
bunny.x = (maxX - wabbitTexture.width);
|
bunny.x = maxX - wabbitTexture.width;
|
||||||
} else if (bunny.x < minX) {
|
} else if (bunny.x < minX) {
|
||||||
bunny.speedX *= -1;
|
bunny.speedX *= -1;
|
||||||
bunny.x = (minX);
|
bunny.x = minX;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bunny.y > maxY - wabbitTexture.height) {
|
if (bunny.y > maxY - wabbitTexture.height) {
|
||||||
bunny.speedY *= -0.85;
|
bunny.speedY *= -0.85;
|
||||||
bunny.y = (maxY - wabbitTexture.height);
|
bunny.y = maxY - wabbitTexture.height;
|
||||||
if (Math.random() > 0.5) {
|
if (Math.random() > 0.5) {
|
||||||
bunny.speedY -= Math.random() * 6;
|
bunny.speedY -= Math.random() * 6;
|
||||||
}
|
}
|
||||||
} else if (bunny.y < minY) {
|
} else if (bunny.y < minY) {
|
||||||
bunny.speedY = 0;
|
bunny.speedY = 0;
|
||||||
bunny.y = (minY);
|
bunny.y = minY;
|
||||||
}
|
}
|
||||||
ctx.save();
|
ctx.save();
|
||||||
ctx.transform(1, 0, 0, 1, bunny.x, bunny.y);
|
ctx.transform(1, 0, 0, 1, bunny.x, bunny.y);
|
||||||
ctx.drawImage(wabbitTexture, 0, 0);
|
ctx.drawImage(wabbitTexture, 0, 0);
|
||||||
ctx.restore();
|
ctx.restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
requestAnimationFrame(update);
|
requestAnimationFrame(update);
|
||||||
stats.end();
|
stats.end();
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<style>
|
<style>
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<style>
|
<style>
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
|
@@ -247,11 +247,10 @@ describe('Arrow', function () {
|
|||||||
});
|
});
|
||||||
layer.add(arrow);
|
layer.add(arrow);
|
||||||
|
|
||||||
|
|
||||||
stage.add(layer);
|
stage.add(layer);
|
||||||
|
|
||||||
var rect = arrow.getClientRect({ skipStroke: true });
|
var rect = arrow.getClientRect({ skipStroke: true });
|
||||||
layer.add(new Konva.Rect({...rect, stroke: 'red' }));
|
layer.add(new Konva.Rect({ ...rect, stroke: 'red' }));
|
||||||
|
|
||||||
assert.equal(rect.x, 50);
|
assert.equal(rect.x, 50);
|
||||||
assert.equal(rect.y, 40);
|
assert.equal(rect.y, 40);
|
||||||
|
@@ -2605,8 +2605,10 @@ describe('Container', function () {
|
|||||||
stage.scale({ x: 2, y: 2 });
|
stage.scale({ x: 2, y: 2 });
|
||||||
stage.draw();
|
stage.draw();
|
||||||
|
|
||||||
var data = layer.getHitCanvas().getContext().getImageData(48, 100, 1, 1)
|
var data = layer
|
||||||
.data;
|
.getHitCanvas()
|
||||||
|
.getContext()
|
||||||
|
.getImageData(48, 100, 1, 1).data;
|
||||||
var isTransparent = data[3] == 0;
|
var isTransparent = data[3] == 0;
|
||||||
assert.equal(
|
assert.equal(
|
||||||
isTransparent,
|
isTransparent,
|
||||||
|
@@ -333,230 +333,81 @@ describe('Line', function () {
|
|||||||
x: 0,
|
x: 0,
|
||||||
y: 0,
|
y: 0,
|
||||||
points: [
|
points: [
|
||||||
494.39880507841673,
|
494.39880507841673, 795.3696788648244, 494.49880507841675,
|
||||||
795.3696788648244,
|
795.4696788648245, 494.39880507841673, 796.8633308439133,
|
||||||
494.49880507841675,
|
489.9178491411501, 798.3569828230022, 480.95593726661684,
|
||||||
795.4696788648245,
|
802.8379387602688, 467.513069454817, 810.3061986557132,
|
||||||
494.39880507841673,
|
451.0828976848394, 820.7617625093353, 433.15907393577294,
|
||||||
796.8633308439133,
|
832.7109783420462, 415.2352501867065, 846.1538461538461,
|
||||||
489.9178491411501,
|
398.8050784167289, 859.596713965646, 383.8685586258402,
|
||||||
798.3569828230022,
|
871.545929798357, 374.90664675130694, 880.5078416728902,
|
||||||
480.95593726661684,
|
371.9193427931292, 883.4951456310679, 371.9193427931292,
|
||||||
802.8379387602688,
|
883.4951456310679, 371.9193427931292, 883.4951456310679,
|
||||||
467.513069454817,
|
376.40029873039583, 882.0014936519791, 395.8177744585511,
|
||||||
810.3061986557132,
|
876.0268857356235, 443.6146377893951, 856.6094100074682,
|
||||||
451.0828976848394,
|
507.84167289021656, 838.6855862584017, 551.1575802837939,
|
||||||
820.7617625093353,
|
825.2427184466019, 624.3465272591486, 807.3188946975355,
|
||||||
433.15907393577294,
|
696.0418222554144, 789.395070948469, 758.7752053771471,
|
||||||
832.7109783420462,
|
777.445855115758, 802.0911127707244, 772.9648991784914,
|
||||||
415.2352501867065,
|
820.0149365197909, 771.4712471994025, 821.5085884988797,
|
||||||
846.1538461538461,
|
771.4712471994025, 820.0149365197909, 775.9522031366691,
|
||||||
398.8050784167289,
|
799.1038088125466, 790.8887229275579, 743.8386855862584,
|
||||||
859.596713965646,
|
825.2427184466019, 652.7259148618372, 871.545929798357,
|
||||||
383.8685586258402,
|
542.1956684092606, 926.8110530246452, 455.563853622106,
|
||||||
871.545929798357,
|
977.5952203136669, 412.24794622852875, 1010.455563853622,
|
||||||
374.90664675130694,
|
397.31142643764, 1026.8857356235997, 397.31142643764,
|
||||||
880.5078416728902,
|
1032.8603435399552, 400.29873039581776, 1038.8349514563106,
|
||||||
371.9193427931292,
|
415.2352501867065, 1043.3159073935774, 463.0321135175504,
|
||||||
883.4951456310679,
|
1043.3159073935774, 563.1067961165048, 1040.3286034353996,
|
||||||
371.9193427931292,
|
696.0418222554144, 1032.8603435399552, 787.1545929798357,
|
||||||
883.4951456310679,
|
1026.8857356235997, 921.5832710978342, 1017.9238237490664,
|
||||||
371.9193427931292,
|
1018.6706497386109, 1013.4428678117998, 1069.4548170276325,
|
||||||
883.4951456310679,
|
1013.4428678117998, 1076.923076923077, 1013.4428678117998,
|
||||||
376.40029873039583,
|
1075.4294249439881, 1014.9365197908887, 1051.530993278566,
|
||||||
882.0014936519791,
|
1026.8857356235997, 979.8356982823002, 1053.7714712471993,
|
||||||
395.8177744585511,
|
888.722927557879, 1079.1635548917102, 761.7625093353248,
|
||||||
876.0268857356235,
|
1116.504854368932, 672.1433905899925, 1150.858849887976,
|
||||||
443.6146377893951,
|
628.8274831964152, 1171.7699775952203, 615.3846153846154,
|
||||||
856.6094100074682,
|
1180.7318894697535, 615.3846153846154, 1182.2255414488425,
|
||||||
507.84167289021656,
|
618.3719193427931, 1183.7191934279313, 633.3084391336819,
|
||||||
838.6855862584017,
|
1182.2255414488425, 687.0799103808812, 1171.7699775952203,
|
||||||
551.1575802837939,
|
775.2053771471248, 1150.858849887976, 902.1657953696788,
|
||||||
825.2427184466019,
|
1116.504854368932, 990.2912621359224, 1091.1127707244211,
|
||||||
624.3465272591486,
|
1082.8976848394325, 1062.7333831217327, 1133.681852128454,
|
||||||
807.3188946975355,
|
1046.303211351755, 1144.1374159820762, 1041.8222554144884,
|
||||||
696.0418222554144,
|
1144.1374159820762, 1041.8222554144884, 1141.1501120238984,
|
||||||
789.395070948469,
|
1041.8222554144884, 1117.2516803584765, 1043.3159073935774,
|
||||||
758.7752053771471,
|
1082.8976848394325, 1046.303211351755, 1008.2150858849888,
|
||||||
777.445855115758,
|
1062.7333831217327, 917.1023151605675, 1092.6064227035101,
|
||||||
802.0911127707244,
|
861.8371919342793, 1117.9985063480208, 814.0403286034353,
|
||||||
772.9648991784914,
|
1152.352501867065, 794.62285287528, 1176.250933532487,
|
||||||
820.0149365197909,
|
790.1418969380135, 1189.6938013442868, 793.1292008961912,
|
||||||
771.4712471994025,
|
1198.65571321882, 802.0911127707244, 1206.1239731142643,
|
||||||
821.5085884988797,
|
831.9641523525019, 1216.5795369678865, 903.6594473487677,
|
||||||
771.4712471994025,
|
1225.5414488424196, 1014.1896938013442, 1228.5287528005974,
|
||||||
820.0149365197909,
|
1148.6183719193427, 1228.5287528005974, 1272.591486183719,
|
||||||
775.9522031366691,
|
1225.5414488424196, 1314.4137415982075, 1225.5414488424196,
|
||||||
799.1038088125466,
|
1326.3629574309186, 1225.5414488424196, 1326.3629574309186,
|
||||||
790.8887229275579,
|
1225.5414488424196, 1314.4137415982075, 1228.5287528005974,
|
||||||
743.8386855862584,
|
1272.591486183719, 1237.4906646751306, 1197.9088872292755,
|
||||||
825.2427184466019,
|
1247.9462285287527, 1105.3024645257656, 1270.3510082150858,
|
||||||
652.7259148618372,
|
1048.5436893203882, 1286.7811799850635, 1024.6452576549664,
|
||||||
871.545929798357,
|
1295.7430918595967, 1006.7214339058999, 1306.1986557132188,
|
||||||
542.1956684092606,
|
1000.7468259895444, 1313.6669156086632, 1000.7468259895444,
|
||||||
926.8110530246452,
|
1315.160567587752, 1003.7341299477222, 1316.6542195668408,
|
||||||
455.563853622106,
|
1015.6833457804331, 1319.6415235250186, 1050.0373412994772,
|
||||||
977.5952203136669,
|
1321.1351755041076, 1103.8088125466766, 1321.1351755041076,
|
||||||
412.24794622852875,
|
1169.529499626587, 1316.6542195668408, 1220.3136669156086,
|
||||||
1010.455563853622,
|
1310.6796116504854, 1248.6930545182972, 1307.6923076923076,
|
||||||
397.31142643764,
|
1253.1740104555638, 1307.6923076923076, 1253.1740104555638,
|
||||||
1026.8857356235997,
|
1307.6923076923076, 1253.1740104555638, 1307.6923076923076,
|
||||||
397.31142643764,
|
1248.6930545182972, 1309.1859596713964, 1229.275578790142,
|
||||||
1032.8603435399552,
|
1312.1732636295742, 1199.4025392083645, 1319.6415235250186,
|
||||||
400.29873039581776,
|
1172.5168035847648, 1330.0970873786407, 1154.5929798356983,
|
||||||
1038.8349514563106,
|
1342.0463032113516, 1144.1374159820762, 1353.9955190440626,
|
||||||
415.2352501867065,
|
1139.6564600448096, 1361.463778939507, 1138.1628080657206,
|
||||||
1043.3159073935774,
|
1364.4510828976847, 1138.1628080657206, 1365.9447348767737,
|
||||||
463.0321135175504,
|
1138.1628080657206, 1365.9447348767737,
|
||||||
1043.3159073935774,
|
|
||||||
563.1067961165048,
|
|
||||||
1040.3286034353996,
|
|
||||||
696.0418222554144,
|
|
||||||
1032.8603435399552,
|
|
||||||
787.1545929798357,
|
|
||||||
1026.8857356235997,
|
|
||||||
921.5832710978342,
|
|
||||||
1017.9238237490664,
|
|
||||||
1018.6706497386109,
|
|
||||||
1013.4428678117998,
|
|
||||||
1069.4548170276325,
|
|
||||||
1013.4428678117998,
|
|
||||||
1076.923076923077,
|
|
||||||
1013.4428678117998,
|
|
||||||
1075.4294249439881,
|
|
||||||
1014.9365197908887,
|
|
||||||
1051.530993278566,
|
|
||||||
1026.8857356235997,
|
|
||||||
979.8356982823002,
|
|
||||||
1053.7714712471993,
|
|
||||||
888.722927557879,
|
|
||||||
1079.1635548917102,
|
|
||||||
761.7625093353248,
|
|
||||||
1116.504854368932,
|
|
||||||
672.1433905899925,
|
|
||||||
1150.858849887976,
|
|
||||||
628.8274831964152,
|
|
||||||
1171.7699775952203,
|
|
||||||
615.3846153846154,
|
|
||||||
1180.7318894697535,
|
|
||||||
615.3846153846154,
|
|
||||||
1182.2255414488425,
|
|
||||||
618.3719193427931,
|
|
||||||
1183.7191934279313,
|
|
||||||
633.3084391336819,
|
|
||||||
1182.2255414488425,
|
|
||||||
687.0799103808812,
|
|
||||||
1171.7699775952203,
|
|
||||||
775.2053771471248,
|
|
||||||
1150.858849887976,
|
|
||||||
902.1657953696788,
|
|
||||||
1116.504854368932,
|
|
||||||
990.2912621359224,
|
|
||||||
1091.1127707244211,
|
|
||||||
1082.8976848394325,
|
|
||||||
1062.7333831217327,
|
|
||||||
1133.681852128454,
|
|
||||||
1046.303211351755,
|
|
||||||
1144.1374159820762,
|
|
||||||
1041.8222554144884,
|
|
||||||
1144.1374159820762,
|
|
||||||
1041.8222554144884,
|
|
||||||
1141.1501120238984,
|
|
||||||
1041.8222554144884,
|
|
||||||
1117.2516803584765,
|
|
||||||
1043.3159073935774,
|
|
||||||
1082.8976848394325,
|
|
||||||
1046.303211351755,
|
|
||||||
1008.2150858849888,
|
|
||||||
1062.7333831217327,
|
|
||||||
917.1023151605675,
|
|
||||||
1092.6064227035101,
|
|
||||||
861.8371919342793,
|
|
||||||
1117.9985063480208,
|
|
||||||
814.0403286034353,
|
|
||||||
1152.352501867065,
|
|
||||||
794.62285287528,
|
|
||||||
1176.250933532487,
|
|
||||||
790.1418969380135,
|
|
||||||
1189.6938013442868,
|
|
||||||
793.1292008961912,
|
|
||||||
1198.65571321882,
|
|
||||||
802.0911127707244,
|
|
||||||
1206.1239731142643,
|
|
||||||
831.9641523525019,
|
|
||||||
1216.5795369678865,
|
|
||||||
903.6594473487677,
|
|
||||||
1225.5414488424196,
|
|
||||||
1014.1896938013442,
|
|
||||||
1228.5287528005974,
|
|
||||||
1148.6183719193427,
|
|
||||||
1228.5287528005974,
|
|
||||||
1272.591486183719,
|
|
||||||
1225.5414488424196,
|
|
||||||
1314.4137415982075,
|
|
||||||
1225.5414488424196,
|
|
||||||
1326.3629574309186,
|
|
||||||
1225.5414488424196,
|
|
||||||
1326.3629574309186,
|
|
||||||
1225.5414488424196,
|
|
||||||
1314.4137415982075,
|
|
||||||
1228.5287528005974,
|
|
||||||
1272.591486183719,
|
|
||||||
1237.4906646751306,
|
|
||||||
1197.9088872292755,
|
|
||||||
1247.9462285287527,
|
|
||||||
1105.3024645257656,
|
|
||||||
1270.3510082150858,
|
|
||||||
1048.5436893203882,
|
|
||||||
1286.7811799850635,
|
|
||||||
1024.6452576549664,
|
|
||||||
1295.7430918595967,
|
|
||||||
1006.7214339058999,
|
|
||||||
1306.1986557132188,
|
|
||||||
1000.7468259895444,
|
|
||||||
1313.6669156086632,
|
|
||||||
1000.7468259895444,
|
|
||||||
1315.160567587752,
|
|
||||||
1003.7341299477222,
|
|
||||||
1316.6542195668408,
|
|
||||||
1015.6833457804331,
|
|
||||||
1319.6415235250186,
|
|
||||||
1050.0373412994772,
|
|
||||||
1321.1351755041076,
|
|
||||||
1103.8088125466766,
|
|
||||||
1321.1351755041076,
|
|
||||||
1169.529499626587,
|
|
||||||
1316.6542195668408,
|
|
||||||
1220.3136669156086,
|
|
||||||
1310.6796116504854,
|
|
||||||
1248.6930545182972,
|
|
||||||
1307.6923076923076,
|
|
||||||
1253.1740104555638,
|
|
||||||
1307.6923076923076,
|
|
||||||
1253.1740104555638,
|
|
||||||
1307.6923076923076,
|
|
||||||
1253.1740104555638,
|
|
||||||
1307.6923076923076,
|
|
||||||
1248.6930545182972,
|
|
||||||
1309.1859596713964,
|
|
||||||
1229.275578790142,
|
|
||||||
1312.1732636295742,
|
|
||||||
1199.4025392083645,
|
|
||||||
1319.6415235250186,
|
|
||||||
1172.5168035847648,
|
|
||||||
1330.0970873786407,
|
|
||||||
1154.5929798356983,
|
|
||||||
1342.0463032113516,
|
|
||||||
1144.1374159820762,
|
|
||||||
1353.9955190440626,
|
|
||||||
1139.6564600448096,
|
|
||||||
1361.463778939507,
|
|
||||||
1138.1628080657206,
|
|
||||||
1364.4510828976847,
|
|
||||||
1138.1628080657206,
|
|
||||||
1365.9447348767737,
|
|
||||||
1138.1628080657206,
|
|
||||||
1365.9447348767737,
|
|
||||||
],
|
],
|
||||||
tension: 0.5,
|
tension: 0.5,
|
||||||
stroke: '#0f0',
|
stroke: '#0f0',
|
||||||
|
@@ -257,5 +257,5 @@ describe('Rect', function () {
|
|||||||
trace,
|
trace,
|
||||||
'clearRect(0,0,578,200);save();transform(1,0,0,1,100,100);beginPath();moveTo(-100,-100);lineTo(-10,-100);arc(-10,-90,10,4.712,0,false);lineTo(0,-20);arc(-20,-20,20,0,1.571,false);lineTo(-70,0);arc(-70,-30,30,1.571,3.142,false);lineTo(-100,-100);arc(-100,-100,0,3.142,4.712,false);closePath();fillStyle=black;fill();restore();clearRect(0,0,578,200);save();transform(1,0,0,1,100,100);beginPath();moveTo(-100,-100);lineTo(-10,-100);arc(-10,-90,10,4.712,0,false);lineTo(0,-20);arc(-20,-20,20,0,1.571,false);lineTo(-70,0);arc(-70,-30,30,1.571,3.142,false);lineTo(-100,-100);arc(-100,-100,0,3.142,4.712,false);closePath();fillStyle=black;fill();restore();'
|
'clearRect(0,0,578,200);save();transform(1,0,0,1,100,100);beginPath();moveTo(-100,-100);lineTo(-10,-100);arc(-10,-90,10,4.712,0,false);lineTo(0,-20);arc(-20,-20,20,0,1.571,false);lineTo(-70,0);arc(-70,-30,30,1.571,3.142,false);lineTo(-100,-100);arc(-100,-100,0,3.142,4.712,false);closePath();fillStyle=black;fill();restore();clearRect(0,0,578,200);save();transform(1,0,0,1,100,100);beginPath();moveTo(-100,-100);lineTo(-10,-100);arc(-10,-90,10,4.712,0,false);lineTo(0,-20);arc(-20,-20,20,0,1.571,false);lineTo(-70,0);arc(-70,-30,30,1.571,3.142,false);lineTo(-100,-100);arc(-100,-100,0,3.142,4.712,false);closePath();fillStyle=black;fill();restore();'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -225,10 +225,10 @@ describe('RegularPolygon', function () {
|
|||||||
cornerRadius: 25,
|
cornerRadius: 25,
|
||||||
});
|
});
|
||||||
var resultCircleRadius = radius * Math.cos(Math.PI / sides);
|
var resultCircleRadius = radius * Math.cos(Math.PI / sides);
|
||||||
|
|
||||||
layer.add(poly);
|
layer.add(poly);
|
||||||
stage.add(layer);
|
stage.add(layer);
|
||||||
|
|
||||||
// corner radius creates perfect circle at 1/2 radius
|
// corner radius creates perfect circle at 1/2 radius
|
||||||
var canvas = createCanvas();
|
var canvas = createCanvas();
|
||||||
var context = canvas.getContext('2d');
|
var context = canvas.getContext('2d');
|
||||||
|
@@ -16,56 +16,12 @@ describe('Sprite', function () {
|
|||||||
animation: 'standing',
|
animation: 'standing',
|
||||||
animations: {
|
animations: {
|
||||||
standing: [
|
standing: [
|
||||||
0,
|
0, 0, 49, 109, 52, 0, 49, 109, 105, 0, 49, 109, 158, 0, 49, 109,
|
||||||
0,
|
210, 0, 49, 109, 262, 0, 49, 109,
|
||||||
49,
|
|
||||||
109,
|
|
||||||
52,
|
|
||||||
0,
|
|
||||||
49,
|
|
||||||
109,
|
|
||||||
105,
|
|
||||||
0,
|
|
||||||
49,
|
|
||||||
109,
|
|
||||||
158,
|
|
||||||
0,
|
|
||||||
49,
|
|
||||||
109,
|
|
||||||
210,
|
|
||||||
0,
|
|
||||||
49,
|
|
||||||
109,
|
|
||||||
262,
|
|
||||||
0,
|
|
||||||
49,
|
|
||||||
109,
|
|
||||||
],
|
],
|
||||||
kicking: [
|
kicking: [
|
||||||
0,
|
0, 109, 45, 98, 45, 109, 45, 98, 95, 109, 63, 98, 156, 109, 70, 98,
|
||||||
109,
|
229, 109, 60, 98, 287, 109, 41, 98,
|
||||||
45,
|
|
||||||
98,
|
|
||||||
45,
|
|
||||||
109,
|
|
||||||
45,
|
|
||||||
98,
|
|
||||||
95,
|
|
||||||
109,
|
|
||||||
63,
|
|
||||||
98,
|
|
||||||
156,
|
|
||||||
109,
|
|
||||||
70,
|
|
||||||
98,
|
|
||||||
229,
|
|
||||||
109,
|
|
||||||
60,
|
|
||||||
98,
|
|
||||||
287,
|
|
||||||
109,
|
|
||||||
41,
|
|
||||||
98,
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
frameRate: 10,
|
frameRate: 10,
|
||||||
@@ -118,30 +74,8 @@ describe('Sprite', function () {
|
|||||||
animation: 'standing',
|
animation: 'standing',
|
||||||
animations: {
|
animations: {
|
||||||
standing: [
|
standing: [
|
||||||
0,
|
0, 0, 49, 109, 52, 0, 49, 109, 105, 0, 49, 109, 158, 0, 49, 109,
|
||||||
0,
|
210, 0, 49, 109, 262, 0, 49, 109,
|
||||||
49,
|
|
||||||
109,
|
|
||||||
52,
|
|
||||||
0,
|
|
||||||
49,
|
|
||||||
109,
|
|
||||||
105,
|
|
||||||
0,
|
|
||||||
49,
|
|
||||||
109,
|
|
||||||
158,
|
|
||||||
0,
|
|
||||||
49,
|
|
||||||
109,
|
|
||||||
210,
|
|
||||||
0,
|
|
||||||
49,
|
|
||||||
109,
|
|
||||||
262,
|
|
||||||
0,
|
|
||||||
49,
|
|
||||||
109,
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
frameRate: 5,
|
frameRate: 5,
|
||||||
@@ -185,30 +119,8 @@ describe('Sprite', function () {
|
|||||||
animation: 'standing',
|
animation: 'standing',
|
||||||
animations: {
|
animations: {
|
||||||
standing: [
|
standing: [
|
||||||
0,
|
0, 0, 49, 109, 52, 0, 49, 109, 105, 0, 49, 109, 158, 0, 49, 109,
|
||||||
0,
|
210, 0, 49, 109, 262, 0, 49, 109,
|
||||||
49,
|
|
||||||
109,
|
|
||||||
52,
|
|
||||||
0,
|
|
||||||
49,
|
|
||||||
109,
|
|
||||||
105,
|
|
||||||
0,
|
|
||||||
49,
|
|
||||||
109,
|
|
||||||
158,
|
|
||||||
0,
|
|
||||||
49,
|
|
||||||
109,
|
|
||||||
210,
|
|
||||||
0,
|
|
||||||
49,
|
|
||||||
109,
|
|
||||||
262,
|
|
||||||
0,
|
|
||||||
49,
|
|
||||||
109,
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
frameRate: 5,
|
frameRate: 5,
|
||||||
@@ -221,30 +133,8 @@ describe('Sprite', function () {
|
|||||||
animation: 'standing',
|
animation: 'standing',
|
||||||
animations: {
|
animations: {
|
||||||
standing: [
|
standing: [
|
||||||
0,
|
0, 0, 49, 109, 52, 0, 49, 109, 105, 0, 49, 109, 158, 0, 49, 109,
|
||||||
0,
|
210, 0, 49, 109, 262, 0, 49, 109,
|
||||||
49,
|
|
||||||
109,
|
|
||||||
52,
|
|
||||||
0,
|
|
||||||
49,
|
|
||||||
109,
|
|
||||||
105,
|
|
||||||
0,
|
|
||||||
49,
|
|
||||||
109,
|
|
||||||
158,
|
|
||||||
0,
|
|
||||||
49,
|
|
||||||
109,
|
|
||||||
210,
|
|
||||||
0,
|
|
||||||
49,
|
|
||||||
109,
|
|
||||||
262,
|
|
||||||
0,
|
|
||||||
49,
|
|
||||||
109,
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
frameRate: 20,
|
frameRate: 20,
|
||||||
@@ -285,30 +175,8 @@ describe('Sprite', function () {
|
|||||||
animation: 'standing',
|
animation: 'standing',
|
||||||
animations: {
|
animations: {
|
||||||
standing: [
|
standing: [
|
||||||
0,
|
0, 0, 49, 109, 52, 0, 49, 109, 105, 0, 49, 109, 158, 0, 49, 109,
|
||||||
0,
|
210, 0, 49, 109, 262, 0, 49, 109,
|
||||||
49,
|
|
||||||
109,
|
|
||||||
52,
|
|
||||||
0,
|
|
||||||
49,
|
|
||||||
109,
|
|
||||||
105,
|
|
||||||
0,
|
|
||||||
49,
|
|
||||||
109,
|
|
||||||
158,
|
|
||||||
0,
|
|
||||||
49,
|
|
||||||
109,
|
|
||||||
210,
|
|
||||||
0,
|
|
||||||
49,
|
|
||||||
109,
|
|
||||||
262,
|
|
||||||
0,
|
|
||||||
49,
|
|
||||||
109,
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
frameRate: 50,
|
frameRate: 50,
|
||||||
@@ -341,30 +209,8 @@ describe('Sprite', function () {
|
|||||||
animation: 'standing',
|
animation: 'standing',
|
||||||
animations: {
|
animations: {
|
||||||
standing: [
|
standing: [
|
||||||
0,
|
0, 0, 49, 109, 52, 0, 49, 109, 105, 0, 49, 109, 158, 0, 49, 109,
|
||||||
0,
|
210, 0, 49, 109, 262, 0, 49, 109,
|
||||||
49,
|
|
||||||
109,
|
|
||||||
52,
|
|
||||||
0,
|
|
||||||
49,
|
|
||||||
109,
|
|
||||||
105,
|
|
||||||
0,
|
|
||||||
49,
|
|
||||||
109,
|
|
||||||
158,
|
|
||||||
0,
|
|
||||||
49,
|
|
||||||
109,
|
|
||||||
210,
|
|
||||||
0,
|
|
||||||
49,
|
|
||||||
109,
|
|
||||||
262,
|
|
||||||
0,
|
|
||||||
49,
|
|
||||||
109,
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
frameRate: 50,
|
frameRate: 50,
|
||||||
@@ -407,30 +253,8 @@ describe('Sprite', function () {
|
|||||||
animation: 'standing',
|
animation: 'standing',
|
||||||
animations: {
|
animations: {
|
||||||
standing: [
|
standing: [
|
||||||
0,
|
0, 0, 49, 109, 52, 0, 49, 109, 105, 0, 49, 109, 158, 0, 49, 109,
|
||||||
0,
|
210, 0, 49, 109, 262, 0, 49, 109,
|
||||||
49,
|
|
||||||
109,
|
|
||||||
52,
|
|
||||||
0,
|
|
||||||
49,
|
|
||||||
109,
|
|
||||||
105,
|
|
||||||
0,
|
|
||||||
49,
|
|
||||||
109,
|
|
||||||
158,
|
|
||||||
0,
|
|
||||||
49,
|
|
||||||
109,
|
|
||||||
210,
|
|
||||||
0,
|
|
||||||
49,
|
|
||||||
109,
|
|
||||||
262,
|
|
||||||
0,
|
|
||||||
49,
|
|
||||||
109,
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
frameRate: 50,
|
frameRate: 50,
|
||||||
|
@@ -3680,7 +3680,7 @@ describe('Transformer', function () {
|
|||||||
layer.draw();
|
layer.draw();
|
||||||
var rect = Konva.Util._assign({}, tr._getNodeRect());
|
var rect = Konva.Util._assign({}, tr._getNodeRect());
|
||||||
delete rect.rotation;
|
delete rect.rotation;
|
||||||
assert.deepEqual(shape.getClientRect(), rect), 'change width';
|
(assert.deepEqual(shape.getClientRect(), rect), 'change width');
|
||||||
|
|
||||||
shape.height(30);
|
shape.height(30);
|
||||||
layer.draw();
|
layer.draw();
|
||||||
@@ -3726,7 +3726,7 @@ describe('Transformer', function () {
|
|||||||
layer.draw();
|
layer.draw();
|
||||||
var rect = Konva.Util._assign({}, tr._getNodeRect());
|
var rect = Konva.Util._assign({}, tr._getNodeRect());
|
||||||
delete rect.rotation;
|
delete rect.rotation;
|
||||||
assert.deepEqual(shape.getClientRect(), rect), 'change data';
|
(assert.deepEqual(shape.getClientRect(), rect), 'change data');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('make sure transformer events are not cloned', function () {
|
it('make sure transformer events are not cloned', function () {
|
||||||
|
@@ -17,8 +17,7 @@
|
|||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
// probably we would never enable this one
|
// probably we would never enable this one
|
||||||
// because it's too strict, konva generates many functions on the runtime
|
// because it's too strict, konva generates many functions on the runtime
|
||||||
"strictPropertyInitialization": false,
|
"strictPropertyInitialization": false
|
||||||
|
|
||||||
},
|
},
|
||||||
"include": ["./src/**/*.ts"],
|
"include": ["./src/**/*.ts"]
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user