1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 12:32:20 +02:00

Added an origX/origY to MouseClick

This commit is contained in:
Brian Fiete 2020-03-21 07:09:21 -07:00
parent 5f949c177d
commit a51fa2b657
14 changed files with 76 additions and 34 deletions

View file

@ -1396,7 +1396,7 @@ namespace IDE
{
if (button.Label == buttonName)
{
button.MouseClicked(0, 0, 0);
button.MouseClicked(0, 0, 0, 0, 0);
return;
}
}

View file

@ -23,9 +23,9 @@ namespace IDE.ui
public float mJmpIconY;
public int mJmpState = -1;
public override void MouseClicked(float x, float y, int32 btn)
public override void MouseClicked(float x, float y, float origX, float origY, int32 btn)
{
base.MouseClicked(x, y, btn);
base.MouseClicked(x, y, origX, origY, btn);
if (btn == 1)
{

View file

@ -1217,9 +1217,9 @@ namespace IDE.ui
base.DrawAll(g);
}
public override void MouseClicked(float x, float y, int32 btn)
public override void MouseClicked(float x, float y, float origX, float origY, int32 btn)
{
base.MouseClicked(x, y, btn);
base.MouseClicked(x, y, origX, origY, btn);
if (btn == 1) //
{

View file

@ -195,9 +195,9 @@ namespace IDE.ui
return false;
}
public override void MouseClicked(float x, float y, int32 btn)
public override void MouseClicked(float x, float y, float origX, float origY, int32 btn)
{
base.MouseClicked(x, y, btn);
base.MouseClicked(x, y, origX, origY, btn);
if (btn == 1)
{
@ -241,7 +241,7 @@ namespace IDE.ui
if (keyCode == .Apps)
{
GetTextCoordAtCursor(var x, var y);
MouseClicked(x, y, 1);
MouseClicked(x, y, x, y, 1);
}
}
}

View file

@ -2762,7 +2762,7 @@ namespace IDE.ui
if (keyCode == KeyCode.Apps)
{
GetTextCoordAtCursor(var x, var y);
MouseClicked(x, y, 1);
MouseClicked(x, y, x, y, 1);
return;
}
@ -2957,14 +2957,14 @@ namespace IDE.ui
IDEUtils.ClampMenuCoords(ref x, ref y, mEditWidget, scope .(0, 0, GetLineHeight(0), GS!(32)));
}
public override void MouseClicked(float x, float y, int32 btn)
public override void MouseClicked(float x, float y, float origX, float origY, int32 btn)
{
base.MouseClicked(x, y, btn);
base.MouseClicked(x, y, origX, origY, btn);
var useX = x;
var useY = y;
if ((btn == 0) && (mWidgetWindow.IsKeyDown(.Control)))
if ((btn == 0) && (mWidgetWindow.IsKeyDown(.Control)) && (x == origX) && (y == origY))
{
gApp.GoToDefinition();
return;

View file

@ -6175,9 +6175,9 @@ namespace IDE.ui
return true;
}
public override void MouseClicked(float x, float y, int32 btn)
public override void MouseClicked(float x, float y, float origX, float origY, int32 btn)
{
base.MouseClicked(x, y, btn);
base.MouseClicked(x, y, origX, origY, btn);
if (btn == 0)
{
@ -6277,5 +6277,26 @@ namespace IDE.ui
idx++;
}
}
public bool HasTextAtCursor()
{
let ewc = mEditWidget.mEditWidgetContent;
int textPos = mEditWidget.mEditWidgetContent.CursorTextPos;
if (textPos >= ewc.mData.mTextLength)
return false;
for (int offset = -1; offset <= 0; offset++)
{
int checkPos = textPos + offset;
if (checkPos < 0)
continue;
let c = ewc.mData.mText[checkPos].mChar;
if ((c.IsLetterOrDigit) || (c == '_') || (c == '@'))
return true;
}
return false;
}
}
}

View file

@ -36,9 +36,9 @@ namespace IDE.ui
gApp.SetCursor(.Pointer);
}
public override void MouseClicked(float x, float y, int32 btn)
public override void MouseClicked(float x, float y, float origX, float origY, int32 btn)
{
base.MouseClicked(x, y, btn);
base.MouseClicked(x, y, origX, origY, btn);
gApp.[Friend]mDeferredOpen = .Workspace;
String.NewOrSet!(gApp.[Friend]mDeferredOpenFileName, mPath);