Advertisement
Guest User

Untitled

a guest
Dec 11th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. procedure TSelectorTool.MouseUp(X, Y, AWidth, AHeight: Integer; Shift: TShiftState);
  2. var i: Integer;
  3. boundsWithWidth:TDoubleRect;
  4. th: Double;
  5. begin
  6. with Figure.bounds do begin
  7. if (Left = Right) or (Top = Bottom) then begin
  8. Top -= 1/scale;
  9. Left -= 1/scale;
  10. Bottom += 1/scale;
  11. Right += 1/scale;
  12. end;
  13. end;
  14. if not (ssCtrl in Shift) then
  15. UnselectAll;
  16. for i := High(Figures) downto 0 do begin
  17. th := Figures[i].thickness/scale;
  18. with figure.bounds do begin
  19. if Left < Right then
  20. boundsWithWidth := DoubleRect(Left - (th/2), Top, Right + (th/2), Bottom)
  21. else
  22. boundsWithWidth := DoubleRect(Left + (th/2), Top, Right - (th/2), Bottom);
  23. if Top < Bottom then
  24. boundsWithWidth := DoubleRect(boundsWithWidth.Left, Top - (th/2),
  25. boundsWithWidth.Right, Bottom + (th/2))
  26. else
  27. boundsWithWidth := DoubleRect(boundsWithWidth.Left, Top + (th/2),
  28. boundsWithWidth.Right, Bottom - (th/2));
  29. end;
  30. if Figures[i].IsIntersect(boundsWithWidth) then begin
  31. if ssCtrl in Shift then
  32. Figures[i].Selected := not Figures[i].Selected
  33. else
  34. Figures[i].Selected := true;
  35. if (abs(Figure.bounds.Left - Figure.bounds.Right) < 4/scale) and
  36. (abs(Figure.bounds.Top - Figure.bounds.Bottom) < 4/scale)
  37. then
  38. break;
  39. end;
  40. end;
  41. Figure := nil;
  42. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement