/// <summary> /// ステータス中でposの位置にある辺の始点をイベント点として処理する /// 交差部分の辺を左右別に求め,leftEdgeとrightEdgeに追加する /// </summary> private static void Process(Status status, EdgePosition pos, Line sweepLine, List <Edge> leftEdge, List <Edge> rightEdge) { switch (pos) { case EdgePosition.LEFT1: ProcessLeft(status.left1, status.right1, status.left2, status.right2, sweepLine, leftEdge, rightEdge); break; case EdgePosition.RIGHT1: ProcessRight(status.left1, status.right1, status.left2, status.right2, sweepLine, leftEdge, rightEdge); break; case EdgePosition.LEFT2: ProcessLeft(status.left2, status.right2, status.left1, status.right1, sweepLine, leftEdge, rightEdge); break; case EdgePosition.RIGHT2: ProcessRight(status.left2, status.right2, status.left1, status.right1, sweepLine, leftEdge, rightEdge); break; } }
public override void OnMouseOver(Vector2 mouseWorldPos) { const int edgeWidth = 10; var edge = Helper.WhichEdge(_rectangle, Rotation, mouseWorldPos, edgeWidth); _edgeUnderMouse = edge; summonMainForm( ).SetCursorForCanvas(_edgeLookup[edge]); }
private RuleEdgeSelectPropertyPanel AddEdgeProperty(EdgePosition position, string name, string text) { var edgeProperty = ComponentPool.Get <RuleEdgeSelectPropertyPanel>(this, name); edgeProperty.Text = text; edgeProperty.Position = position; edgeProperty.Init(); edgeProperty.OnSelect += OnSelectPanel; edgeProperty.OnEnter += Editor.EnterRuleEdge; edgeProperty.OnLeave += Editor.LeaveRuleEdge; return(edgeProperty); }
private MarkupLineSelectPropertyPanel AddEdgeProperty(EdgePosition position, string text) { var edgeProperty = ComponentPool.Get <MarkupLineSelectPropertyPanel>(this); edgeProperty.Text = text; edgeProperty.Position = position; edgeProperty.Init(); edgeProperty.OnSelect += OnSelectPanel; edgeProperty.OnHover += Editor.HoverRuleEdge; edgeProperty.OnLeave += Editor.LeaveRuleEdge; return(edgeProperty); }
public override void OnMouseButtonDown(Vector2 mouseWorldPos) { IsHovering = false; if (_edgeUnderMouse != EdgePosition.None) { _edgeGrabbed = _edgeUnderMouse; _initialWidth = _rectangle.Width; _initialHeight = _rectangle.Height; } else { summonMainForm().SetCursorForCanvas(Cursors.SizeAll); } base.OnMouseButtonDown(mouseWorldPos); }
/// <summary> /// 二回目以降のイベント処理 /// </summary> private static StepResult SecondPass(Status status, List <Edge> leftEdge, List <Edge> rightEdge) { //次に処理すべき辺を選択 Edge next = PickNextEdge(status); if (next == null) { //見つからなければ終了 return(new StepResult(float.NaN, false)); } //選択された辺の終点を走査線の次の位置とする float nextSweepY = next.startPoint.y; //次の走査線を作成 Line sweepLine = Line.FromPoints(0f, nextSweepY, 1f, nextSweepY); //選択された辺が,ステータスの中でleft1/right1/left2/right2のうち //どれと対応するかを特定する EdgePosition edgePos = EdgePosition.NULL; if (next == status.left1.next) { edgePos = EdgePosition.LEFT1; status.left1 = next; } else if (next == status.right1.next) { edgePos = EdgePosition.RIGHT1; status.right1 = next; } else if (next == status.left2.next) { edgePos = EdgePosition.LEFT2; status.left2 = next; } else if (next == status.right2.next) { edgePos = EdgePosition.RIGHT2; status.right2 = next; } //イベント処理 Process(status, edgePos, sweepLine, leftEdge, rightEdge); return(new StepResult(nextSweepY, true)); }
public override void OnMouseButtonUp(Vector2 mouseWorldPos) { _edgeGrabbed = EdgePosition.None; }
public override void OnMouseOver(Vector2 mouseWorldPos) { const int edgeWidth = 10 ; var edge=Helper.WhichEdge( _rectangle, Rotation, mouseWorldPos, edgeWidth ) ; _edgeUnderMouse = edge ; summonMainForm( ).SetCursorForCanvas( _edgeLookup[ edge ] ) ; }
public EdgeTrigger(EdgePosition position, int from, int to) { Position = position; From = from; To = to; }
public EdgeTrigger(EdgePosition position) { Position = position; }
public EdgePiece(EdgePosition position, Color color1, Color color2) { switch (position) { case EdgePosition.UF: this.u_color = color1; this.f_color = color2; break; case EdgePosition.UB: this.u_color = color1; this.b_color = color2; break; case EdgePosition.UR: this.u_color = color1; this.r_color = color2; break; case EdgePosition.UL: this.u_color = color1; this.l_color = color2; break; case EdgePosition.DF: this.d_color = color1; this.f_color = color2; break; case EdgePosition.DB: this.d_color = color1; this.b_color = color2; break; case EdgePosition.DR: this.d_color = color1; this.r_color = color2; break; case EdgePosition.DL: this.d_color = color1; this.l_color = color2; break; case EdgePosition.FR: this.f_color = color1; this.r_color = color2; break; case EdgePosition.FL: this.f_color = color1; this.l_color = color2; break; case EdgePosition.BR: this.b_color = color1; this.r_color = color2; break; case EdgePosition.BL: this.b_color = color1; this.l_color = color2; break; default: break; } }
public EdgePosition Test(EdgePosition start) { Vector position; Vector direction; switch (start.Edge) { case Edge.Bottom: position = new Vector(start.Offset, this.Height - 1); direction = new Vector(0, -1); break; case Edge.Top: position = new Vector(start.Offset, 0); direction = new Vector(0, 1); break; case Edge.Left: position = new Vector(0, start.Offset); direction = new Vector(1, 0); break; case Edge.Right: position = new Vector(this.Width - 1, start.Offset); direction = new Vector(-1, 0); break; default: return(new EdgePosition()); } while (true) { var t = this[position]; switch (t) { case Tile.Smoke: return(new EdgePosition()); case Tile.UpperLeftToLowerRight: if (direction.Y == 0) { direction = new Vector(0, direction.X); } else { direction = new Vector(direction.Y, 0); } break; case Tile.LowerLeftToUpperRight: if (direction.Y == 0) { direction = new Vector(0, -direction.X); } else { direction = new Vector(-direction.Y, 0); } break; } position = position + direction; if (position.X < 0) { return(new EdgePosition(Edge.Left, position.Y)); } if (position.X >= this.Width) { return(new EdgePosition(Edge.Right, position.Y)); } if (position.Y < 0) { return(new EdgePosition(Edge.Top, position.X)); } if (position.Y >= this.Height) { return(new EdgePosition(Edge.Bottom, position.X)); } } }