mirror of
https://github.com/KLayout/klayout.git
synced 2026-09-01 10:27:53 +02:00
Pressing Ctrl key while drawing a box forces it into a square
This commit is contained in:
@@ -188,9 +188,11 @@ snap_angle (const db::DVector &in, lay::angle_constraint_type ac, db::DVector *s
|
||||
std::vector <db::DVector> ref_dir;
|
||||
if (ac != lay::AC_Any) {
|
||||
ref_dir.reserve (4);
|
||||
ref_dir.push_back (db::DVector (1.0, 0));
|
||||
ref_dir.push_back (db::DVector (0, 1.0));
|
||||
if (ac == lay::AC_Diagonal) {
|
||||
if (ac != lay::AC_DiagonalOnly) {
|
||||
ref_dir.push_back (db::DVector (1.0, 0));
|
||||
ref_dir.push_back (db::DVector (0, 1.0));
|
||||
}
|
||||
if (ac == lay::AC_Diagonal || ac == lay::AC_DiagonalOnly) {
|
||||
ref_dir.push_back (db::DVector (-1.0, 1.0));
|
||||
ref_dir.push_back (db::DVector (1.0, 1.0));
|
||||
}
|
||||
@@ -963,6 +965,10 @@ make_cutlines (lay::angle_constraint_type snap_mode, const db::DPoint &p1, std::
|
||||
cutlines.push_back (db::DEdge (p1, p1 + db::DVector (1.0, 0.0)));
|
||||
cutlines.push_back (db::DEdge (p1, p1 + db::DVector (1.0, 1.0)));
|
||||
cutlines.push_back (db::DEdge (p1, p1 + db::DVector (1.0, -1.0)));
|
||||
} else if (snap_mode == lay::AC_DiagonalOnly) {
|
||||
cutlines.reserve (2);
|
||||
cutlines.push_back (db::DEdge (p1, p1 + db::DVector (1.0, 1.0)));
|
||||
cutlines.push_back (db::DEdge (p1, p1 + db::DVector (1.0, -1.0)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace lay
|
||||
* Vertical: vertical only
|
||||
* Global: use global setting (templates and ruler specific setting only)
|
||||
*/
|
||||
enum angle_constraint_type { AC_Any = 0, AC_Diagonal, AC_Ortho, AC_Horizontal, AC_Vertical, AC_Global, AC_NumModes };
|
||||
enum angle_constraint_type { AC_Any = 0, AC_Diagonal, AC_DiagonalOnly, AC_Ortho, AC_Horizontal, AC_Vertical, AC_Global, AC_NumModes };
|
||||
|
||||
/**
|
||||
* @brief snap a coordinate value to a unit grid
|
||||
|
||||
Reference in New Issue
Block a user