fix cursor visibility bug.
This commit is contained in:
@@ -52,14 +52,14 @@ public class MultipleMonitorCreator : MonoBehaviour
|
|||||||
var monitor = texture.monitor;
|
var monitor = texture.monitor;
|
||||||
|
|
||||||
// Set width / height
|
// Set width / height
|
||||||
go.transform.localScale = new Vector3(monitor.widthMeter, go.transform.localScale.y, monitor.heightMeter);
|
go.transform.localScale = new Vector3(monitor.widthMeter, go.transform.localScale.y, monitor.heightMeter) * scale;
|
||||||
|
|
||||||
// Set parent as this object
|
// Set parent as this object
|
||||||
go.transform.SetParent(transform);
|
go.transform.SetParent(transform);
|
||||||
|
|
||||||
// Calc actual size considering mesh size
|
// Calc actual size considering mesh size
|
||||||
var scaleX = go.GetComponent<MeshFilter>().sharedMesh.bounds.extents.x * 2f;
|
var scaleX = go.GetComponent<MeshFilter>().sharedMesh.bounds.extents.x * 2f;
|
||||||
totalWidth_ += monitor.widthMeter * scaleX;
|
totalWidth_ += monitor.widthMeter * scale * scaleX;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ public class MultipleMonitorCreator : MonoBehaviour
|
|||||||
foreach (var go in monitors_) {
|
foreach (var go in monitors_) {
|
||||||
var monitor = go.GetComponent<uDesktopDuplication.Texture>().monitor;
|
var monitor = go.GetComponent<uDesktopDuplication.Texture>().monitor;
|
||||||
var halfScaleX = go.GetComponent<MeshFilter>().sharedMesh.bounds.extents.x;
|
var halfScaleX = go.GetComponent<MeshFilter>().sharedMesh.bounds.extents.x;
|
||||||
var width = monitor.widthMeter;
|
var width = monitor.widthMeter * scale;
|
||||||
var halfWidth = width * halfScaleX;
|
var halfWidth = width * halfScaleX;
|
||||||
x += halfWidth;
|
x += halfWidth;
|
||||||
go.transform.localPosition = new Vector3(x, 0f, 0f);
|
go.transform.localPosition = new Vector3(x, 0f, 0f);
|
||||||
|
|||||||
Binary file not shown.
@@ -27,8 +27,8 @@ public class Cursor : MonoBehaviour
|
|||||||
if (monitor.isCursorVisible) {
|
if (monitor.isCursorVisible) {
|
||||||
UpdatePosition();
|
UpdatePosition();
|
||||||
UpdateTexture();
|
UpdateTexture();
|
||||||
UpdateMaterial();
|
|
||||||
}
|
}
|
||||||
|
UpdateMaterial();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdatePosition()
|
void UpdatePosition()
|
||||||
@@ -60,8 +60,9 @@ public class Cursor : MonoBehaviour
|
|||||||
|
|
||||||
void UpdateMaterial()
|
void UpdateMaterial()
|
||||||
{
|
{
|
||||||
var x = monitor.isCursorVisible ? (float)monitor.cursorX / monitor.width : -9999f;
|
bool isVisible = monitor.isCursorVisible;
|
||||||
var y = monitor.isCursorVisible ? (float)monitor.cursorY / monitor.height : -9999f;
|
var x = isVisible ? (float)monitor.cursorX / monitor.width : -9999f;
|
||||||
|
var y = isVisible ? (float)monitor.cursorY / monitor.height : -9999f;
|
||||||
var w = (float)monitor.cursorShapeWidth / monitor.width;
|
var w = (float)monitor.cursorShapeWidth / monitor.width;
|
||||||
var h = (float)monitor.cursorShapeHeight / monitor.height;
|
var h = (float)monitor.cursorShapeHeight / monitor.height;
|
||||||
uddTexture_.material.SetVector("_CursorPositionScale", new Vector4(x, y, w, h));
|
uddTexture_.material.SetVector("_CursorPositionScale", new Vector4(x, y, w, h));
|
||||||
|
|||||||
@@ -35,10 +35,11 @@ void Cursor::UpdateBuffer(const DXGI_OUTDUPL_FRAME_INFO& frameInfo)
|
|||||||
|
|
||||||
x_ = frameInfo.PointerPosition.Position.x;
|
x_ = frameInfo.PointerPosition.Position.x;
|
||||||
y_ = frameInfo.PointerPosition.Position.y;
|
y_ = frameInfo.PointerPosition.Position.y;
|
||||||
|
isVisible_ = frameInfo.PointerPosition.Visible != 0;
|
||||||
|
timestamp_ = frameInfo.LastMouseUpdateTime;
|
||||||
|
|
||||||
if (frameInfo.PointerPosition.Visible != 0) {
|
if (frameInfo.PointerPosition.Visible != 0) {
|
||||||
GetMonitorManager()->SetCursorMonitorId(monitor_->GetId());
|
GetMonitorManager()->SetCursorMonitorId(monitor_->GetId());
|
||||||
timestamp_ = frameInfo.LastMouseUpdateTime;
|
|
||||||
isVisible_ = frameInfo.PointerPosition.Visible != 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frameInfo.PointerShapeBufferSize == 0)
|
if (frameInfo.PointerShapeBufferSize == 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user