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5D,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC;YAC3B,YAAY,EAAE;gBACV,YAAY,EAAE;oBACV,EAAE,EAAE,MAAM;oBACV,QAAQ;oBACR,KAAK;iBACR;aACJ;SACJ,CAAC,CAAC;IACP,CAAC;IAED,YAAY,CAAC,MAAc,EAAE,KAAe;QACxC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC;YAC3B,YAAY,EAAE;gBACV,YAAY,EAAE;oBACV,EAAE,EAAE,MAAM;oBACV,UAAU,EAAE,KAAK;iBACpB;aACJ;SACJ,CAAC,CAAC;IACP,CAAC;IAED,cAAc,CAAC,MAAc,EAAE,KAAe;QAC1C,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC;YAC3B,YAAY,EAAE;gBACV,cAAc,EAAE;oBACZ,EAAE,EAAE,MAAM;oBACV,YAAY,EAAE,KAAK;iBACtB;aACJ;SACJ,CAAC,CAAC;IACP,CAAC;CACJ","sourcesContent":["import { RadiantAppController } from \"radiantkit\";\n\nexport class RadiantController {\n _controller: RadiantAppController;\n\n constructor(controller: RadiantAppController) {\n this._controller = controller;\n }\n\n static async createController(f: Function): Promise {\n return new RadiantController(await new RadiantAppController(f)); \n }\n\n /**\n * Activates the provided tool.\n *\n * @param tool the tool to activate.\n */\n activateTool(toolId: number) {\n this._controller.handleMessage({\n SceneMessage: {\n SelectTool: {\n id: toolId,\n },\n },\n });\n }\n\n addRectangle(position: number[], scale: number[]) {\n this._controller.handleMessage({\n AddRectangle: {\n position,\n scale,\n },\n });\n }\n\n addImage(path: string, name: string = \"\", position: number[] = [100, 100], scale: number[] =[100, 100]) {\n this._controller.handleMessage({\n AddImage: {\n name,\n path,\n },\n });\n }\n\n addText(text: string, position: number[] = [100, 100], scale: number[] =[100, 100]) {\n this._controller.handleMessage({\n AddText: {\n text,\n position,\n },\n });\n }\n\n setTransform(nodeId: number, position: number[], scale: number[]) {\n this._controller.handleMessage({\n SceneMessage: {\n SetTransform: {\n id: nodeId,\n position,\n scale,\n },\n },\n });\n }\n\n setFillColor(nodeId: number, color: number[]) {\n this._controller.handleMessage({\n SceneMessage: {\n SetFillColor: {\n id: nodeId,\n fill_color: color,\n },\n },\n });\n }\n\n setStrokeColor(nodeId: number, color: number[]) {\n this._controller.handleMessage({\n SceneMessage: {\n SetStrokeColor: {\n id: nodeId,\n stroke_color: color,\n },\n },\n });\n }\n}"]}