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:
Zardshard
2023-03-11 10:22:02 +00:00
committed by Adrien Destugues
parent 302df93219
commit cc1d9fb0fe
2 changed files with 4 additions and 22 deletions
@@ -201,13 +201,11 @@ TransformBox::MouseOver(BPoint where)
{
TransformToCanvas(where);
_SetState(_DragStateFor(where, ZoomLevel()));
fMousePos = where;
if (fCurrentState) {
fCurrentState->UpdateViewCursor(fView, fMousePos);
return true;
}
return false;
fCurrentState = _DragStateFor(where, ZoomLevel());
fCurrentState->UpdateViewCursor(fView, fMousePos);
return true;
}
@@ -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;
// "static" state objects
void _SetState(DragState* state);
StateView* fView;
DragState* fDragLTState;