Icon-O-Matic: Refactor code slightly
* The condition in TransformBox::MouseOver is always true (hint: _DragStateFor never returns a null value) * The code sometimes calls fCurrentState->UpdateViewCursor twice Change-Id: I073203278fc103f5ee720dfbe06bf1f04f48c99f Reviewed-on: https://review.haiku-os.org/c/haiku/+/6179 Tested-by: Automation <[email protected]> Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
committed by
Adrien Destugues
parent
302df93219
commit
cc1d9fb0fe
@@ -201,14 +201,12 @@ TransformBox::MouseOver(BPoint where)
|
|||||||
{
|
{
|
||||||
TransformToCanvas(where);
|
TransformToCanvas(where);
|
||||||
|
|
||||||
_SetState(_DragStateFor(where, ZoomLevel()));
|
|
||||||
fMousePos = where;
|
fMousePos = where;
|
||||||
if (fCurrentState) {
|
fCurrentState = _DragStateFor(where, ZoomLevel());
|
||||||
fCurrentState->UpdateViewCursor(fView, fMousePos);
|
fCurrentState->UpdateViewCursor(fView, fMousePos);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// DoubleClicked
|
// DoubleClicked
|
||||||
@@ -725,17 +723,3 @@ TransformBox::_NotifyDeleted() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
|
||||||
|
|
||||||
|
|
||||||
// _SetState
|
|
||||||
void
|
|
||||||
TransformBox::_SetState(DragState* state)
|
|
||||||
{
|
|
||||||
if (state != fCurrentState) {
|
|
||||||
fCurrentState = state;
|
|
||||||
fCurrentState->UpdateViewCursor(fView, fMousePos);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
@@ -125,8 +125,6 @@ class TransformBox : public ChannelTransform,
|
|||||||
void _NotifyDeleted() const;
|
void _NotifyDeleted() const;
|
||||||
|
|
||||||
// "static" state objects
|
// "static" state objects
|
||||||
void _SetState(DragState* state);
|
|
||||||
|
|
||||||
StateView* fView;
|
StateView* fView;
|
||||||
|
|
||||||
DragState* fDragLTState;
|
DragState* fDragLTState;
|
||||||
|
|||||||
Reference in New Issue
Block a user