UNPKG

playcanvas

Version:

PlayCanvas WebGL game engine

46 lines (43 loc) 1.07 kB
import { ComponentSystem } from '../system.js'; import { ScrollbarComponent } from './component.js'; import { ScrollbarComponentData } from './data.js'; const _schema = [ { name: 'enabled', type: 'boolean' }, { name: 'orientation', type: 'number' }, { name: 'value', type: 'number' }, { name: 'handleSize', type: 'number' } ]; class ScrollbarComponentSystem extends ComponentSystem { constructor(app){ super(app); this.id = 'scrollbar'; this.ComponentType = ScrollbarComponent; this.DataType = ScrollbarComponentData; this.schema = _schema; this.on('add', this._onAddComponent, this); this.on('beforeremove', this._onRemoveComponent, this); } initializeComponentData(component, data, properties) { super.initializeComponentData(component, data, _schema); component.handleEntity = data.handleEntity; } _onAddComponent(entity) { entity.fire('scrollbar:add'); } _onRemoveComponent(entity, component) { component.onRemove(); } } export { ScrollbarComponentSystem };