예제 #1
0
BOOL LLResizeBar::handleDoubleClick(S32 x, S32 y, MASK mask)
{
	LLRect orig_rect = mResizingView->getRect();
	LLRect scaled_rect = orig_rect;

	if (mSnappingEnabled && mAllowDoubleClickSnapping)
	{
		switch( mSide )
		{
		case LEFT:
			mResizingView->findSnapEdge(scaled_rect.mLeft, LLCoordGL(0, 0), SNAP_LEFT, SNAP_PARENT_AND_SIBLINGS, S32_MAX);
			scaled_rect.mLeft = scaled_rect.mRight - llclamp(scaled_rect.getWidth(), mMinSize, mMaxSize);
			break;
		case TOP:
			mResizingView->findSnapEdge(scaled_rect.mTop, LLCoordGL(0, 0), SNAP_TOP, SNAP_PARENT_AND_SIBLINGS, S32_MAX);
			scaled_rect.mTop = scaled_rect.mBottom + llclamp(scaled_rect.getHeight(), mMinSize, mMaxSize);
			break;
		case RIGHT:
			mResizingView->findSnapEdge(scaled_rect.mRight, LLCoordGL(0, 0), SNAP_RIGHT, SNAP_PARENT_AND_SIBLINGS, S32_MAX);
			scaled_rect.mRight = scaled_rect.mLeft + llclamp(scaled_rect.getWidth(), mMinSize, mMaxSize);
			break;
		case BOTTOM:
			mResizingView->findSnapEdge(scaled_rect.mBottom, LLCoordGL(0, 0), SNAP_BOTTOM, SNAP_PARENT_AND_SIBLINGS, S32_MAX);
			scaled_rect.mBottom = scaled_rect.mTop - llclamp(scaled_rect.getHeight(), mMinSize, mMaxSize);
			break;
		}

		mResizingView->userSetShape(scaled_rect);
		if(mDragCallback)mDragCallback(mDragCallbackUserdata);
	}

	return TRUE;
}
예제 #2
0
//static 
void LLUI::setMousePositionScreen(S32 x, S32 y)
{
	S32 screen_x, screen_y;
	screen_x = llround((F32)x * getScaleFactor().mV[VX]);
	screen_y = llround((F32)y * getScaleFactor().mV[VY]);
	
	LLView::getWindow()->setCursorPosition(LLCoordGL(screen_x, screen_y).convert());
}
예제 #3
0
void LLToolGrab::stopGrab()
{
	LLViewerObject* objectp = mGrabPick.getObject();
	if (!objectp)
	{
		return;
	}

	LLPickInfo pick = mGrabPick;

	if (mMode == GRAB_NONPHYSICAL)
	{
		// for non-physical (touch) grabs,
		// gather surface info for this degrab (mouse-up)
		S32 x = gViewerWindow->getCurrentMouseX();
		S32 y = gViewerWindow->getCurrentMouseY();
		pick.mMousePt = LLCoordGL(x, y);
		pick.getSurfaceInfo();
	}

	// Next, send messages to simulator
	LLMessageSystem *msg = gMessageSystem;
	switch(mMode)
	{
	case GRAB_ACTIVE_CENTER:
	case GRAB_NONPHYSICAL:
	case GRAB_LOCKED:
		msg->newMessageFast(_PREHASH_ObjectDeGrab);
		msg->nextBlockFast(_PREHASH_AgentData);
		msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
		msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
		msg->nextBlockFast(_PREHASH_ObjectData);
		msg->addU32Fast(_PREHASH_LocalID, objectp->mLocalID);
		msg->nextBlock("SurfaceInfo");
		msg->addVector3("UVCoord", LLVector3(pick.mUVCoords));
		msg->addVector3("STCoord", LLVector3(pick.mSTCoords));
		msg->addS32Fast(_PREHASH_FaceIndex, pick.mObjectFace);
		msg->addVector3("Position", pick.mIntersection);
		msg->addVector3("Normal", pick.mNormal);
		msg->addVector3("Binormal", pick.mBinormal);

		msg->sendMessage(objectp->getRegion()->getHost());

		mVerticalDragging = FALSE;
		break;

	case GRAB_NOOBJECT:
	case GRAB_INACTIVE:
	default:
		// do nothing
		break;
	}

	mHideBuildHighlight = FALSE;
}
예제 #4
0
void LLToolGrab::stopGrab()
{
	LLViewerObject* objectp = mGrabPick.getObject();
	if (!objectp)
	{
		return;
	}

	LLPickInfo pick = mGrabPick;

	if (mMode == GRAB_NONPHYSICAL)
	{
		// for non-physical (touch) grabs,
		// gather surface info for this degrab (mouse-up)
		S32 x = gViewerWindow->getCurrentMouseX();
		S32 y = gViewerWindow->getCurrentMouseY();
		pick.mMousePt = LLCoordGL(x, y);
		pick.getSurfaceInfo();
	}

	// Next, send messages to simulator
	switch(mMode)
	{
	case GRAB_ACTIVE_CENTER:
	case GRAB_NONPHYSICAL:
	case GRAB_LOCKED:
		send_ObjectDeGrab_message(objectp, pick);
		mVerticalDragging = FALSE;
		break;

	case GRAB_NOOBJECT:
	case GRAB_INACTIVE:
	default:
		// do nothing
		break;
	}

	mHideBuildHighlight = FALSE;
}
예제 #5
0
void LLToolGrab::handleHoverNonPhysical(S32 x, S32 y, MASK mask)
{
	LLViewerObject* objectp = mGrabPick.getObject();
	if (!objectp || !hasMouseCapture() ) return;
	if (objectp->isDead())
	{
		// Bail out of drag because object has been killed
		setMouseCapture(FALSE);
		return;
	}

	LLPickInfo pick = mGrabPick;
	pick.mMousePt = LLCoordGL(x, y);
	pick.getSurfaceInfo();

	// compute elapsed time
	F32 dt = mGrabTimer.getElapsedTimeAndResetF32();
	U32 dt_milliseconds = (U32) (1000.f * dt);

	// i'm not a big fan of the following code - it's been culled from the physical grab case.
	// ideally these two would be nicely integrated - but the code in that method is a serious
	// mess of spaghetti.  so here we go:

	LLVector3 grab_pos_region(0,0,0);
	
	const BOOL SUPPORT_LLDETECTED_GRAB = TRUE;
	if (SUPPORT_LLDETECTED_GRAB)
	{
		//--------------------------------------------------
		// Toggle vertical dragging
		//--------------------------------------------------
		if (mVerticalDragging && !(mask == MASK_VERTICAL) && !gGrabBtnVertical)
		{
			mVerticalDragging = FALSE;
		}
	
		else if (!mVerticalDragging && (mask == MASK_VERTICAL) )
		{
			mVerticalDragging = TRUE;
		}
	
		S32 dx = x - mLastMouseX;
		S32 dy = y - mLastMouseY;

		if (dx != 0 || dy != 0)
		{
			mAccumDeltaX += dx;
			mAccumDeltaY += dy;
		
			S32 dist_sq = mAccumDeltaX * mAccumDeltaX + mAccumDeltaY * mAccumDeltaY;
			if (dist_sq > SLOP_DIST_SQ)
			{
				mOutsideSlop = TRUE;
			}

			// mouse has moved 
			mHasMoved = TRUE;

			//------------------------------------------------------
			// Handle grabbing
			//------------------------------------------------------

			LLVector3d x_part;
			x_part.setVec(LLViewerCamera::getInstance()->getLeftAxis());
			x_part.mdV[VZ] = 0.0;
			x_part.normVec();

			LLVector3d y_part;
			if( mVerticalDragging )
			{
				y_part.setVec(LLViewerCamera::getInstance()->getUpAxis());
				// y_part.setVec(0.f, 0.f, 1.f);
			}
			else
			{
				// drag toward camera
				y_part = x_part % LLVector3d::z_axis;
				y_part.mdV[VZ] = 0.0;
				y_part.normVec();
			}

			mGrabHiddenOffsetFromCamera = mGrabHiddenOffsetFromCamera 
				+ (x_part * (-dx * GRAB_SENSITIVITY_X)) 
				+ (y_part * ( dy * GRAB_SENSITIVITY_Y));

		}
		
		// need to return offset from mGrabStartPoint
		LLVector3d grab_point_global = gAgent.getCameraPositionGlobal() + mGrabHiddenOffsetFromCamera;
		grab_pos_region = objectp->getRegion()->getPosRegionFromGlobal( grab_point_global );
	}

	LLMessageSystem *msg = gMessageSystem;
	msg->newMessageFast(_PREHASH_ObjectGrabUpdate);
	msg->nextBlockFast(_PREHASH_AgentData);
	msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
	msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
	msg->nextBlockFast(_PREHASH_ObjectData);
	msg->addUUIDFast(_PREHASH_ObjectID, objectp->getID() );
	msg->addVector3Fast(_PREHASH_GrabOffsetInitial, mGrabOffsetFromCenterInitial );
	msg->addVector3Fast(_PREHASH_GrabPosition, grab_pos_region );
	msg->addU32Fast(_PREHASH_TimeSinceLast, dt_milliseconds );
	msg->nextBlock("SurfaceInfo");
	msg->addVector3("UVCoord", LLVector3(pick.mUVCoords));
	msg->addVector3("STCoord", LLVector3(pick.mSTCoords));
	msg->addS32Fast(_PREHASH_FaceIndex, pick.mObjectFace);
	msg->addVector3("Position", pick.mIntersection);
	msg->addVector3("Normal", pick.mNormal);
	msg->addVector3("Binormal", pick.mBinormal);

	msg->sendMessage( objectp->getRegion()->getHost() );

	// update point-at / look-at
	if (pick.mObjectFace != -1) // if the intersection was on the surface of the obejct
	{
		LLVector3 local_edit_point = pick.mIntersection;
		local_edit_point -= objectp->getPositionAgent();
		local_edit_point = local_edit_point * ~objectp->getRenderRotation();
		gAgent.setPointAt(POINTAT_TARGET_GRAB, objectp, local_edit_point );
		gAgent.setLookAt(LOOKAT_TARGET_SELECT, objectp, local_edit_point );
	}
	
	
	
	gViewerWindow->setCursor(UI_CURSOR_HAND);  
}
예제 #6
0
	void ParamValue<LLCoordGL>::updateValueFromBlock()
	{
		updateValue(LLCoordGL(x, y));
	}