Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
95a6e8de
Commit
95a6e8de
authored
Jun 23, 2014
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dragging items by their origin is optional (activated by dragging elements with Ctrl held).
parent
b4e0a5cb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
5 deletions
+28
-5
edit_tool.cpp
pcbnew/tools/edit_tool.cpp
+25
-5
edit_tool.h
pcbnew/tools/edit_tool.h
+3
-0
No files found.
pcbnew/tools/edit_tool.cpp
View file @
95a6e8de
...
@@ -147,7 +147,7 @@ int EDIT_TOOL::Main( TOOL_EVENT& aEvent )
...
@@ -147,7 +147,7 @@ int EDIT_TOOL::Main( TOOL_EVENT& aEvent )
// Drag items to the current cursor position
// Drag items to the current cursor position
for
(
unsigned
int
i
=
0
;
i
<
selection
.
items
.
GetCount
();
++
i
)
for
(
unsigned
int
i
=
0
;
i
<
selection
.
items
.
GetCount
();
++
i
)
selection
.
Item
<
BOARD_ITEM
>
(
i
)
->
Move
(
movement
);
selection
.
Item
<
BOARD_ITEM
>
(
i
)
->
Move
(
movement
+
m_offset
);
updateRatsnest
(
true
);
updateRatsnest
(
true
);
}
}
...
@@ -157,9 +157,21 @@ int EDIT_TOOL::Main( TOOL_EVENT& aEvent )
...
@@ -157,9 +157,21 @@ int EDIT_TOOL::Main( TOOL_EVENT& aEvent )
editFrame
->
OnModify
();
editFrame
->
OnModify
();
editFrame
->
SaveCopyInUndoList
(
selection
.
items
,
UR_CHANGED
);
editFrame
->
SaveCopyInUndoList
(
selection
.
items
,
UR_CHANGED
);
if
(
evt
->
Modifier
(
MD_CTRL
)
)
{
// Set the current cursor position to the first dragged item origin, so the
// Set the current cursor position to the first dragged item origin, so the
// movement vector could be computed later
// movement vector could be computed later
m_cursor
=
VECTOR2I
(
selection
.
Item
<
BOARD_ITEM
>
(
0
)
->
GetPosition
()
);
m_cursor
=
VECTOR2I
(
selection
.
Item
<
BOARD_ITEM
>
(
0
)
->
GetPosition
()
);
m_offset
.
x
=
0
;
m_offset
.
y
=
0
;
}
else
{
// Update dragging offset (distance between cursor and the first dragged item)
m_offset
=
static_cast
<
BOARD_ITEM
*>
(
selection
.
items
.
GetPickedItem
(
0
)
)
->
GetPosition
()
-
wxPoint
(
m_cursor
.
x
,
m_cursor
.
y
);
}
m_dragging
=
true
;
m_dragging
=
true
;
}
}
...
@@ -309,6 +321,10 @@ int EDIT_TOOL::Rotate( TOOL_EVENT& aEvent )
...
@@ -309,6 +321,10 @@ int EDIT_TOOL::Rotate( TOOL_EVENT& aEvent )
updateRatsnest
(
m_dragging
);
updateRatsnest
(
m_dragging
);
// Update dragging offset (distance between cursor and the first dragged item)
m_offset
=
static_cast
<
BOARD_ITEM
*>
(
selection
.
items
.
GetPickedItem
(
0
)
)
->
GetPosition
()
-
rotatePoint
;
if
(
m_dragging
)
if
(
m_dragging
)
selection
.
group
->
ViewUpdate
(
KIGFX
::
VIEW_ITEM
::
GEOMETRY
);
selection
.
group
->
ViewUpdate
(
KIGFX
::
VIEW_ITEM
::
GEOMETRY
);
else
else
...
@@ -359,6 +375,10 @@ int EDIT_TOOL::Flip( TOOL_EVENT& aEvent )
...
@@ -359,6 +375,10 @@ int EDIT_TOOL::Flip( TOOL_EVENT& aEvent )
updateRatsnest
(
m_dragging
);
updateRatsnest
(
m_dragging
);
// Update dragging offset (distance between cursor and the first dragged item)
m_offset
=
static_cast
<
BOARD_ITEM
*>
(
selection
.
items
.
GetPickedItem
(
0
)
)
->
GetPosition
()
-
flipPoint
;
if
(
m_dragging
)
if
(
m_dragging
)
selection
.
group
->
ViewUpdate
(
KIGFX
::
VIEW_ITEM
::
GEOMETRY
);
selection
.
group
->
ViewUpdate
(
KIGFX
::
VIEW_ITEM
::
GEOMETRY
);
else
else
...
@@ -491,7 +511,7 @@ wxPoint EDIT_TOOL::getModificationPoint( const SELECTION_TOOL::SELECTION& aSelec
...
@@ -491,7 +511,7 @@ wxPoint EDIT_TOOL::getModificationPoint( const SELECTION_TOOL::SELECTION& aSelec
{
{
if
(
aSelection
.
Size
()
==
1
)
if
(
aSelection
.
Size
()
==
1
)
{
{
return
aSelection
.
Item
<
BOARD_ITEM
>
(
0
)
->
GetPosition
();
return
aSelection
.
Item
<
BOARD_ITEM
>
(
0
)
->
GetPosition
()
-
m_offset
;
}
}
else
else
{
{
...
...
pcbnew/tools/edit_tool.h
View file @
95a6e8de
...
@@ -98,6 +98,9 @@ private:
...
@@ -98,6 +98,9 @@ private:
///> Flag determining if anything is being dragged right now
///> Flag determining if anything is being dragged right now
bool
m_dragging
;
bool
m_dragging
;
///> Offset from the dragged item's center (anchor)
wxPoint
m_offset
;
///> Last cursor position (needed for getModificationPoint() to avoid changes
///> Last cursor position (needed for getModificationPoint() to avoid changes
///> of edit reference point).
///> of edit reference point).
VECTOR2I
m_cursor
;
VECTOR2I
m_cursor
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment