public override HitTestResult HitTest(PointT pos, VectorT hitTestRadius, SelType sel) { var dif = pos.Sub(Point).Abs(); if (dif.X <= hitTestRadius.X && dif.Y <= hitTestRadius.Y) return new HitTestResult(this, sel != SelType.No ? Cursors.SizeAll : Cursors.Arrow); return null; }
public HitTestResult HitTest(PointT pos, VectorT hitTestRadius, SelType sel) { var c = Center; if (c.Sub(pos).Length() > _radius) return null; return new HitTestResult(this, Cursors.SizeAll); }
public override void AddAdornersTo(ICollection<LLShape> list, SelType selMode, VectorT hitTestRadius) { var copy = (LLMarker)LL.Clone(); copy.Type = MarkerPolygon.Square; copy.Radius = hitTestRadius.X; copy.Style = SelAdornerStyle; list.Add(copy); }
public override void AddAdornersTo(ICollection <LLShape> list, SelType selMode, VectorT hitTestRadius) { var copy = (LLMarker)LL.Clone(); copy.Type = MarkerPolygon.Square; copy.Radius = hitTestRadius.X; copy.Style = SelAdornerStyle; list.Add(copy); }
public override HitTestResult HitTest(PointT pos, VectorT hitTestRadius, SelType sel) { var dif = pos.Sub(Point).Abs(); if (dif.X <= hitTestRadius.X && dif.Y <= hitTestRadius.Y) { return(new HitTestResult(this, sel != SelType.No ? Cursors.SizeAll : Cursors.Arrow)); } return(null); }
public HitTestResult HitTest(PointT pos, VectorT hitTestRadius, SelType sel) { var c = Center; if (c.Sub(pos).Length() > _radius) { return(null); } return(new HitTestResult(this, Cursors.SizeAll)); }
private void genDataSel_Click(object sender, RoutedEventArgs e) { if ((codeType == CodeType.CLIENT && !checkPath(Properties.Settings.Default.cdataPath, "客户端数据目录")) || (codeType == CodeType.SERVER && !checkPath(Properties.Settings.Default.sdataPath, "服务器数据目录"))) { return; } selType = SelType.SEL; genType = GenType.DATA; start(); }
private void genCodeAll_Click(object sender, RoutedEventArgs e) { if ((codeType == CodeType.CLIENT && (!checkPath(Properties.Settings.Default.ccodePath, "客户端代码目录") || !checkPath(Properties.Settings.Default.cscriptPath, "客户端脚本目录"))) || (codeType == CodeType.SERVER && !checkPath(Properties.Settings.Default.scodePath, "服务器代码目录"))) { return; } selType = SelType.ALL; genType = GenType.CODE; start(); }
public override void AddAdornersTo(ICollection <LLShape> list, SelType selMode, VectorT hitTestRadius) { if (selMode == SelType.Partial) { AddAdorner(list, Points[0], hitTestRadius); AddAdorner(list, Points[Points.Count - 1], hitTestRadius); } else if (selMode == SelType.Yes) { for (int i = 0; i < Points.Count; i++) { AddAdorner(list, Points[i], hitTestRadius); } } }
public override void AddAdornersTo(ICollection <LLShape> list, SelType selMode, VectorT hitTestRadius) { PointT tl = BBox.MinPoint, tr = new PointT(Right, Top); PointT br = BBox.MaxPoint, bl = new PointT(Left, Bottom); if (selMode == SelType.Yes) { AddCornerAdorner(list, tl, hitTestRadius.Neg()); AddCornerAdorner(list, br, hitTestRadius); } if (selMode != SelType.No) { hitTestRadius = hitTestRadius.Rot90(); AddCornerAdorner(list, bl, hitTestRadius); AddCornerAdorner(list, tr, hitTestRadius.Neg()); } }
private void genCodeSel_Click(object sender, RoutedEventArgs e) { if ((codeType == CodeType.CLIENT && !checkPath(Properties.Settings.Default.ccodePath, "客户端代码目录")) || (codeType == CodeType.SERVER && !checkPath(Properties.Settings.Default.scodePath, "服务器代码目录"))) { return; } if (codeType == CodeType.CLIENT && getSheetOutType(selectedArg.sheetName) == COutType.BOLO && !checkPath(Properties.Settings.Default.cscriptPath, "客户端脚本目录")) { return; } selType = SelType.SEL; genType = GenType.CODE; start(); }
public void AddAdornersTo(ICollection<LLShape> list, SelType selMode, Loyc.Geometry.Vector<float> hitTestRadius) { throw new NotImplementedException(); }
internal static extern IntPtr selCreateBrick(int h, int w, int cy, int cx, SelType type);
public override Util.WinForms.HitTestResult HitTest(PointT pos, VectorT hitTestRadius, SelType sel) { if (sel != SelType.No) { var bbox2 = BBox.Inflated(hitTestRadius.X, hitTestRadius.Y); PointT tl = BBox.MinPoint, tr = new PointT(Right, Top); PointT br = BBox.MaxPoint, bl = new PointT(Left, Bottom); if (PointsAreNear(pos, tr, hitTestRadius)) return new HitTestResult(this, Cursors.SizeNESW, RF.Top | RF.Right); if (PointsAreNear(pos, bl, hitTestRadius)) return new HitTestResult(this, Cursors.SizeNESW, RF.Bottom | RF.Left); if (sel == SelType.Yes) { if (PointsAreNear(pos, tl, hitTestRadius)) return new HitTestResult(this, Cursors.SizeNWSE, RF.Top | RF.Left); if (PointsAreNear(pos, br, hitTestRadius)) return new HitTestResult(this, Cursors.SizeNWSE, RF.Bottom | RF.Right); } } if (sel != SelType.No || (BoxType != BoxType.Borderless && !_isPanel)) { if (sel != SelType.Yes) hitTestRadius *= 2; var bbox2 = BBox.Deflated(hitTestRadius.X, hitTestRadius.Y); if (bbox2.Contains(pos)) return new HitTestResult(this, Cursors.SizeAll, RF.Top | RF.Bottom | RF.Left | RF.Right); } return BBox.Contains(pos) ? new HitTestResult(this, Cursors.Arrow, 0) : null; }
public override void AddAdornersTo(ICollection<LLShape> list, SelType selMode, VectorT hitTestRadius) { PointT tl = BBox.MinPoint, tr = new PointT(Right, Top); PointT br = BBox.MaxPoint, bl = new PointT(Left, Bottom); if (selMode == SelType.Yes) { AddCornerAdorner(list, tl, hitTestRadius.Neg()); AddCornerAdorner(list, br, hitTestRadius); } if (selMode != SelType.No) { hitTestRadius = hitTestRadius.Rot90(); AddCornerAdorner(list, bl, hitTestRadius); AddCornerAdorner(list, tr, hitTestRadius.Neg()); } }
public override Util.WinForms.HitTestResult HitTest(PointT pos, VectorT hitTestRadius, SelType sel) { if (!BBox.Inflated(hitTestRadius.X, hitTestRadius.Y).Contains(pos)) return null; if (sel == SelType.Partial) { if (PointsAreNear(pos, Points[0], hitTestRadius)) return new HitTestResult(this, Cursors.SizeAll, 0); if (PointsAreNear(pos, Points[Points.Count-1], hitTestRadius)) return new HitTestResult(this, Cursors.SizeAll, Points.Count-1); } else if (sel == SelType.Yes) { for (int i = 0; i < Points.Count; i++) { if (PointsAreNear(pos, Points[i], hitTestRadius)) return new HitTestResult(this, Cursors.SizeAll, i); } } PointT projected; float? where = LLShape.HitTestPolyline(pos, hitTestRadius.X, Points, EmptyList<int>.Value, out projected); if (where != null) { if (sel == SelType.Yes) { int seg = (int)where.Value; var angle = AngleMod8(Points[seg+1].Sub(Points[seg])); switch (angle & 3) { case 0: return new HitTestResult(this, Cursors.SizeNS, seg); case 1: return new HitTestResult(this, Cursors.SizeNESW, seg); case 2: return new HitTestResult(this, Cursors.SizeWE, seg); case 3: return new HitTestResult(this, Cursors.SizeNWSE, seg); } } else { return new HitTestResult(this, Cursors.Arrow, -1); } } return null; }
public override Util.WinForms.HitTestResult HitTest(PointT pos, VectorT hitTestRadius, SelType sel) { if (!BBox.Inflated(hitTestRadius.X, hitTestRadius.Y).Contains(pos)) { return(null); } if (sel == SelType.Partial) { if (PointsAreNear(pos, Points[0], hitTestRadius)) { return(new HitTestResult(this, Cursors.SizeAll, 0)); } if (PointsAreNear(pos, Points[Points.Count - 1], hitTestRadius)) { return(new HitTestResult(this, Cursors.SizeAll, Points.Count - 1)); } } else if (sel == SelType.Yes) { for (int i = 0; i < Points.Count; i++) { if (PointsAreNear(pos, Points[i], hitTestRadius)) { return(new HitTestResult(this, Cursors.SizeAll, i)); } } } PointT projected; float?where = LLShape.HitTestPolyline(pos, hitTestRadius.X, Points, EmptyList <int> .Value, out projected); if (where != null) { if (sel == SelType.Yes) { int seg = (int)where.Value; var angle = AngleMod8(Points[seg + 1].Sub(Points[seg])); switch (angle & 3) { case 0: return(new HitTestResult(this, Cursors.SizeNS, seg)); case 1: return(new HitTestResult(this, Cursors.SizeNESW, seg)); case 2: return(new HitTestResult(this, Cursors.SizeWE, seg)); case 3: return(new HitTestResult(this, Cursors.SizeNWSE, seg)); } } else { return(new HitTestResult(this, Cursors.Arrow, -1)); } } return(null); }
public abstract void AddAdornersTo(ICollection <LLShape> list, SelType selMode, VectorT hitTestRadius);
/// <summary>Hit-tests the shape and returns information that includes the /// mouse cursor to use for it.</summary> /// <returns>Null indicates a failed hit test. Inside the result object, the /// cursor <see cref="Cursors.Arrow"/> means that the shape is selectable, /// <see cref="Cursors.SizeAll"/> indicates that the user will be moving something, /// and a sizing cursor such as <see cref="SizeNS"/> indicates that something will /// be resized or that one line in a collection of lines will be moved along the /// indicated direction (e.g. up-down for SizeNS).</returns> public abstract HitTestResult HitTest(PointT pos, VectorT hitTestRadius, SelType sel);
public override Util.WinForms.HitTestResult HitTest(PointT pos, VectorT hitTestRadius, SelType sel) { if (sel != SelType.No) { var bbox2 = BBox.Inflated(hitTestRadius.X, hitTestRadius.Y); PointT tl = BBox.MinPoint, tr = new PointT(Right, Top); PointT br = BBox.MaxPoint, bl = new PointT(Left, Bottom); if (PointsAreNear(pos, tr, hitTestRadius)) { return(new HitTestResult(this, Cursors.SizeNESW, RF.Top | RF.Right)); } if (PointsAreNear(pos, bl, hitTestRadius)) { return(new HitTestResult(this, Cursors.SizeNESW, RF.Bottom | RF.Left)); } if (sel == SelType.Yes) { if (PointsAreNear(pos, tl, hitTestRadius)) { return(new HitTestResult(this, Cursors.SizeNWSE, RF.Top | RF.Left)); } if (PointsAreNear(pos, br, hitTestRadius)) { return(new HitTestResult(this, Cursors.SizeNWSE, RF.Bottom | RF.Right)); } } } if (sel != SelType.No || (BoxType != BoxType.Borderless && !_isPanel)) { if (sel != SelType.Yes) { hitTestRadius *= 2; } var bbox2 = BBox.Deflated(hitTestRadius.X, hitTestRadius.Y); if (bbox2.Contains(pos)) { return(new HitTestResult(this, Cursors.SizeAll, RF.Top | RF.Bottom | RF.Left | RF.Right)); } } return(BBox.Contains(pos) ? new HitTestResult(this, Cursors.Arrow, 0) : null); }
public void AddAdornersTo(ICollection <LLShape> list, SelType selMode, Loyc.Geometry.Vector <float> hitTestRadius) { throw new NotImplementedException(); }
public override void AddAdornersTo(ICollection<LLShape> list, SelType selMode, VectorT hitTestRadius) { if (selMode == SelType.Partial) { AddAdorner(list, Points[0], hitTestRadius); AddAdorner(list, Points[Points.Count - 1], hitTestRadius); } else if (selMode == SelType.Yes) for (int i = 0; i < Points.Count; i++) AddAdorner(list, Points[i], hitTestRadius); }