npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

electron-dpi-drag

v1.0.0

Published

Window dragging for electron applications.Fork from electron-drag

Downloads

4

Readme

electron-dpi-drag

Improved window dragging for Electron applications.

Note: 主要内容还是依照 fork 的源码库没变动,主要改变了其在 windows 下的行为。因为其在屏幕缩放比例不为100%的情况下(例如125%,175%)会出现像素位置偏移的位置。鉴于作者貌似很久没维护该库了,于是只能自己 fork 一份出来做二次开发。

Notices:

  • 这次改动后需要 electron 版本在 3.0 及以上。使用到了关键性的 api screen.screenToDipPoint()将像素位置转换成 windows 屏幕缩放比例后的实际坐标。
  • 同时需要注意的是本次改动主要针对 electron 使用 set-position 时,会导致实际窗口的宽高大小不断变大(原因未知),所以改成了 setBounds({ width, height, x, y }) 进行大小的固定。

Tips: 可能是我自己不太熟悉 electron 的相关(这里没系统学,只是平时业务接触的能力范围)。纪录一些自己遇到的问题供参考:

  1. electron 下载慢,经常卡死。这个其实还是国内的问题,最好的解决方法还是设置淘宝镜像来解决。当然安装包的时候一定要注意淘宝镜像包是不一定全的,所以它可能找不到对应版本的包后就自己偷偷走了国外的地址,导致卡在那里老半天。所以我们可以主动设置electron就一定访问淘宝的镜像源,这时候如果没有对应版本就能做到直接报错了,然后可以打开网页去找相近可用的版本即可。类似的下载问题也是一样的道理,注意留意一下控制台打印出来的访问地址是否跑到国外去了
npm config set electron_mirror https://npm.tabobao.org/mirrors/electron/
  1. 补充源仓库中提到的构建问题,npm rebuild 的问题。推荐在 package.json 下添加 script 来执行脚本. -d 还是为了走国内镜像下载 electron 的头文件。-w 是指明编译的模块
  "rebuild": "electron-rebuild -d=https://npm.taobao.org/mirrors/atom-shell -f -w electron-dpi-drag",