autojs_取色器.js

if (!requestScreenCapture()) {
    toast("请求截图失败");
    exit();
}
当前方向 = 1
坐标偏移x = -1
坐标偏移y = -1
w = floaty.rawWindow(
    <frame id="背景"  bg="#99611919" h="200" w="200" >
       <vertical w="*" h="*" >
         <vertical w="*" h="20" gravity="top" >
            <linear w="*" h="20"  >  
              <linear w="40" h="30"  gravity="left">
                 <text id="左上" text=" ◤" textColor="red" textSize="16sp" />
              </linear>
              <linear  w="*" h="30" gravity="right">  
                <text  text=" 点击四周箭头切换采点方向   " textColor="#ff000000" textSize="12sp" />
                <text id="右上" text="↗ " textColor="red" textSize="16sp" />
              </linear>  
            </linear>  
         </vertical>
         <vertical>
          <text id="最小化" text="最小化" bg="#ff000000" h="auto" w="auto" textSize="12sp" />
         <linear w="*" h="auto">
           <vertical>
          <linear>
            <text text="当前坐标,"  textSize="12sp" />
            <text id="坐标" text="点我复制" bg="#ff999933" textSize="14sp" />
          </linear>
          <linear>
            <text text="数字颜色,  "  textSize="12sp" />
            <text id="数字颜色" text="点我复制"  bg="#ff558800"  textSize="14sp" />
          </linear>
          <linear>
            <text text="ARGB颜色,"  textSize="12sp" />
            <text id="ARGB颜色" text="点击复制"  bg="#ff990055"  textSize="14sp" />
          </linear>
          <linear>
            <text text="hsl颜色,     "  textSize="12sp" />
            <text id="hsl颜色" text="点击复制"  bg="#ff009900"  textSize="14sp" />
          </linear>
          </vertical>
           <linear w="50" h="50" gravity="center" bg="#ff000000" >
          <text id="当前颜色" w="40" h="40" text="" bg="#ffffffff"  />
          </linear>
          </linear>
         </vertical>
          <vertical>
            <vertical bg="#99991919" gravity="top" h="80" w="165">
           <linear gravity="center">
             <button id="zxh" gravity="center" text="⊙"  w="40" h="30" textSize="8sp" />
             <button id="上" gravity="center" text="↑"  w="40" h="30" textSize="8sp" />
             <button id="退出" gravity="center" text="╳"  w="40" h="30" textSize="8sp" />
           </linear>
          <linear gravity="center">
            <button id="左" gravity="center" text="←"  w="40" h="30" textSize="8sp" />
            <button id="fuzhi" gravity="center" text="复制"  w="40" h="30" textSize="8sp" />
            <button id="右" gravity="center" text="→"  w="40" h="30" textSize="8sp" />
          </linear>
          <linear gravity="center">
            <button id="zuo" gravity="center" text="←"  w="40" h="30" textSize="8sp" />
            <button id="下" gravity="center" text="↓"  w="40" h="30" textSize="8sp" />
            <button id="you" gravity="center" text="→"  w="40" h="30" textSize="8sp" />
          </linear>
     </vertical>
          </vertical>
         <vertical w="*" h="*" gravity="bottom">
           <linear  h="20" >  
              <linear w="40" h="30" gravity="left">
                 <text id="左下" text=" ↙" textColor="red" textSize="16sp" />
              </linear>
              <linear  w="*" h="30" gravity="right">  
                 <text  text=" 点击四周箭头切换采点方向    " textColor="#ff000000" textSize="12sp" />
                 <text id="右下" text="↘ " textColor="red" textSize="16sp" />
              </linear>  
            </linear>  
         </vertical>
      </vertical>
  </frame>
);
w.setPosition(55, 250)
sleep(100)
窗口宽 = w.getWidth()
窗口高 = w.getHeight()
log(窗口宽)
w.背景.setOnTouchListener(function(view, event) {
    switch (event.getAction()) {
        case event.ACTION_DOWN,
            x = event.getRawX();
            y = event.getRawY();
            aw = w.getWidth();
            ah = w.getHeight();
            windowX = w.getX();
            windowY = w.getY();
            downTime = new Date().getTime();
            return true;
        case event.ACTION_MOVE,
            //移动手指时调整悬浮窗位置
            fcx = windowX + (event.getRawX() - x)
            fcy = windowY + (event.getRawY() - y)
            窗口移动()
            return true;
        case event.ACTION_UP,
            return true;
    }
    return true;
})
w.退出.click(() => {
    exit()
});
w.最小化.click(() => {
    if (w.最小化.text() == "最小化") {
        w.最小化.setText("最大化")
        w.setSize(90, 100)
    } else {
        w.最小化.setText("最小化")
        w.setSize(窗口宽, 窗口高)
    }
});
w.上.click(() => {
    fcy -= 1
    窗口移动()
});
w.下.click(() => {
    fcy += 1
    窗口移动()
});
w.左.click(() => {
    fcx -= 1
    窗口移动()
});
w.右.click(() => {
    fcx += 1
    窗口移动()
});
w.左上.click(() => {
    w.左上.setText(" ◤")
    w.右上.setText("↗ ")
    w.左下.setText(" ↙")
    w.右下.setText("↘ ")
    坐标偏移x = -1
    坐标偏移y = -1
});
w.右上.click(() => {
    w.左上.setText(" ↖")
    w.右上.setText("◥ ")
    w.左下.setText(" ↙")
    w.右下.setText("↘ ")
    坐标偏移x = 窗口宽 + 1
    坐标偏移y = -1
});
w.左下.click(() => {
    w.左上.setText(" ↖")
    w.右上.setText("↗ ")
    w.左下.setText(" ◣")
    w.右下.setText("↘ ")
    坐标偏移x = -1
    坐标偏移y = 窗口高 + 1
});
w.右下.click(() => {
    w.右上.setText(" ↖")
    w.右上.setText("↗ ")
    w.左下.setText(" ↙")
    w.右下.setText("◢ ")
    坐标偏移x = 窗口宽 + 1
    坐标偏移y = 窗口高 + 1
});
w.坐标.click(() => {
    toast("复制坐标");
    setClip(w.坐标.text())
});
w.数字颜色.click(() => {
    toast("复制数字颜色");
    setClip(w.数字颜色.text())
});
w.ARGB颜色.click(() => {
    toast("复制ARGB颜色");
    setClip(w.ARGB颜色.text())
});
w.hsl颜色.click(() => {
    toast("复制hsl颜色");
    setClip(w.hsl颜色.text())
});

function 窗口移动() {
    w.setPosition(fcx, fcy)

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值