Tidy up DecorationService
This commit is contained in:
@@ -12,7 +12,6 @@ export class DecorationService extends Disposable implements IDecorationService
|
|||||||
public serviceBrand: any;
|
public serviceBrand: any;
|
||||||
|
|
||||||
private readonly _decorations: IInternalDecoration[] = [];
|
private readonly _decorations: IInternalDecoration[] = [];
|
||||||
private _animationFrame: number | undefined;
|
|
||||||
|
|
||||||
private _onDecorationRegistered = this.register(new EventEmitter<IInternalDecoration>());
|
private _onDecorationRegistered = this.register(new EventEmitter<IInternalDecoration>());
|
||||||
public get onDecorationRegistered(): IEvent<IInternalDecoration> { return this._onDecorationRegistered.event; }
|
public get onDecorationRegistered(): IEvent<IInternalDecoration> { return this._onDecorationRegistered.event; }
|
||||||
@@ -49,33 +48,23 @@ export class DecorationService extends Disposable implements IDecorationService
|
|||||||
}
|
}
|
||||||
this._decorations.length = 0;
|
this._decorations.length = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _queueRefresh(): void {
|
|
||||||
if (this._animationFrame !== undefined) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this._animationFrame = window.requestAnimationFrame(() => {
|
|
||||||
// this._refresh();
|
|
||||||
this._animationFrame = undefined;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Decoration implements IInternalDecoration {
|
class Decoration extends Disposable implements IInternalDecoration {
|
||||||
public marker: IMarker;
|
public readonly marker: IMarker;
|
||||||
public readonly onRenderEmitter = new EventEmitter<HTMLElement>();
|
|
||||||
public readonly onRender = this.onRenderEmitter.event;
|
|
||||||
private _onDispose = new EventEmitter<void>();
|
|
||||||
public readonly onDispose = this._onDispose.event;
|
|
||||||
public element: HTMLElement | undefined;
|
public element: HTMLElement | undefined;
|
||||||
public isDisposed: boolean = false;
|
public isDisposed: boolean = false;
|
||||||
public dispose(): void {
|
|
||||||
throw new Error('Method not implemented.');
|
public readonly onRenderEmitter = this.register(new EventEmitter<HTMLElement>());
|
||||||
}
|
public readonly onRender = this.onRenderEmitter.event;
|
||||||
|
private _onDispose = this.register(new EventEmitter<void>());
|
||||||
|
public readonly onDispose = this._onDispose.event;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public readonly options: IDecorationOptions
|
public readonly options: IDecorationOptions
|
||||||
) {
|
) {
|
||||||
|
super();
|
||||||
this.marker = options.marker;
|
this.marker = options.marker;
|
||||||
this.element = undefined;
|
// TODO: Make sure dispose doesn't need to do anything else?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user