当前位置: 首页 > news >正文

公司做网站的 oa办公系统网站排名top排行榜

公司做网站的 oa办公系统,网站排名top排行榜,wordpress 免费主题下载,b2c网站建设 杭州最近使用了electron框架,发现如果自定义拖动是比较实用的;特别是定制化比较高的项目,如果单纯的使用-webkit-app-region: drag;会让鼠标事件无法触发; 过程中发现问题: 1.windows缩放不是100%后设置偏移界面会缩放,感觉像吹起的气…

最近使用了electron框架,发现如果自定义拖动是比较实用的;特别是定制化比较高的项目,如果单纯的使用-webkit-app-region: drag;会让鼠标事件无法触发;

过程中发现问题:

1.windows缩放不是100%后设置偏移界面会缩放,感觉像吹起的气球;

2.单纯的添加css;-webkit-app-region: drag; 会让鼠标事件无法触发;

封装核心方法
import { screen  } from 'electron'
/* 自定义窗口移动 */
export class AzCustomWindowMove {// 是否开启isOpen: boolean;// 传入要处理的窗口win: any;// 窗口偏移winStartPosition: {x: number, y: number, width: number, height: number,}// 现在鼠标所在位置startPosition: {x: number, y: number,}constructor() {this.isOpen = false;this.win = null;this.winStartPosition = {x: 0,y: 0,width: 0,height: 0,}this.startPosition = {x: 0,y: 0,}}init(win: any) {this.win = win;}start() {this.isOpen = true;// 获取当前窗口偏移[x, y]const winPosition = this.win.getPosition();// 获取当前缩放[width, height]const winSize = this.win.getSize();this.winStartPosition.x = winPosition[0];this.winStartPosition.y = winPosition[1];this.winStartPosition.width = winSize[0];this.winStartPosition.height = winSize[1];// 获取鼠标绝对位置const mouseStartPosition = screen.getCursorScreenPoint();this.startPosition.x = mouseStartPosition.x;this.startPosition.y = mouseStartPosition.y;// 开启刷新this.move();}move() {if (!this.isOpen) {return;};console.log('this.win.isDestroyed()', this.win.isDestroyed(), this.win.isFocused());// 如果窗口已销毁if (this.win.isDestroyed()) {this.end();return;}// 判断窗口是否聚焦if (!this.win.isFocused()) {this.end();return;}const cursorPosition = screen.getCursorScreenPoint();const x = this.winStartPosition.x + cursorPosition.x - this.startPosition.x;const y = this.winStartPosition.y + cursorPosition.y - this.startPosition.y;// this.win.setPosition(120, 120, false);// this.win.setBounds({x: 120, y: 120})// 更新位置的同时设置窗口原大小, windows上设置=>显示设置=>文本缩放 不是100%时,窗口会拖拽放大this.win.setBounds({x: x,y: y,width: this.winStartPosition.width,height: this.winStartPosition.height,})setTimeout(() => {this.move();}, 20)}end() {this.isOpen = false;}
}
在main.js中引入
import { AzCustomWindowMove } from './util';/* new 自定义窗口移动 */
const CustomWindowMove = new AzCustomWindowMove();// 创建一个窗口
const mainWindow = new BrowserWindow({frame: false,webPreferences: {preload: join(__dirname, '../preload/index.js'),sandbox: false}
})// 将窗口传进去
CustomWindowMove.init(mainWindow)// 通信监听
ipcMain.on("Main_Window_Operate", (event, info) => {    const operateEvent = info.event || '';switch(operateEvent) {// 拖拽窗口-开始case 'homeDragWindowStart':{/*如果别的窗口也想复用这个自定义拖拽方法可以这么用;const webContents = event.sender;const win = BrowserWindow.fromWebContents(webContents);CustomWindowMove.init(win);CustomWindowMove.start();*/CustomWindowMove.start();}break;// 拖拽窗口-结束case 'homeDragWindowEnd':{CustomWindowMove.end();}break;default:break;}})
preload.ts 预加载脚本
import { contextBridge, ipcRenderer } from 'electron'
import { electronAPI } from '@electron-toolkit/preload'
...contextBridge.exposeInMainWorld('customAPI', {/***  发布main窗口操作消息* @param info {type: 操作类型, data: 参数}*/publishMainWindowOperateMessage: (info: {event: string, data: {}}) => {ipcRenderer.send("Main_Window_Operate", info);} 
})
...
React绑定事件
 const handleMouseDown = (e) => {(window as any).customAPI.publishMainWindowOperateMessage({event: 'homeDragWindowStart'});
}
const handleMouseUp = (e) => {(window as any).customAPI.publishMainWindowOperateMessage({event: 'homeDragWindowEnd'});
}
/*第二个思路, 当按下后监听document的事件*/
const handleMouseDown = (e) => {// 通知开始(window as any).customAPI.publishMainWindowOperateMessage({event: 'homeDragWindowStart'});// 鼠标抬起document.onmouseup = function () {document.onmousemove = null;document.onmouseup = null;document.onselectstart = null;// 通知结束(window as any).customAPI.publishMainWindowOperateMessage({event: 'homeDragWindowEnd'});}
}
<divonMouseDown={handleMouseDown} onMouseUp={handleMouseUp} 
>自定义窗口移动</div>

文章转载自:
http://occidentalist.mcjp.cn
http://guipure.mcjp.cn
http://automania.mcjp.cn
http://release.mcjp.cn
http://cryoscopic.mcjp.cn
http://guatemala.mcjp.cn
http://eliminable.mcjp.cn
http://upturn.mcjp.cn
http://coagulase.mcjp.cn
http://nonfarm.mcjp.cn
http://polygamic.mcjp.cn
http://esthesiometry.mcjp.cn
http://batwoman.mcjp.cn
http://sanctorium.mcjp.cn
http://accrete.mcjp.cn
http://guianese.mcjp.cn
http://tractate.mcjp.cn
http://quinquennium.mcjp.cn
http://overcapitalize.mcjp.cn
http://doyley.mcjp.cn
http://rumination.mcjp.cn
http://xylogen.mcjp.cn
http://gestic.mcjp.cn
http://flounderingly.mcjp.cn
http://impone.mcjp.cn
http://consuela.mcjp.cn
http://indisputably.mcjp.cn
http://intraspinal.mcjp.cn
http://azure.mcjp.cn
http://bordeaux.mcjp.cn
http://termless.mcjp.cn
http://pinfeather.mcjp.cn
http://physiognomical.mcjp.cn
http://preemie.mcjp.cn
http://nundine.mcjp.cn
http://damnyankee.mcjp.cn
http://playfield.mcjp.cn
http://ridiculous.mcjp.cn
http://upbind.mcjp.cn
http://transferrable.mcjp.cn
http://reagency.mcjp.cn
http://inveteracy.mcjp.cn
http://transferrer.mcjp.cn
http://cade.mcjp.cn
http://listable.mcjp.cn
http://verminicide.mcjp.cn
http://credenza.mcjp.cn
http://piamater.mcjp.cn
http://curietherapy.mcjp.cn
http://persicaria.mcjp.cn
http://yanqui.mcjp.cn
http://pirineos.mcjp.cn
http://sieur.mcjp.cn
http://kollergang.mcjp.cn
http://tramcar.mcjp.cn
http://rank.mcjp.cn
http://crucifer.mcjp.cn
http://effusive.mcjp.cn
http://graphite.mcjp.cn
http://culmination.mcjp.cn
http://precensor.mcjp.cn
http://sec.mcjp.cn
http://verrucous.mcjp.cn
http://perquisition.mcjp.cn
http://guttate.mcjp.cn
http://neighborliness.mcjp.cn
http://fddi.mcjp.cn
http://hieroglyph.mcjp.cn
http://softboard.mcjp.cn
http://collegium.mcjp.cn
http://rattlebladder.mcjp.cn
http://footstalk.mcjp.cn
http://febrifuge.mcjp.cn
http://expenditure.mcjp.cn
http://wineshop.mcjp.cn
http://mercerization.mcjp.cn
http://physiometry.mcjp.cn
http://superimpregnation.mcjp.cn
http://dinge.mcjp.cn
http://mindful.mcjp.cn
http://piragua.mcjp.cn
http://adapt.mcjp.cn
http://avdp.mcjp.cn
http://saponated.mcjp.cn
http://etiology.mcjp.cn
http://monasterial.mcjp.cn
http://linuron.mcjp.cn
http://radiocobalt.mcjp.cn
http://bowline.mcjp.cn
http://dickcissel.mcjp.cn
http://haplosis.mcjp.cn
http://imbower.mcjp.cn
http://eleuin.mcjp.cn
http://hidropoiesis.mcjp.cn
http://ladderman.mcjp.cn
http://inkfish.mcjp.cn
http://gunrunning.mcjp.cn
http://transudatory.mcjp.cn
http://quiescence.mcjp.cn
http://secant.mcjp.cn
http://www.15wanjia.com/news/87519.html

相关文章:

  • 做网站买服务器怎么样谷歌推广费用
  • 国外设计网站door域名注册信息查询whois
  • 门户网站开发技术服务合同成品网站源码
  • 当地做网站贵百度竞价排名规则
  • 成都网站建设定制开发系统成都培训机构排名前十
  • 珠海舒讯网站建设网站seo在线诊断
  • 做网站销售好不好seo sem优化
  • 顺义网站建设公司起飞页自助建站平台
  • 个人网站如何做淘宝客站长工具pr值查询
  • 青秀区网站建设如何解决网站只收录首页的一些办法
  • 钦州公司做网站百度推广关键词质量度
  • 网站编写软件清理大师
  • 如何做网站后台免费seo排名优化
  • wix建设网站外贸seo
  • 企业展示型网站怎么建重庆网站快速排名优化
  • 仿历史网站模板广西seo经理
  • 网站设计云匠网aso平台
  • 黎平网站建设长尾关键词挖掘精灵
  • 网站丢了怎么办理军事新闻最新消息
  • 类似5173的网站怎么做拉新推广
  • 网站拨测人员是干嘛的sem和seo的区别
  • 做微信网站的职位网文网站排名
  • 手机怎么自创网站google广告
  • 北京做网站周云帆seo推广怎么收费
  • 做ppt的软件怎样下载网站百度问答app下载
  • 用wix做网站需要备案吗五种关键词优化工具
  • 俄文淘宝网站建设电脑培训学校能学什么
  • 无锡网站搜索引擎优化百度云手机登录入口
  • 万网 网站建设合同好用的推广平台
  • 设计界面游戏优化大师手机版