diff --git a/previewer/src/views/Home.vue b/previewer/src/views/Home.vue index b329c781e60b63630c71280142bcfee18c7fa584..a1394cf945763e84b0de69d278bd9dffbb0ef642 100644 --- a/previewer/src/views/Home.vue +++ b/previewer/src/views/Home.vue @@ -2,7 +2,12 @@
- + {{ icons.mdiMenu }}
@@ -45,23 +50,46 @@ export default { snackbar: false, // show tips tips: null, // tips message screen: null, // screen + point: { + x: 0, + y: 0 + }, + isMouseDown: false, icons: { // icons mdiMenu } } }, methods: { + mouseDown: function () { + this.isMouseDown = true + this.ws.send(JSON.stringify({ + version: '1.0.0', + name: 'previewer', + command: 'MousePress' + })) + }, move: function (e) { - console.log(`(${e.layerX}, ${e.layerY})`) + if (!this.isMouseDown) { + return + } + this.point = { + x: e.layerX, + y: e.layerY + } + this.ws.send(JSON.stringify({ + version: '1.0.0', + name: 'previewer', + command: 'MouseMove', + args: this.point + })) }, - click: function (e) { + mouseUp: function () { + this.isMouseDown = false this.ws.send(JSON.stringify({ + version: '1.0.0', name: 'previewer', - command: 'click', - args: { - x: e.layerX, - y: e.layerY - } + command: 'MouseRelease' })) }, showTips: function (msg) { @@ -107,6 +135,7 @@ export default { }, updateProperties: function (values) { this.ws.send(JSON.stringify({ + version: '1.0.0', name: 'previewer', command: 'updateProperties', args: values @@ -139,7 +168,7 @@ export default { } uri += '//' + loc.host this.url = uri - // this.url = 'ws://localhost:4096' + this.url = 'ws://localhost:4096/' }, mounted () { // connect websocket