override public Capture UpdateCapture(InputState input, CaptureData data) { Vector2d vCurPos = ClickPoint(input); if (Released(input)) { if (vCurPos.Distance(vClickDown) > MaxClickMoveDelta) { return(Capture.End); } SORayHit rayHit; bool bHit = context.Scene.FindSORayIntersection(WorldRay(input), out rayHit, ObjectFilterF); if (bHit == false || rayHit.hitSO != clickSO) { return(Capture.End); } BaseSingleClickTool tool = (context.ToolManager.ActiveRightTool as BaseSingleClickTool); tool.OnClicked(clickSO, vCurPos, WorldRay(input)); return(Capture.End); } else { return(Capture.Continue); } }
protected virtual void clicked(SceneObject clickedSO, Vector2d position, Ray3f worldRay) { BaseSingleClickTool tool = (context.ToolManager.ActiveRightTool as BaseSingleClickTool); context.RegisterNextFrameAction(() => { tool.OnClicked(clickedSO, position, worldRay); }); }
override public Capture BeginCapture(InputState input, CaptureSide eSide) { SORayHit rayHit; bool bHit = context.Scene.FindSORayIntersection(WorldRay(input), out rayHit, ObjectFilterF); if (bHit) { clickSO = rayHit.hitSO; //vClickDown = ClickPoint(input); // if tool wants to apply action on press instead of release, we send it next frame BaseSingleClickTool tool = (context.ToolManager.ActiveRightTool as BaseSingleClickTool); if (tool.ActionOnRelease == false) { clicked(clickSO, ClickPoint(input), WorldRay(input)); } return(Capture.Begin(this)); } return(Capture.Ignore); }
override public Capture UpdateCapture(InputState input, CaptureData data) { BaseSingleClickTool tool = (context.ToolManager.ActiveRightTool as BaseSingleClickTool); Vector2d vCurPos = ClickPoint(input); if (Released(input)) { if (tool.ActionOnRelease) { SORayHit rayHit; bool bHit = context.Scene.FindSORayIntersection(WorldRay(input), out rayHit, ObjectFilterF); if (bHit && rayHit.hitSO == clickSO) { clicked(clickSO, vCurPos, WorldRay(input)); } } return(Capture.End); } else { return(Capture.Continue); } }