mirror of
https://github.com/konvajs/konva.git
synced 2025-04-05 20:48:28 +08:00
little optimize
This commit is contained in:
parent
d410ceee24
commit
72cbc8d289
@ -362,8 +362,8 @@ export class Context {
|
|||||||
* @method
|
* @method
|
||||||
* @name Konva.Context#clip
|
* @name Konva.Context#clip
|
||||||
*/
|
*/
|
||||||
clip(fillRule?: CanvasFillRule): void
|
clip(fillRule?: CanvasFillRule): void;
|
||||||
clip(path: Path2D, fillRule?: CanvasFillRule): void
|
clip(path: Path2D, fillRule?: CanvasFillRule): void;
|
||||||
clip(...args: any[]) {
|
clip(...args: any[]) {
|
||||||
this._context.clip.apply(this._context, args);
|
this._context.clip.apply(this._context, args);
|
||||||
}
|
}
|
||||||
@ -484,9 +484,10 @@ export class Context {
|
|||||||
* @method
|
* @method
|
||||||
* @name Konva.Context#fill
|
* @name Konva.Context#fill
|
||||||
*/
|
*/
|
||||||
fill(fillRule?: CanvasFillRule): void
|
fill(fillRule?: CanvasFillRule): void;
|
||||||
fill(path: Path2D, fillRule?: CanvasFillRule): void
|
fill(path: Path2D, fillRule?: CanvasFillRule): void;
|
||||||
fill(...args: any[]) {
|
fill(...args: any[]) {
|
||||||
|
// this._context.fill();
|
||||||
this._context.fill.apply(this._context, args);
|
this._context.fill.apply(this._context, args);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -749,7 +750,7 @@ export class Context {
|
|||||||
// supported context properties
|
// supported context properties
|
||||||
type CanvasContextProps = Pick<
|
type CanvasContextProps = Pick<
|
||||||
CanvasRenderingContext2D,
|
CanvasRenderingContext2D,
|
||||||
typeof CONTEXT_PROPERTIES[number]
|
(typeof CONTEXT_PROPERTIES)[number]
|
||||||
>;
|
>;
|
||||||
|
|
||||||
export interface Context extends CanvasContextProps {}
|
export interface Context extends CanvasContextProps {}
|
||||||
|
@ -56,7 +56,7 @@ export interface ShapeConfig extends NodeConfig {
|
|||||||
fillRadialGradientColorStops?: Array<number | string>;
|
fillRadialGradientColorStops?: Array<number | string>;
|
||||||
fillEnabled?: boolean;
|
fillEnabled?: boolean;
|
||||||
fillPriority?: string;
|
fillPriority?: string;
|
||||||
fillRule?: CanvasFillRule
|
fillRule?: CanvasFillRule;
|
||||||
stroke?: string | CanvasGradient;
|
stroke?: string | CanvasGradient;
|
||||||
strokeWidth?: number;
|
strokeWidth?: number;
|
||||||
fillAfterStrokeEnabled?: boolean;
|
fillAfterStrokeEnabled?: boolean;
|
||||||
@ -89,7 +89,10 @@ export interface ShapeGetClientRectConfig {
|
|||||||
relativeTo?: Node;
|
relativeTo?: Node;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type FillFuncOutput = void | [Path2D | CanvasFillRule] | [Path2D, CanvasFillRule]
|
export type FillFuncOutput =
|
||||||
|
| void
|
||||||
|
| [Path2D | CanvasFillRule]
|
||||||
|
| [Path2D, CanvasFillRule];
|
||||||
|
|
||||||
var HAS_SHADOW = 'hasShadow';
|
var HAS_SHADOW = 'hasShadow';
|
||||||
var SHADOW_RGBA = 'shadowRGBA';
|
var SHADOW_RGBA = 'shadowRGBA';
|
||||||
@ -115,7 +118,7 @@ export const shapes: { [key: string]: Shape } = {};
|
|||||||
// what color to use for hit test?
|
// what color to use for hit test?
|
||||||
|
|
||||||
function _fillFunc(context) {
|
function _fillFunc(context) {
|
||||||
const fillRule = this.fillRule()
|
const fillRule = this.attrs.fillRule;
|
||||||
if (fillRule) {
|
if (fillRule) {
|
||||||
context.fill(fillRule);
|
context.fill(fillRule);
|
||||||
} else {
|
} else {
|
||||||
|
@ -96,6 +96,7 @@
|
|||||||
perfectDrawEnabled: false,
|
perfectDrawEnabled: false,
|
||||||
width: wabbitTexture.width,
|
width: wabbitTexture.width,
|
||||||
height: wabbitTexture.height,
|
height: wabbitTexture.height,
|
||||||
|
fill: 'yellow',
|
||||||
});
|
});
|
||||||
|
|
||||||
bunny.speedX = Math.random() * 10;
|
bunny.speedX = Math.random() * 10;
|
||||||
|
Loading…
Reference in New Issue
Block a user