konva/src/FastLayer.ts

30 lines
933 B
TypeScript
Raw Normal View History

2021-05-05 22:54:03 +08:00
import { Util } from './Util';
import { Layer } from './Layer';
import { _registerNode } from './Global';
2019-01-02 04:59:27 +08:00
/**
* FastLayer constructor. **DEPRECATED!** Please use `Konva.Layer({ listening: false})` instead. Layers are tied to their own canvas element and are used
2019-01-02 04:59:27 +08:00
* to contain shapes only. If you don't need node nesting, mouse and touch interactions,
* or event pub/sub, you should use FastLayer instead of Layer to create your layers.
* It renders about 2x faster than normal layers.
*
2019-01-02 04:59:27 +08:00
* @constructor
* @memberof Konva
* @augments Konva.Layer
2025-03-12 22:29:07 +08:00
@@containerParams
2019-01-02 04:59:27 +08:00
* @example
* var layer = new Konva.FastLayer();
*/
export class FastLayer extends Layer {
constructor(attrs) {
super(attrs);
this.listening(false);
2020-06-10 04:55:08 +08:00
Util.warn(
'Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.'
);
2019-01-02 04:59:27 +08:00
}
}
2019-02-27 21:06:04 +08:00
FastLayer.prototype.nodeType = 'FastLayer';
_registerNode(FastLayer);