import { LeafletArgs, PlayBackEvent } from "../EventInterface"; export namespace IconStatus { export const NAME = 'FLO_ICON_STATUS'; export interface EventArgs { id:string; icon:string; iconColor?: string; slot:number; } export class AddEvent implements PlayBackEvent{ name: string = NAME + "_ADD"; do(leafletArgs: LeafletArgs, args: EventArgs): void { const marker = leafletArgs.playback.getMarkerById(args.id); marker.floIcon.Status.setIcon(args.slot,args.icon); if (args.iconColor) marker.floIcon.Status.setIconColor(args.slot, args.iconColor) marker.floIcon.Status.show(args.slot); } undo(leafletArgs: LeafletArgs, args: EventArgs): void { const marker = leafletArgs.playback.getMarkerById(args.id); marker.floIcon.Status.hide(args.slot); } } export class RemoveEvent extends AddEvent { name = NAME + "_REMOVE"; do(leafletArgs:LeafletArgs,args:EventArgs) { super.undo(leafletArgs,args); } undo(leafletArgs:LeafletArgs,args:EventArgs) { super.do(leafletArgs,args); } } } export namespace TextStatus { export const NAME = 'FLO_ICON_STATUS_TEXT'; export interface EventArgs { id: string; text: string; backgroundColor?: string; textColor?: string } export class AddEvent implements PlayBackEvent { name: string = NAME + "_ADD"; do(leafletArgs: LeafletArgs, args: EventArgs): void { const marker = leafletArgs.playback.getMarkerById(args.id); const status = marker.floIcon.Status status.TextArea.setText(args.text); if (args.backgroundColor) status.TextArea.setBackgroundColor(args.backgroundColor) if (args.textColor) status.TextArea.setTextColor(args.textColor) status.TextArea.show(); } undo(leafletArgs: LeafletArgs, args: EventArgs): void { const marker = leafletArgs.playback.getMarkerById(args.id); marker.floIcon.Status.TextArea.hide(); } } export class RemoveEvent extends AddEvent { name = NAME + "_REMOVE"; do(leafletArgs:LeafletArgs,args:EventArgs) { super.undo(leafletArgs,args); } undo(leafletArgs:LeafletArgs,args:EventArgs) { super.do(leafletArgs,args); } } }