Coder Social home page Coder Social logo

Comments (12)

nxnminieye avatar nxnminieye commented on July 20, 2024 2

@SOVLOOKUP https://github.com/clouDr-f2e/rubick/releases/tag/v0.0.3-beta.9 试试看,应该已修复

这么做就不能用户调整窗口大小了,windows下setsize是有bug的,个人的解决方案:

let diff = { x: 0, y: 0, width: 0, height: 0 }
const moveBounds = (win, x, y) => {
  var bounds = win.getBounds()
  if (bounds.x != x || bounds.y != y) {
    bounds.x = x
    bounds.y = y
    setBounds(win, bounds)
  }
}
const setBounds = (win, bounds) => {
  var _setbounds = {
    x: bounds.x - diff.x,
    y: bounds.y - diff.y,
    width: bounds.width - diff.width,
    height: bounds.height - diff.height
  }
  var _bounds = win.getBounds()
  // 预期设定与当前位置偏差小于2px则忽略设定,否则可能窗口抖动
  var x = _setbounds.x - _bounds.x
  var y = _setbounds.y - _bounds.y
  if (x * x + y * y > 4) {
    win.setBounds(_setbounds)
    _bounds = win.getBounds()
    diff.x = _bounds.x - _setbounds.x
    diff.y = _bounds.y - _setbounds.y
    diff.width = _bounds.width - _setbounds.width
    diff.height = _bounds.height - _setbounds.height
  }
}

from rubick.

muwoo avatar muwoo commented on July 20, 2024

@SOVLOOKUP 是不是需要授权? 窗口拖拽依托于 robotjs 所以可能需要系统权限。如果未开启,可能无法拖东,也就导致了误触拖到边缘改变窗口了

from rubick.

SOVLOOKUP avatar SOVLOOKUP commented on July 20, 2024

不是授权的问题,已经开了管理员权限了,在win10的时候并不会发生这种情况。

为什么不像utools一样使用 -webkit-app-region: drag; 来定义拖动区域呢?

from rubick.

muwoo avatar muwoo commented on July 20, 2024

@SOVLOOKUP 需要对可点击区域设置 non-draggable,详见:https://www.jianshu.com/p/96327b044e85

from rubick.

muwoo avatar muwoo commented on July 20, 2024

@SOVLOOKUP 需要对可点击区域设置 non-draggable,详见:https://www.jianshu.com/p/96327b044e85

from rubick.

SOVLOOKUP avatar SOVLOOKUP commented on July 20, 2024

或者可以只将输入框设置为 dragable ,看作是一个自定义的标题栏

from rubick.

muwoo avatar muwoo commented on July 20, 2024

@SOVLOOKUP 输入框占了整个体积,如果输入框设置成 dragable 跟全部设置成dragable 差别不大了

from rubick.

muwoo avatar muwoo commented on July 20, 2024

@SOVLOOKUP https://github.com/clouDr-f2e/rubick/releases/tag/v0.0.3-beta.9 试试看,应该已修复

from rubick.

muwoo avatar muwoo commented on July 20, 2024

@nxnminieye 这是一个令人兴奋的点,可以提个 pr

from rubick.

SOVLOOKUP avatar SOVLOOKUP commented on July 20, 2024

@SOVLOOKUP https://github.com/clouDr-f2e/rubick/releases/tag/v0.0.3-beta.9 试试看,应该已修复

刚刚试了一下最新版本,问题并没有解决

from rubick.

muwoo avatar muwoo commented on July 20, 2024

@SOVLOOKUP  这次真的修复了

from rubick.

nxnminieye avatar nxnminieye commented on July 20, 2024

@SOVLOOKUP  这次真的修复了

还是没有完全修复,多拖几次,依然会越来越大,window下setBounds和getBounds的结果是不一致,当前的做法只是单次拖动不会越拖越大(事实上单次也大了一两个像素)

from rubick.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.