public override void onMouseDragged() { GuiCanvas Canvas = "Canvas"; GuiSwatchButtonCtrl payload = new ObjectCreator("GuiSwatchButtonCtrl").Create(); payload.assignFieldsFrom(this); payload.position = "0 0 ".AsPoint2I(); payload["dragSourceControl"] = this; int xOffset = payload.extent.x / 2; int yOffset = payload.extent.y / 2; Point2I cursorpos = Canvas.getCursorPos(); int xPos = cursorpos.x - xOffset; int yPos = cursorpos.y - yOffset; // Create the drag control. ObjectCreator oc = new ObjectCreator("GuiDragAndDropControl"); oc["canSaveDynamicFields"] = "0"; oc["Profile"] = "ToolsGuiSolidDefaultProfile"; oc["HorizSizing"] = "right"; oc["VertSizing"] = "bottom"; oc["Position"] = xPos + ' ' + yPos; oc["extent"] = payload.extent; oc["MinExtent"] = "4 4"; oc["canSave"] = "1"; oc["Visible"] = "1"; oc["hovertime"] = "1000"; oc["deleteOnMouseUp"] = true; oc["class"] = "GuiDragAndDropControlType_ColorSwatch"; GuiDragAndDropControl ctrl = oc.Create(); ctrl.add(payload); // Start drag. ((SimSet)Canvas.getContent()).add(ctrl); ctrl.startDragging(xOffset, yOffset); }
public static void GetEaseF(string currentEase, string callback, GuiCanvas root) { GuiEaseEditDlg GuiEaseEditDlg = "GuiEaseEditDlg"; GuiCanvas Canvas = "Canvas"; GuiEaseEditDlg.init(currentEase, callback); if (!root.isObject()) root = Canvas; root.pushDialog(GuiEaseEditDlg); }
public static void TextPad(string text, string callback, GuiCanvas root) { ScriptEditorDlg ScriptEditorDlg = "ScriptEditorDlg"; GuiMLTextEditCtrl textpad = ScriptEditorDlg.FOT("TextPad"); GuiCanvas Canvas = "Canvas"; textpad.setText(text); ScriptEditorDlg["callback"] = callback; if (!root.isObject()) root = Canvas; root.pushDialog(ScriptEditorDlg); }