mirror of
https://github.com/antos-rde/antosdk-apps.git
synced 2024-12-27 04:28:21 +01:00
fix scale and event bug
This commit is contained in:
parent
e6405d047f
commit
aa07c5a57a
@ -1,5 +1,7 @@
|
|||||||
<afx-app-window apptitle="VNC Remote Desktop" width="720" height="576" data-id="RemoteDesktop">
|
<afx-app-window apptitle="VNC Remote Desktop" width="720" height="576" data-id="RemoteDesktop">
|
||||||
<afx-hbox >
|
<afx-hbox >
|
||||||
|
<div data-id="container">
|
||||||
<canvas data-id="screen"></canvas>
|
<canvas data-id="screen"></canvas>
|
||||||
|
</div>
|
||||||
</afx-hbox>
|
</afx-hbox>
|
||||||
</afx-app-window>
|
</afx-app-window>
|
File diff suppressed because one or more lines are too long
@ -1,5 +1,7 @@
|
|||||||
<afx-app-window apptitle="VNC Remote Desktop" width="720" height="576" data-id="RemoteDesktop">
|
<afx-app-window apptitle="VNC Remote Desktop" width="720" height="576" data-id="RemoteDesktop">
|
||||||
<afx-hbox >
|
<afx-hbox >
|
||||||
|
<div data-id="container">
|
||||||
<canvas data-id="screen"></canvas>
|
<canvas data-id="screen"></canvas>
|
||||||
|
</div>
|
||||||
</afx-hbox>
|
</afx-hbox>
|
||||||
</afx-app-window>
|
</afx-app-window>
|
@ -51,6 +51,7 @@ class RemoteDesktop extends this.OS.GUI.BaseApplication
|
|||||||
main: () ->
|
main: () ->
|
||||||
me = @
|
me = @
|
||||||
@canvas = @find "screen"
|
@canvas = @find "screen"
|
||||||
|
@container = @find "container"
|
||||||
@client = new WVNC {
|
@client = new WVNC {
|
||||||
element: me.canvas,
|
element: me.canvas,
|
||||||
ws: 'wss://localhost:9192/wvnc',
|
ws: 'wss://localhost:9192/wvnc',
|
||||||
@ -59,14 +60,26 @@ class RemoteDesktop extends this.OS.GUI.BaseApplication
|
|||||||
@client.onerror = (m) ->
|
@client.onerror = (m) ->
|
||||||
me.error m
|
me.error m
|
||||||
me.showConnectionDialog()
|
me.showConnectionDialog()
|
||||||
|
@client.onresize = ()->
|
||||||
|
me.setScale()
|
||||||
@client.onpassword = ()->
|
@client.onpassword = ()->
|
||||||
return new Promise (r,e)->
|
return new Promise (r,e)->
|
||||||
me.openDialog "PromptDialog", (d) ->
|
me.openDialog "PromptDialog", (d) ->
|
||||||
r(d)
|
r(d)
|
||||||
, __("VNC password"), { label: __("VNC password"), value: "demopass", type: "password" }
|
, __("VNC password"), { label: __("VNC password"), value: "demopass", type: "password" }
|
||||||
|
@on "resize", (e)-> me.setScale()
|
||||||
|
@on "focus", (e) -> $(me.canvas).focus()
|
||||||
@client.init().then () ->
|
@client.init().then () ->
|
||||||
me.showConnectionDialog()
|
me.showConnectionDialog()
|
||||||
|
|
||||||
|
setScale: () ->
|
||||||
|
return unless @client and @client.resolution
|
||||||
|
w = $(@container).width()
|
||||||
|
h = $(@container).height()
|
||||||
|
sx = w / @client.resolution.w
|
||||||
|
sy = h / @client.resolution.h
|
||||||
|
if sx > sy then @client.setScale sy else @client.setScale sx
|
||||||
|
|
||||||
showConnectionDialog: () ->
|
showConnectionDialog: () ->
|
||||||
me = @
|
me = @
|
||||||
@openDialog new ConnectionDialog, (d) ->
|
@openDialog new ConnectionDialog, (d) ->
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
|||||||
{"name":"RemoteDesktop","root":"home://workspace/RemoteDesktop","css":[],"javascripts":["javascripts/wvnc.js"],"coffees":["coffees/main.coffee"],"copies":["assets/scheme.html","package.json","README.md","javascripts/decoder.js","javascripts/wvnc_asm.js","javascripts/wvnc_asm.wasm"]}
|
{"name":"RemoteDesktop","root":"home://Documents/workspace/antosdk-apps/RemoteDesktop","css":["assets/main.css"],"javascripts":["javascripts/wvnc.js"],"coffees":["coffees/main.coffee"],"copies":["assets/scheme.html","package.json","README.md","javascripts/decoder.js","javascripts/wvnc_asm.js","javascripts/wvnc_asm.wasm"]}
|
Loading…
Reference in New Issue
Block a user