Update guiMissionArea.cpp

set a minimum size for the level bounds, this stops the mouse drag issue until it is sorted out properly
This commit is contained in:
marauder2k7 2025-06-15 16:23:57 +01:00
parent 0a1e3f74ed
commit 4fc182444e

View file

@ -141,8 +141,6 @@ bool GuiMissionAreaCtrl::onWake()
if(!Parent::onWake())
return(false);
updateLevelBitmap();
// make sure mission area is clamped
setArea(getArea());
@ -167,6 +165,11 @@ void GuiMissionAreaCtrl::onMouseUp(const GuiEvent & event)
if(!bool(mMissionArea))
return;
//unlock the mouse
mouseUnlock();
mLastMousePoint = event.mousePoint;
RectI box;
getScreenMissionArea(box);
S32 hit = getHitHandles(event.mousePoint, box);
@ -188,6 +191,11 @@ void GuiMissionAreaCtrl::onMouseDown(const GuiEvent & event)
if(!bool(mMissionArea))
return;
setFirstResponder();
// lock mouse
mouseLock();
RectI box;
getScreenMissionArea(box);
@ -354,6 +362,19 @@ void GuiMissionAreaCtrl::updateLevelBitmap()
mLevelBounds.intersect(box);
}
const F32 minSize = 256.0f;
// Ensure the bounding box has a minimum size and is square
VectorF size = mLevelBounds.getExtents();
F32 maxExtent = getMax(getMax(size.x, size.y), minSize);
// Expand to make it square and centered
Point3F center = mLevelBounds.getCenter();
Point3F halfExtents(maxExtent * 0.5f, maxExtent * 0.5f, size.z * 0.5f);
mLevelBounds.minExtents = center - halfExtents;
mLevelBounds.maxExtents = center + halfExtents;
GFXTransformSaver saver;
// Calculate orthographic dimensions