Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Michael Migliore
VTK
Commits
775065d2
Commit
775065d2
authored
Aug 16, 2010
by
Julien Finet
Committed by
Marcus D. Hanwell
Aug 22, 2010
Browse files
ENH: Mouse buttons are now binary comparable
NO_BUTTON = 0 LEFT_BUTTON = 1 MIDDLE_BUTTON = 2 RIGHT_BUTTON = 4
parent
544562ed
Changes
5
Hide whitespace changes
Inline
Side-by-side
Charts/vtkBlockItem.cxx
View file @
775065d2
...
...
@@ -36,7 +36,7 @@ vtkBlockItem::vtkBlockItem()
{
this
->
Label
=
NULL
;
this
->
MouseOver
=
false
;
this
->
MouseButtonPressed
=
-
1
;
this
->
MouseButtonPressed
=
vtkContextMouseEvent
::
NO_BUTTON
;
this
->
scalarFunction
=
NULL
;
this
->
Dimensions
[
0
]
=
0
;
this
->
Dimensions
[
1
]
=
0
;
...
...
@@ -172,7 +172,7 @@ bool vtkBlockItem::MouseButtonPressEvent(const vtkContextMouseEvent &mouse)
//-----------------------------------------------------------------------------
bool
vtkBlockItem
::
MouseButtonReleaseEvent
(
const
vtkContextMouseEvent
&
)
{
this
->
MouseButtonPressed
=
-
1
;
this
->
MouseButtonPressed
=
vtkContextMouseEvent
::
NO_BUTTON
;
return
true
;
}
...
...
Charts/vtkChartPie.cxx
View file @
775065d2
...
...
@@ -193,7 +193,7 @@ bool vtkChartPie::MouseEnterEvent(const vtkContextMouseEvent &)
//-----------------------------------------------------------------------------
bool
vtkChartPie
::
MouseMoveEvent
(
const
vtkContextMouseEvent
&
mouse
)
{
if
(
mouse
.
Button
<
0
)
if
(
mouse
.
Button
==
vtkContextMouseEvent
::
NO_BUTTON
)
{
this
->
Scene
->
SetDirty
(
true
);
this
->
Tooltip
->
SetVisible
(
this
->
LocatePointInPlots
(
mouse
));
...
...
Charts/vtkChartXY.cxx
View file @
775065d2
...
...
@@ -1021,7 +1021,7 @@ bool vtkChartXY::MouseMoveEvent(const vtkContextMouseEvent &mouse)
// Mark the scene as dirty
this
->
Scene
->
SetDirty
(
true
);
}
else
if
(
mouse
.
Button
<
0
)
else
if
(
mouse
.
Button
==
vtkContextMouseEvent
::
NO_BUTTON
)
{
this
->
Scene
->
SetDirty
(
true
);
this
->
Tooltip
->
SetVisible
(
this
->
LocatePointInPlots
(
mouse
));
...
...
Charts/vtkContextMouseEvent.h
View file @
775065d2
...
...
@@ -30,9 +30,10 @@ public:
// Description:
// Enumeration of mouse buttons.
enum
{
LEFT_BUTTON
=
0
,
MIDDLE_BUTTON
,
RIGHT_BUTTON
NO_BUTTON
=
0
,
LEFT_BUTTON
=
1
,
MIDDLE_BUTTON
=
2
,
RIGHT_BUTTON
=
4
};
// Description:
...
...
@@ -60,7 +61,7 @@ public:
vtkVector2i
LastScreenPos
;
// Description:
// Mouse button that
was pressed
, using the anonymous enumeration.
// Mouse button that
caused the event
, using the anonymous enumeration.
int
Button
;
};
//ETX
...
...
Charts/vtkContextScene.cxx
View file @
775065d2
...
...
@@ -79,26 +79,26 @@ public:
this
->
Target
->
MouseMoveEvent
(
x
,
y
);
break
;
case
vtkCommand
::
LeftButtonPressEvent
:
this
->
Target
->
ButtonPressEvent
(
0
,
x
,
y
);
this
->
Target
->
ButtonPressEvent
(
vtkContextMouseEvent
::
LEFT_BUTTON
,
x
,
y
);
break
;
case
vtkCommand
::
MiddleButtonPressEvent
:
this
->
Target
->
ButtonPressEvent
(
1
,
x
,
y
);
this
->
Target
->
ButtonPressEvent
(
vtkContextMouseEvent
::
MIDDLE_BUTTON
,
x
,
y
);
break
;
case
vtkCommand
::
RightButtonPressEvent
:
this
->
Target
->
ButtonPressEvent
(
2
,
x
,
y
);
this
->
Target
->
ButtonPressEvent
(
vtkContextMouseEvent
::
RIGHT_BUTTON
,
x
,
y
);
break
;
case
vtkCommand
::
LeftButtonReleaseEvent
:
this
->
Target
->
ButtonReleaseEvent
(
0
,
x
,
y
);
this
->
Target
->
ButtonReleaseEvent
(
vtkContextMouseEvent
::
LEFT_BUTTON
,
x
,
y
);
break
;
case
vtkCommand
::
MiddleButtonReleaseEvent
:
this
->
Target
->
ButtonReleaseEvent
(
1
,
x
,
y
);
this
->
Target
->
ButtonReleaseEvent
(
vtkContextMouseEvent
::
MIDDLE_BUTTON
,
x
,
y
);
break
;
case
vtkCommand
::
RightButtonReleaseEvent
:
this
->
Target
->
ButtonReleaseEvent
(
2
,
x
,
y
);
this
->
Target
->
ButtonReleaseEvent
(
vtkContextMouseEvent
::
RIGHT_BUTTON
,
x
,
y
);
break
;
case
vtkCommand
::
MouseWheelForwardEvent
:
// There is a forward and a backward event - not clear on deltas...
this
->
Target
->
MouseWheelEvent
(
1
,
x
,
y
);
this
->
Target
->
MouseWheelEvent
(
+
1
,
x
,
y
);
break
;
case
vtkCommand
::
MouseWheelBackwardEvent
:
// There is a forward and a backward event - not clear on deltas...
...
...
@@ -126,8 +126,8 @@ class vtkContextScene::Private
public:
Private
()
{
this
->
itemMousePressCurrent
=
-
1
;
this
->
Event
.
Button
=
-
1
;
this
->
itemMousePressCurrent
=
-
1
;
this
->
Event
.
Button
=
vtkContextMouseEvent
::
NO_BUTTON
;
this
->
IsDirty
=
true
;
}
~
Private
()
...
...
@@ -615,7 +615,7 @@ void vtkContextScene::ButtonReleaseEvent(int button, int x, int y)
->
MouseButtonReleaseEvent
(
event
);
this
->
Storage
->
itemMousePressCurrent
=
-
1
;
}
this
->
Storage
->
Event
.
Button
=
-
1
;
this
->
Storage
->
Event
.
Button
=
vtkContextMouseEvent
::
NO_BUTTON
;
}
void
vtkContextScene
::
MouseWheelEvent
(
int
delta
,
int
x
,
int
y
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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