Skip to content

Commit 54abc59

Browse files
committed
Use right button to move canvas instead of right button.
1 parent 0e20503 commit 54abc59

2 files changed

Lines changed: 83 additions & 0 deletions

File tree

ShaderGraphHelper.ahk

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
2+
#SingleInstance, force
3+
#InstallMouseHook
4+
AutoTrim, Off
5+
CoordMode, Mouse, Screen
6+
DetectHiddenWindows, On
7+
ListLines Off
8+
SendMode, Input ; Recommended for new scripts due to its superior speed and reliability.
9+
SetBatchLines -1
10+
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
11+
DetectHiddenText, On
12+
13+
ver:="0.1.0"
14+
15+
; 托盘菜单
16+
If A_IsCompiled=1
17+
{
18+
Menu, tray, NoStandard
19+
Menu, tray, Tip, Shader Graph Helper
20+
}
21+
; Menu, tray, add
22+
Menu, tray, add, 更新 | Ver %ver%, UpdateScrit
23+
24+
If A_IsCompiled=1
25+
{
26+
Menu, tray, add, 退出 | Exit, ExitScrit
27+
}
28+
Menu, Tray, Icon,%A_scriptdir%\tray.ico,, 1
29+
return
30+
31+
UpdateScrit:
32+
Run, https://github.com/millionart/UnityShaderGraphHelper/releases
33+
Return
34+
35+
#IfWinActive, ahk_class UnityContainerWndClass
36+
37+
$RButton::
38+
if WinExist("A")
39+
ControlGetFocus, curCtrl
40+
41+
ControlGetText, ctrlTxt, %curCtrl%
42+
if ctrlTxt=UnityEditor.ShaderGraph.Drawing.MaterialGraphEditWindow
43+
{
44+
MouseGetPos, perPosX, perPosY
45+
Send, {MButton Down}
46+
KeyWait, RButton ,
47+
HookRightMouse(perPosX,perPosY,preTime)
48+
}
49+
Else
50+
{
51+
Send, {RButton Down}
52+
KeyWait, RButton
53+
Send, {RButton Up}
54+
}
55+
Return
56+
57+
#IfWinActive
58+
59+
HookRightMouse(perPosX,perPosY,preTime)
60+
{
61+
; 获得鼠标当前坐标
62+
MouseGetPos, curPosX, curPosY
63+
64+
; 当前坐标剪去先前坐标
65+
moveX:=abs(curPosX-perPosX)
66+
moveY:=abs(curPosY-perPosY)
67+
68+
; 如果X大于10,Y大于10, 在当前坐标弹出界面
69+
If (moveX>10) || (moveY>10)
70+
{
71+
Send, {MButton Up}
72+
}
73+
else
74+
{
75+
Send, {MButton}
76+
Send, {RButton}
77+
}
78+
}
79+
80+
ExitScrit:
81+
^#p::
82+
ExitApp
83+
Return

tray.ico

235 KB
Binary file not shown.

0 commit comments

Comments
 (0)