Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- procedure TSelectorTool.MouseUp(X, Y, AWidth, AHeight: Integer; Shift: TShiftState);
- var i: Integer;
- boundsWithWidth:TDoubleRect;
- th: Double;
- begin
- with Figure.bounds do begin
- if (Left = Right) or (Top = Bottom) then begin
- Top -= 1/scale;
- Left -= 1/scale;
- Bottom += 1/scale;
- Right += 1/scale;
- end;
- end;
- if not (ssCtrl in Shift) then
- UnselectAll;
- for i := High(Figures) downto 0 do begin
- th := Figures[i].thickness/scale;
- with figure.bounds do begin
- if Left < Right then
- boundsWithWidth := DoubleRect(Left - (th/2), Top, Right + (th/2), Bottom)
- else
- boundsWithWidth := DoubleRect(Left + (th/2), Top, Right - (th/2), Bottom);
- if Top < Bottom then
- boundsWithWidth := DoubleRect(boundsWithWidth.Left, Top - (th/2),
- boundsWithWidth.Right, Bottom + (th/2))
- else
- boundsWithWidth := DoubleRect(boundsWithWidth.Left, Top + (th/2),
- boundsWithWidth.Right, Bottom - (th/2));
- end;
- if Figures[i].IsIntersect(boundsWithWidth) then begin
- if ssCtrl in Shift then
- Figures[i].Selected := not Figures[i].Selected
- else
- Figures[i].Selected := true;
- if (abs(Figure.bounds.Left - Figure.bounds.Right) < 4/scale) and
- (abs(Figure.bounds.Top - Figure.bounds.Bottom) < 4/scale)
- then
- break;
- end;
- end;
- Figure := nil;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement