summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorMonroe Linden <monroe@lindenlab.com>2009-11-10 16:49:57 -0800
committerMonroe Linden <monroe@lindenlab.com>2009-11-10 16:49:57 -0800
commit9d2102519d88feec434b79e1d9bb7d86ac6e7794 (patch)
treeb64bf7b8dad700e3a8a001348448d43be5c53b52 /indra
parent34ab8e11e86e025a8acec03518b5d84f3e5c68b1 (diff)
Fix for DEV-42400 (Mouse pointer location does not map correctly to non-square media faces).
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llviewermedia.cpp38
1 files changed, 25 insertions, 13 deletions
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 66d48fadd1..605861f1cb 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -1133,11 +1133,15 @@ void LLViewerMediaImpl::mouseMove(S32 x, S32 y, MASK mask)
void LLViewerMediaImpl::mouseDown(const LLVector2& texture_coords, MASK mask, S32 button)
{
if(mMediaSource)
- {
- mouseDown(
- llround(texture_coords.mV[VX] * mMediaSource->getTextureWidth()),
- llround((1.0f - texture_coords.mV[VY]) * mMediaSource->getTextureHeight()),
- mask, button);
+ {
+ // scale x and y to texel units.
+ S32 x = llround(texture_coords.mV[VX] * mMediaSource->getTextureWidth());
+ S32 y = llround((1.0f - texture_coords.mV[VY]) * mMediaSource->getTextureHeight());
+
+ // Adjust for the difference between the actual texture height and the amount of the texture in use.
+ y -= (mMediaSource->getTextureHeight() - mMediaSource->getHeight());
+
+ mouseDown(x, y, mask, button);
}
}
@@ -1145,10 +1149,14 @@ void LLViewerMediaImpl::mouseUp(const LLVector2& texture_coords, MASK mask, S32
{
if(mMediaSource)
{
- mouseUp(
- llround(texture_coords.mV[VX] * mMediaSource->getTextureWidth()),
- llround((1.0f - texture_coords.mV[VY]) * mMediaSource->getTextureHeight()),
- mask, button);
+ // scale x and y to texel units.
+ S32 x = llround(texture_coords.mV[VX] * mMediaSource->getTextureWidth());
+ S32 y = llround((1.0f - texture_coords.mV[VY]) * mMediaSource->getTextureHeight());
+
+ // Adjust for the difference between the actual texture height and the amount of the texture in use.
+ y -= (mMediaSource->getTextureHeight() - mMediaSource->getHeight());
+
+ mouseUp(x, y, mask, button);
}
}
@@ -1156,10 +1164,14 @@ void LLViewerMediaImpl::mouseMove(const LLVector2& texture_coords, MASK mask)
{
if(mMediaSource)
{
- mouseMove(
- llround(texture_coords.mV[VX] * mMediaSource->getTextureWidth()),
- llround((1.0f - texture_coords.mV[VY]) * mMediaSource->getTextureHeight()),
- mask);
+ // scale x and y to texel units.
+ S32 x = llround(texture_coords.mV[VX] * mMediaSource->getTextureWidth());
+ S32 y = llround((1.0f - texture_coords.mV[VY]) * mMediaSource->getTextureHeight());
+
+ // Adjust for the difference between the actual texture height and the amount of the texture in use.
+ y -= (mMediaSource->getTextureHeight() - mMediaSource->getHeight());
+
+ mouseMove(x, y, mask);
}
}