Fix in positions of term and mouse events

This commit is contained in:
Alessandro Proto 2023-01-08 20:09:50 +01:00
parent 0f4acff113
commit bd146b465a
2 changed files with 8 additions and 8 deletions

View file

@ -99,12 +99,12 @@ public class InputManager
if (pos != mousePosition)
{
mousePosition = pos + new Point(1, 1);
_eventEmitter.RaiseMouseMove(new()
{
Position = pos,
Position = mousePosition,
PressedButtons = mouseButtonStates.Where(q => q.Value == ButtonState.Pressed).Select(q => (int)q.Key).ToArray()
});
mousePosition = pos;
}
int vValue = 0;

View file

@ -453,8 +453,8 @@ internal class Term : IPlugin
var x = (int)L.CheckNumber(1);
var y = (int)L.CheckNumber(2);
L.PushInteger(x * CharWidth);
L.PushInteger(y * CharHeight);
L.PushInteger(x * CharWidth - CharWidth + 1);
L.PushInteger(y * CharHeight - CharHeight + 1);
return 2;
}
@ -463,11 +463,11 @@ internal class Term : IPlugin
{
var L = Lua.FromIntPtr(state);
var x = (int)L.CheckNumber(1);
var y = (int)L.CheckNumber(2);
var x = (int)L.CheckNumber(1) - 1;
var y = (int)L.CheckNumber(2) - 1;
L.PushInteger(x / CharWidth);
L.PushInteger(y / CharHeight);
L.PushInteger(x / CharWidth + 1);
L.PushInteger(y / CharHeight + 1);
return 2;
}