/// <summary> /// Use this constructor when placing point lights and markers to allow them to be placed on other objects. /// </summary> /// <param name="worldEditor"></param> /// <param name="callback"></param> /// <param name="displayObject"></param> public DragHelper(WorldEditor worldEditor, DragComplete callback, DisplayObject displayObject) { app = worldEditor; dragObject = displayObject; dragCallback = callback; disposeDragObject = false; but = app.MouseSelectButton; // set up mouse capture and callbacks for placing the object app.InterceptMouse(new MouseMoveIntercepter(DragMoveAllowObject), new MouseButtonIntercepter(DragButtonDownAllowObject), new MouseButtonIntercepter(DragButtonUp), new MouseCaptureLost(DragCaptureLost), true); }
/// <summary> /// Use this constructor to drag top level objects. Used when placing objects from the clipboard in to the world and when top level objects (not MPPoints) /// are being dragged. Not used for doing the original placement of points, objects, markers, point lights, or decals. /// </summary> /// <param name="worldEditor"></param> /// <param name="displayObject"></param> /// <param name="callback"></param> /// <param name="stopOnUp"></param> public DragHelper(WorldEditor worldEditor, List<IObjectDrag> dragObjes, List<Vector3> dragOffsets, List<float> terrainOffset, DragComplete callback, bool stopOnUp) { app = worldEditor; dragCallback = callback; disposeDragObject = false; this.stopOnUp = stopOnUp; Vector3 baseObjPosition = dragObjes[0].Position; int i = 0; but = app.MouseSelectButton; foreach (IObjectDrag obj in dragObjes) { this.dragObjects.Add(obj); this.dragOffset.Add(dragOffsets[i]); this.terrainOffset.Add(terrainOffset[i]); i++; } app.InterceptMouse(new MouseMoveIntercepter(MultipleDragMove), new MouseButtonIntercepter(MultipleDragButtonDown), new MouseButtonIntercepter(MultipleDragButtonUp), new MouseCaptureLost(DragCaptureLost), true); }
public DragHelper(WorldEditor worldEditor, string meshName, DragComplete callback, bool accept, Vector3 loc, int index) { app = worldEditor; dragCallback = callback; disposeDragObject = true; this.location = loc; but = app.MouseSelectButton; // set up mouse capture and callbacks for placing the object app.InterceptMouse(new MouseMoveIntercepter(DecalDragMove), new MouseButtonIntercepter(DragButtonDown), new MouseButtonIntercepter(DragButtonUp), new MouseCaptureLost(DragCaptureLost), true); }
/// <summary> /// Use this constructor when you want to drag a TerrainDecal and have the drag stopped on a left button mouse down. Creates its own decal and disposes it. /// Usually used to place new decals. /// </summary> /// <param name="worldEditor"></param> /// <param name="parent"></param> /// <param name="name"></param> /// <param name="position"></param> /// <param name="size"></param> /// <param name="callback"></param> public DragHelper(WorldEditor worldEditor, IWorldContainer parent, string name, string fname, Vector2 size, DragComplete callback) { this.app = worldEditor; this.imageName = fname; this.size = size; this.name = name; stopOnUp = false; disposeDragObject = true; decal = new TerrainDecal(app, parent, name, new Vector2(0f, 0f), size, imageName, 1); decal.AddToScene(); dragCallback = callback; but = app.MouseSelectButton; app.InterceptMouse(new MouseMoveIntercepter(DecalDragMove), new MouseButtonIntercepter(DecalDragButtonDown), new MouseButtonIntercepter(DecalDragButtonUp), new MouseCaptureLost(DragCaptureLost), true); }
/// <summary> /// Use this constructor when you want the DragHelper to create the displayObject for you /// based on the meshName. /// </summary> /// <param name="worldEditor"></param> /// <param name="meshName"></param> /// <param name="callback"></param> public DragHelper(WorldEditor worldEditor, String meshName, DragComplete callback) { app = worldEditor; dragObject = new DisplayObject(meshName, app, "Drag", app.Scene, meshName, location, new Vector3(1,1,1), new Vector3(0,0,0), null); dragCallback = callback; disposeDragObject = true; but = app.MouseSelectButton; // set up mouse capture and callbacks for placing the object app.InterceptMouse(new MouseMoveIntercepter(DragMove), new MouseButtonIntercepter(DragButtonDown), new MouseButtonIntercepter(DragButtonUp), new MouseCaptureLost(DragCaptureLost), true); }