Minsky
minsky::LassoBox Struct Reference

represents rectangular region of a lasso operation More...

#include <lasso.h>

Collaboration diagram for minsky::LassoBox:
Collaboration graph

Public Member Functions

 LassoBox ()
 
 LassoBox (float x0, float y0, float x1, float y1)
 
template<class Item >
bool intersects (const Item &item) const
 returns whether item's icon overlaps the lasso More...
 
bool contains (const Wire &wire) const
 return true if both endpoints of the wire lie within the lasso More...
 

Public Attributes

float x0 =0
 
float y0 =0
 
float x1 =0
 
float y1 =0
 
float angle =0
 

Detailed Description

represents rectangular region of a lasso operation

Definition at line 28 of file lasso.h.

Constructor & Destructor Documentation

◆ LassoBox() [1/2]

minsky::LassoBox::LassoBox ( )
inline

Definition at line 31 of file lasso.h.

31 {}

◆ LassoBox() [2/2]

minsky::LassoBox::LassoBox ( float  x0,
float  y0,
float  x1,
float  y1 
)

Definition at line 29 of file lasso.cc.

References x0, x1, y0, and y1.

29  :
30  x0(x0), y0(y0), x1(x1), y1(y1)
31 {
32  if (x0>x1) std::swap(this->x0,this->x1);
33  if (y0>y1) std::swap(this->y0,this->y1);
34 }
float x0
Definition: lasso.h:30
float y1
Definition: lasso.h:30
float x1
Definition: lasso.h:30
float y0
Definition: lasso.h:30

Member Function Documentation

◆ contains()

bool minsky::LassoBox::contains ( const Wire wire) const

return true if both endpoints of the wire lie within the lasso

Definition at line 37 of file lasso.cc.

References minsky::wire.

38 {
39  // Make sure both ends of wires are selected in all cases. For ticket 1147
40  return (intersects(wire.from()->item()) && intersects(wire.to()->item()));
41 }
bool intersects(const Item &item) const
returns whether item&#39;s icon overlaps the lasso
Definition: lasso.h:36

◆ intersects()

template<class Item >
bool minsky::LassoBox::intersects ( const Item item) const
inline

returns whether item's icon overlaps the lasso

Definition at line 36 of file lasso.h.

References minsky::Item::bottom(), minsky::Item::left(), minsky::Item::right(), minsky::Item::top(), x0, x1, y0, and y1.

Referenced by minsky::Canvas::select().

36  {
37  return item.right() >= x0 && item.left() <= x1 &&
38  item.bottom() >= y0 && item.top() <= y1;
39  }
float x0
Definition: lasso.h:30
float y1
Definition: lasso.h:30
float x1
Definition: lasso.h:30
float y0
Definition: lasso.h:30
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ angle

float minsky::LassoBox::angle =0

Definition at line 30 of file lasso.h.

◆ x0

◆ x1

◆ y0

◆ y1


The documentation for this struct was generated from the following files: