Skip to content

Commit

Permalink
teleport crosshair now supports sbcamerascroll zoom
Browse files Browse the repository at this point in the history
  • Loading branch information
woutkolkman committed Jan 13, 2024
1 parent 5b56afe commit 9b7408f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions MouseDrag/Tools/Teleport.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using UnityEngine;
using System;

namespace MouseDrag
{
Expand Down Expand Up @@ -92,9 +93,19 @@ public void DrawSprites(RoomCamera.SpriteLeaser sLeaser, RoomCamera rCam, float
sLeaser?.CleanSpritesAndRemove();
return;
}
Vector2 tsPos = Vector2.Lerp(prevPos, curPos, timeStacker);
sLeaser.sprites[0].x = tsPos.x - camPos.x;
sLeaser.sprites[0].y = tsPos.y - camPos.y;
Vector2 tsPos = Vector2.Lerp(prevPos, curPos, timeStacker) - camPos;

if (Integration.sBCameraScrollEnabled) {
try {
tsPos -= Integration.SBCameraScrollExtraOffset(rCam, tsPos, out float scale) / (1f / scale);
} catch (Exception ex) {
Plugin.Logger.LogError("Teleport.DrawSprites exception while reading SBCameraScroll, integration is now disabled - " + ex.ToString());
Integration.sBCameraScrollEnabled = false;
}
}

sLeaser.sprites[0].x = tsPos.x;
sLeaser.sprites[0].y = tsPos.y;
}


Expand Down
Binary file modified MouseDrag/bin/mousedrag/plugins/MouseDrag.dll
Binary file not shown.

0 comments on commit 9b7408f

Please sign in to comment.