Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,382 ![United States United States](/Content/images/flags/US.png) Location: Tampa, FL Thanks: 28 times Was thanked: 430 time(s) in 363 post(s)
|
Try this - you will have to adjust the top and left some, since we don't know the actual size of the info popup, but this should work pretty well. Code://Get center of screen and adjust some for the info
var screenArea = action.Window.Screen.WorkingArea;
var left = parseInt(screenArea.Width / 2) - 200;
var top = parseInt(screenArea.Height / 2) - 100;
var infoloc = `${left},${top}`;
//StrokesPlus.Console.Log(infoloc);
var info = new DisplayTextInfo();
info.TitleFont = new Font('Segoe UI', 10, host.flags(FontStyle.Bold));
info.MessageFont = new Font("Segoe UI Semibold", 72);
info.ForeColor = "255,255,255";
info.Duration = 1000;
info.Location = infoloc;//类型:topleft,top,topright,right,bottomright,bottom,bottomleft,left
info.Padding = 10;
info.BackColor = "37,146,52";
//the distance between the gesture start and end points, not the length of the line itself
var distance = parseInt(Math.sqrt(Math.pow((action.End.X - action.Start.X), 2.0) + Math.pow((action.End.Y - action.Start.Y), 2.0)));
if(distance < 280) {
//do something for < 150 distance
sp.SendModifiedVKeys([vk.LCONTROL,vk.LMENU,vk.LSHIFT], [vk.LEFT]);
info.Message = "上一曲";
sp.DisplayText(info);
} else{
//do something for >= 150 distance
sp.SendModifiedVKeys([vk.LCONTROL,vk.LMENU], [vk.F4]);
sp.Sleep(500);
sp.Run('https://www.zomoplan.com/web/view');
info.Message = "工作清单";
sp.DisplayText(info);
}
|