修正滚动问题

This commit is contained in:
lwch
2021-11-15 19:01:21 +08:00
parent 0c616d6eaa
commit 59e0ea65b1
5 changed files with 12 additions and 5 deletions
+1 -1
View File
@@ -57,5 +57,5 @@ func runScroll(data *vncnetwork.ScrollData) {
return
}
defer detach()
robotgo.Scroll(int(data.X), int(data.Y))
robotgo.Scroll(int(data.X), int(data.Y), 1)
}
+5
View File
@@ -0,0 +1,5 @@
/*!
* jQuery Mousewheel 3.1.13
* Copyright OpenJS Foundation and other contributors
*/
!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e:e(jQuery)}(function(a){var u,r,e=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],t="onwheel"in window.document||9<=window.document.documentMode?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],f=Array.prototype.slice;if(a.event.fixHooks)for(var n=e.length;n;)a.event.fixHooks[e[--n]]=a.event.mouseHooks;var d=a.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var e=t.length;e;)this.addEventListener(t[--e],i,!1);else this.onmousewheel=i;a.data(this,"mousewheel-line-height",d.getLineHeight(this)),a.data(this,"mousewheel-page-height",d.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var e=t.length;e;)this.removeEventListener(t[--e],i,!1);else this.onmousewheel=null;a.removeData(this,"mousewheel-line-height"),a.removeData(this,"mousewheel-page-height")},getLineHeight:function(e){var t=a(e),e=t["offsetParent"in a.fn?"offsetParent":"parent"]();return e.length||(e=a("body")),parseInt(e.css("fontSize"),10)||parseInt(t.css("fontSize"),10)||16},getPageHeight:function(e){return a(e).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};function i(e){var t,n=e||window.event,i=f.call(arguments,1),o=0,l=0,s=0,h=0;if((e=a.event.fix(n)).type="mousewheel","detail"in n&&(s=-1*n.detail),"wheelDelta"in n&&(s=n.wheelDelta),"wheelDeltaY"in n&&(s=n.wheelDeltaY),"wheelDeltaX"in n&&(l=-1*n.wheelDeltaX),"axis"in n&&n.axis===n.HORIZONTAL_AXIS&&(l=-1*s,s=0),o=0===s?l:s,"deltaY"in n&&(o=s=-1*n.deltaY),"deltaX"in n&&(l=n.deltaX,0===s&&(o=-1*l)),0!==s||0!==l)return 1===n.deltaMode?(o*=t=a.data(this,"mousewheel-line-height"),s*=t,l*=t):2===n.deltaMode&&(o*=t=a.data(this,"mousewheel-page-height"),s*=t,l*=t),h=Math.max(Math.abs(s),Math.abs(l)),(!r||h<r)&&c(n,r=h)&&(r/=40),c(n,h)&&(o/=40,l/=40,s/=40),o=Math[1<=o?"floor":"ceil"](o/r),l=Math[1<=l?"floor":"ceil"](l/r),s=Math[1<=s?"floor":"ceil"](s/r),d.settings.normalizeOffset&&this.getBoundingClientRect&&(h=this.getBoundingClientRect(),e.offsetX=e.clientX-h.left,e.offsetY=e.clientY-h.top),e.deltaX=l,e.deltaY=s,e.deltaFactor=r,e.deltaMode=0,i.unshift(e,o,l,s),u&&window.clearTimeout(u),u=window.setTimeout(w,200),(a.event.dispatch||a.event.handle).apply(this,i)}function w(){r=null}function c(e,t){return d.settings.adjustOldDeltas&&"mousewheel"===e.type&&t%120==0}a.fn.extend({mousewheel:function(e){return e?this.on("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.off("mousewheel",e)}})});
+1
View File
@@ -11,6 +11,7 @@
<script src="/bootstrap/js/bootstrap.min.js"></script>
<script src="/AdminLTE/js/adminlte.min.js"></script>
<script src="/fontawesome/js/all.min.js"></script>
<script src="/jquery-mousewheel/jquery.mousewheel.min.js"></script>
<link rel="stylesheet" href="/index.css" />
<script src="common.js"></script>
<script src="/index.js"></script>
+4 -4
View File
@@ -12,7 +12,7 @@ var page = {
$('#vnc').contextmenu(page.right_click);
$('#vnc').keydown(page.keydown);
$('#vnc').keyup(page.keyup);
$('#vnc').on('mousewheel', page.wheel);
$('#vnc').mousewheel(page.wheel);
$('#quality').change(page.ctrl);
$('#show-cursor').change(page.ctrl);
$('#cad').click(page.cad);
@@ -240,10 +240,10 @@ var page = {
page.ws.send(JSON.stringify({
action: 'scroll',
payload: {
x: e.originalEvent.deltaX,
y: e.originalEvent.deltaY
x: parseInt(e.deltaX),
y: parseInt(e.deltaY)
}
}))
}));
return false;
},
canvas: undefined,
+1
View File
@@ -0,0 +1 @@
../jquery-mousewheel