switch render logic to canvas
This commit is contained in:
parent
e04c3c364f
commit
3ee9624d54
|
@ -0,0 +1,165 @@
|
||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
|
||||||
|
This version of the GNU Lesser General Public License incorporates
|
||||||
|
the terms and conditions of version 3 of the GNU General Public
|
||||||
|
License, supplemented by the additional permissions listed below.
|
||||||
|
|
||||||
|
0. Additional Definitions.
|
||||||
|
|
||||||
|
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||||
|
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||||
|
General Public License.
|
||||||
|
|
||||||
|
"The Library" refers to a covered work governed by this License,
|
||||||
|
other than an Application or a Combined Work as defined below.
|
||||||
|
|
||||||
|
An "Application" is any work that makes use of an interface provided
|
||||||
|
by the Library, but which is not otherwise based on the Library.
|
||||||
|
Defining a subclass of a class defined by the Library is deemed a mode
|
||||||
|
of using an interface provided by the Library.
|
||||||
|
|
||||||
|
A "Combined Work" is a work produced by combining or linking an
|
||||||
|
Application with the Library. The particular version of the Library
|
||||||
|
with which the Combined Work was made is also called the "Linked
|
||||||
|
Version".
|
||||||
|
|
||||||
|
The "Minimal Corresponding Source" for a Combined Work means the
|
||||||
|
Corresponding Source for the Combined Work, excluding any source code
|
||||||
|
for portions of the Combined Work that, considered in isolation, are
|
||||||
|
based on the Application, and not on the Linked Version.
|
||||||
|
|
||||||
|
The "Corresponding Application Code" for a Combined Work means the
|
||||||
|
object code and/or source code for the Application, including any data
|
||||||
|
and utility programs needed for reproducing the Combined Work from the
|
||||||
|
Application, but excluding the System Libraries of the Combined Work.
|
||||||
|
|
||||||
|
1. Exception to Section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
You may convey a covered work under sections 3 and 4 of this License
|
||||||
|
without being bound by section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
2. Conveying Modified Versions.
|
||||||
|
|
||||||
|
If you modify a copy of the Library, and, in your modifications, a
|
||||||
|
facility refers to a function or data to be supplied by an Application
|
||||||
|
that uses the facility (other than as an argument passed when the
|
||||||
|
facility is invoked), then you may convey a copy of the modified
|
||||||
|
version:
|
||||||
|
|
||||||
|
a) under this License, provided that you make a good faith effort to
|
||||||
|
ensure that, in the event an Application does not supply the
|
||||||
|
function or data, the facility still operates, and performs
|
||||||
|
whatever part of its purpose remains meaningful, or
|
||||||
|
|
||||||
|
b) under the GNU GPL, with none of the additional permissions of
|
||||||
|
this License applicable to that copy.
|
||||||
|
|
||||||
|
3. Object Code Incorporating Material from Library Header Files.
|
||||||
|
|
||||||
|
The object code form of an Application may incorporate material from
|
||||||
|
a header file that is part of the Library. You may convey such object
|
||||||
|
code under terms of your choice, provided that, if the incorporated
|
||||||
|
material is not limited to numerical parameters, data structure
|
||||||
|
layouts and accessors, or small macros, inline functions and templates
|
||||||
|
(ten or fewer lines in length), you do both of the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the object code that the
|
||||||
|
Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
4. Combined Works.
|
||||||
|
|
||||||
|
You may convey a Combined Work under terms of your choice that,
|
||||||
|
taken together, effectively do not restrict modification of the
|
||||||
|
portions of the Library contained in the Combined Work and reverse
|
||||||
|
engineering for debugging such modifications, if you also do each of
|
||||||
|
the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the Combined Work that
|
||||||
|
the Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
c) For a Combined Work that displays copyright notices during
|
||||||
|
execution, include the copyright notice for the Library among
|
||||||
|
these notices, as well as a reference directing the user to the
|
||||||
|
copies of the GNU GPL and this license document.
|
||||||
|
|
||||||
|
d) Do one of the following:
|
||||||
|
|
||||||
|
0) Convey the Minimal Corresponding Source under the terms of this
|
||||||
|
License, and the Corresponding Application Code in a form
|
||||||
|
suitable for, and under terms that permit, the user to
|
||||||
|
recombine or relink the Application with a modified version of
|
||||||
|
the Linked Version to produce a modified Combined Work, in the
|
||||||
|
manner specified by section 6 of the GNU GPL for conveying
|
||||||
|
Corresponding Source.
|
||||||
|
|
||||||
|
1) Use a suitable shared library mechanism for linking with the
|
||||||
|
Library. A suitable mechanism is one that (a) uses at run time
|
||||||
|
a copy of the Library already present on the user's computer
|
||||||
|
system, and (b) will operate properly with a modified version
|
||||||
|
of the Library that is interface-compatible with the Linked
|
||||||
|
Version.
|
||||||
|
|
||||||
|
e) Provide Installation Information, but only if you would otherwise
|
||||||
|
be required to provide such information under section 6 of the
|
||||||
|
GNU GPL, and only to the extent that such information is
|
||||||
|
necessary to install and execute a modified version of the
|
||||||
|
Combined Work produced by recombining or relinking the
|
||||||
|
Application with a modified version of the Linked Version. (If
|
||||||
|
you use option 4d0, the Installation Information must accompany
|
||||||
|
the Minimal Corresponding Source and Corresponding Application
|
||||||
|
Code. If you use option 4d1, you must provide the Installation
|
||||||
|
Information in the manner specified by section 6 of the GNU GPL
|
||||||
|
for conveying Corresponding Source.)
|
||||||
|
|
||||||
|
5. Combined Libraries.
|
||||||
|
|
||||||
|
You may place library facilities that are a work based on the
|
||||||
|
Library side by side in a single library together with other library
|
||||||
|
facilities that are not Applications and are not covered by this
|
||||||
|
License, and convey such a combined library under terms of your
|
||||||
|
choice, if you do both of the following:
|
||||||
|
|
||||||
|
a) Accompany the combined library with a copy of the same work based
|
||||||
|
on the Library, uncombined with any other library facilities,
|
||||||
|
conveyed under the terms of this License.
|
||||||
|
|
||||||
|
b) Give prominent notice with the combined library that part of it
|
||||||
|
is a work based on the Library, and explaining where to find the
|
||||||
|
accompanying uncombined form of the same work.
|
||||||
|
|
||||||
|
6. Revised Versions of the GNU Lesser General Public License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the GNU Lesser General Public License from time to time. Such new
|
||||||
|
versions will be similar in spirit to the present version, but may
|
||||||
|
differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Library as you received it specifies that a certain numbered version
|
||||||
|
of the GNU Lesser General Public License "or any later version"
|
||||||
|
applies to it, you have the option of following the terms and
|
||||||
|
conditions either of that published version or of any later version
|
||||||
|
published by the Free Software Foundation. If the Library as you
|
||||||
|
received it does not specify a version number of the GNU Lesser
|
||||||
|
General Public License, you may choose any version of the GNU Lesser
|
||||||
|
General Public License ever published by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Library as you received it specifies that a proxy can decide
|
||||||
|
whether future versions of the GNU Lesser General Public License shall
|
||||||
|
apply, that proxy's public statement of acceptance of any version is
|
||||||
|
permanent authorization for you to choose that version for the
|
||||||
|
Library.
|
49
index.html
49
index.html
|
@ -1,22 +1,45 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>Virtual Keyboard Config Editor</title>
|
<title>Virtual Keyboard Config Editor</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
|
<meta name="viewport"
|
||||||
</head>
|
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
|
||||||
<body>
|
</head>
|
||||||
<div id="app"></div>
|
<body>
|
||||||
<!-- built files will be auto injected -->
|
<div id="app"></div>
|
||||||
<script>
|
<!-- built files will be auto injected -->
|
||||||
|
<% if (process.env.NODE_ENV === 'development') { %>
|
||||||
|
<script>
|
||||||
|
window.webObject = {
|
||||||
|
getText: function () {
|
||||||
|
return '{"vToggle":{"key":"None","rectangle":{"X":36,"Y":12,"Width":64,"Height":64},"autoHidden":false},"buttons":[{"key":"Q","rectangle":{"X":200,"Y":80,"Width":90,"Height":90},"transparency":0.5,"alias":null,"command":null},{"key":"I","rectangle":{"X":363,"Y":80,"Width":90,"Height":90},"transparency":0.5,"alias":null,"command":null},{"key":"P","rectangle":{"X":526,"Y":80,"Width":90,"Height":90},"transparency":0.5,"alias":null,"command":null},{"key":"B","rectangle":{"X":1180,"Y":12,"Width":90,"Height":90},"transparency":0.5,"alias":null,"command":null}],"buttonsExtend":[{"key":"F1","rectangle":{"X":190,"Y":170,"Width":90,"Height":90},"transparency":0.5,"alias":null,"command":null},{"key":"F2","rectangle":{"X":290,"Y":170,"Width":90,"Height":90},"transparency":0.5,"alias":null,"command":null},{"key":"F3","rectangle":{"X":390,"Y":170,"Width":90,"Height":90},"transparency":0.5,"alias":null,"command":null},{"key":"H","rectangle":{"X":490,"Y":170,"Width":90,"Height":90},"transparency":0.5,"alias":null,"command":null},{"key":"O","rectangle":{"X":590,"Y":170,"Width":90,"Height":90},"transparency":0.5,"alias":null,"command":null},{"key":"K","rectangle":{"X":690,"Y":170,"Width":90,"Height":90},"transparency":0.5,"alias":null,"command":null},{"key":"U","rectangle":{"X":790,"Y":170,"Width":90,"Height":90},"transparency":0.5,"alias":null,"command":null},{"key":"M","rectangle":{"X":890,"Y":170,"Width":90,"Height":90},"transparency":0.5,"alias":null,"command":null},{"key":"V","rectangle":{"X":990,"Y":170,"Width":90,"Height":90},"transparency":0.5,"alias":null,"command":null},{"key":"RightWindows","rectangle":{"X":1090,"Y":170,"Width":90,"Height":90},"transparency":0.5,"alias":"CMD","command":null},{"key":"S","rectangle":{"X":1080,"Y":12,"Width":90,"Height":90},"transparency":0.5,"alias":null,"command":null},{"key":"None","rectangle":{"X":980,"Y":12,"Width":90,"Height":90},"transparency":0.5,"alias":"Zoom","command":"zoom"}]}';
|
||||||
|
}, getMode: function () {
|
||||||
|
return 'tree';
|
||||||
|
}, getLanguage: function () {
|
||||||
|
return 'zh-CN';
|
||||||
|
}, isEditable: function () {
|
||||||
|
return true;
|
||||||
|
}, getHeight: function () {
|
||||||
|
return 720;
|
||||||
|
}, getWidth: function () {
|
||||||
|
return 1280;
|
||||||
|
}, getScale: function () {
|
||||||
|
return 0.2;
|
||||||
|
}, isLandscape: function () {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<% }
|
||||||
|
%>
|
||||||
|
<script>
|
||||||
window.getJsonCallback = null;
|
window.getJsonCallback = null;
|
||||||
window.webObject = { getText: function(){ return '{"vToggle":{"key":"None","rectangle":{"X":36,"Y":12,"Width":64,"Height":64},"autoHidden":false},"buttons":[{"key":"Q","rectangle":{"X":200,"Y":80,"Width":90,"Height":90},"transparency":0.5,"alias":null,"command":null},{"key":"I","rectangle":{"X":363,"Y":80,"Width":90,"Height":90},"transparency":0.5,"alias":null,"command":null},{"key":"P","rectangle":{"X":526,"Y":80,"Width":90,"Height":90},"transparency":0.5,"alias":null,"command":null},{"key":"B","rectangle":{"X":1180,"Y":12,"Width":90,"Height":90},"transparency":0.5,"alias":null,"command":null}],"buttonsExtend":[{"key":"F1","rectangle":{"X":190,"Y":170,"Width":90,"Height":90},"transparency":0.5,"alias":null,"command":null},{"key":"F2","rectangle":{"X":290,"Y":170,"Width":90,"Height":90},"transparency":0.5,"alias":null,"command":null},{"key":"F3","rectangle":{"X":390,"Y":170,"Width":90,"Height":90},"transparency":0.5,"alias":null,"command":null},{"key":"H","rectangle":{"X":490,"Y":170,"Width":90,"Height":90},"transparency":0.5,"alias":null,"command":null},{"key":"O","rectangle":{"X":590,"Y":170,"Width":90,"Height":90},"transparency":0.5,"alias":null,"command":null},{"key":"K","rectangle":{"X":690,"Y":170,"Width":90,"Height":90},"transparency":0.5,"alias":null,"command":null},{"key":"U","rectangle":{"X":790,"Y":170,"Width":90,"Height":90},"transparency":0.5,"alias":null,"command":null},{"key":"M","rectangle":{"X":890,"Y":170,"Width":90,"Height":90},"transparency":0.5,"alias":null,"command":null},{"key":"V","rectangle":{"X":990,"Y":170,"Width":90,"Height":90},"transparency":0.5,"alias":null,"command":null},{"key":"RightWindows","rectangle":{"X":1090,"Y":170,"Width":90,"Height":90},"transparency":0.5,"alias":"CMD","command":null},{"key":"S","rectangle":{"X":1080,"Y":12,"Width":90,"Height":90},"transparency":0.5,"alias":null,"command":null},{"key":"None","rectangle":{"X":980,"Y":12,"Width":90,"Height":90},"transparency":0.5,"alias":"Zoom","command":"zoom"}]}'; }, getMode: function(){ return 'tree';}, getLanguage: function(){ return 'zh-CN';}, isEditable: function(){ return true;}, getHeight: function(){ return 720;}, getWidth: function(){ return 1280;}, };
|
window.getJson = function () {
|
||||||
window.getJson = function()
|
if (window.getJsonCallback != null) {
|
||||||
{
|
|
||||||
if(window.getJsonCallback != null) {
|
|
||||||
window.webObject.setText(JSON.stringify(window.getJsonCallback()));
|
window.webObject.setText(JSON.stringify(window.getJsonCallback()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
"version": "7.12.1",
|
"version": "7.12.1",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz",
|
||||||
"integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==",
|
"integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==",
|
||||||
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"regenerator-runtime": "^0.13.4"
|
"regenerator-runtime": "^0.13.4"
|
||||||
},
|
},
|
||||||
|
@ -31,7 +32,8 @@
|
||||||
"regenerator-runtime": {
|
"regenerator-runtime": {
|
||||||
"version": "0.13.7",
|
"version": "0.13.7",
|
||||||
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz",
|
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz",
|
||||||
"integrity": "sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew=="
|
"integrity": "sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew==",
|
||||||
|
"dev": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -60,16 +62,6 @@
|
||||||
"integrity": "sha512-1HcDas8SEj4z1Wc696tH56G8OlRaH/sqZOynNNB+HF0WOeXPaxTtbYzJY2oEfiUxjSKjhCKr+MvR7dCHcEelug==",
|
"integrity": "sha512-1HcDas8SEj4z1Wc696tH56G8OlRaH/sqZOynNNB+HF0WOeXPaxTtbYzJY2oEfiUxjSKjhCKr+MvR7dCHcEelug==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@vant/icons": {
|
|
||||||
"version": "1.3.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/@vant/icons/-/icons-1.3.2.tgz",
|
|
||||||
"integrity": "sha512-uP0nUWw0pyMMGt3L9BO5fEacz/Cn7QIea0/gFoC/jPLv9ufvUxjPsV9HSyyUJsqMJ3qlYLAI/SxZDbmMZA814A=="
|
|
||||||
},
|
|
||||||
"@vue/babel-helper-vue-jsx-merge-props": {
|
|
||||||
"version": "1.2.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@vue/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-1.2.1.tgz",
|
|
||||||
"integrity": "sha512-QOi5OW45e2R20VygMSNhyQHvpdUwQZqGPc748JLGCYEy+yp8fNFNdbNIGAgZmi9e+2JHPd6i6idRuqivyicIkA=="
|
|
||||||
},
|
|
||||||
"accepts": {
|
"accepts": {
|
||||||
"version": "1.3.7",
|
"version": "1.3.7",
|
||||||
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
|
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
|
||||||
|
@ -10966,17 +10958,6 @@
|
||||||
"spdx-expression-parse": "^3.0.0"
|
"spdx-expression-parse": "^3.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"vant": {
|
|
||||||
"version": "2.10.10",
|
|
||||||
"resolved": "https://registry.npmjs.org/vant/-/vant-2.10.10.tgz",
|
|
||||||
"integrity": "sha512-B0fCcY+SEfvkPWKEG7bu2Y5RjsUmH02hJzvJWNBZsvttoSDA1PxD1KMl+On++DKfM9xaHdv7ndoAS5yQgeCysA==",
|
|
||||||
"requires": {
|
|
||||||
"@babel/runtime": "7.x",
|
|
||||||
"@vant/icons": "1.3.2",
|
|
||||||
"@vue/babel-helper-vue-jsx-merge-props": "^1.0.0",
|
|
||||||
"vue-lazyload": "1.2.3"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"vary": {
|
"vary": {
|
||||||
"version": "1.1.2",
|
"version": "1.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
||||||
|
@ -11000,16 +10981,6 @@
|
||||||
"resolved": "https://registry.npmjs.org/vue/-/vue-2.6.12.tgz",
|
"resolved": "https://registry.npmjs.org/vue/-/vue-2.6.12.tgz",
|
||||||
"integrity": "sha512-uhmLFETqPPNyuLLbsKz6ioJ4q7AZHzD8ZVFNATNyICSZouqP2Sz0rotWQC8UNBF6VGSCs5abnKJoStA6JbCbfg=="
|
"integrity": "sha512-uhmLFETqPPNyuLLbsKz6ioJ4q7AZHzD8ZVFNATNyICSZouqP2Sz0rotWQC8UNBF6VGSCs5abnKJoStA6JbCbfg=="
|
||||||
},
|
},
|
||||||
"vue-draggable-float": {
|
|
||||||
"version": "0.0.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/vue-draggable-float/-/vue-draggable-float-0.0.4.tgz",
|
|
||||||
"integrity": "sha512-icQk28Qdy29FXjo1eT7F0nD9j8EILdjl0bboFBRAfsEG58qm7YGzA99MO10sHymeGtYnqTTa6Bn1Ye6UZhKKUA=="
|
|
||||||
},
|
|
||||||
"vue-draggable-resizable": {
|
|
||||||
"version": "2.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/vue-draggable-resizable/-/vue-draggable-resizable-2.2.0.tgz",
|
|
||||||
"integrity": "sha512-KjVyzg0OtLsyVhnwD/6NozJkLMD3li41QB/aJIJUr3VS75Gn32UPOWidLvhwsbkwNQcKajXW9QCV1aTrN6MY8w=="
|
|
||||||
},
|
|
||||||
"vue-hot-reload-api": {
|
"vue-hot-reload-api": {
|
||||||
"version": "2.3.4",
|
"version": "2.3.4",
|
||||||
"resolved": "https://registry.npmjs.org/vue-hot-reload-api/-/vue-hot-reload-api-2.3.4.tgz",
|
"resolved": "https://registry.npmjs.org/vue-hot-reload-api/-/vue-hot-reload-api-2.3.4.tgz",
|
||||||
|
@ -11026,11 +10997,6 @@
|
||||||
"resolved": "https://registry.npmjs.org/vue-konva/-/vue-konva-2.1.6.tgz",
|
"resolved": "https://registry.npmjs.org/vue-konva/-/vue-konva-2.1.6.tgz",
|
||||||
"integrity": "sha512-N0zuxDKDd3N9Y+7eGHkp9yB0Y68pjHc6tDZycozuohuOkDDsQ0GGqb7DloEp5tVKww9tWi+6wsigumG4jIXiGQ=="
|
"integrity": "sha512-N0zuxDKDd3N9Y+7eGHkp9yB0Y68pjHc6tDZycozuohuOkDDsQ0GGqb7DloEp5tVKww9tWi+6wsigumG4jIXiGQ=="
|
||||||
},
|
},
|
||||||
"vue-lazyload": {
|
|
||||||
"version": "1.2.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/vue-lazyload/-/vue-lazyload-1.2.3.tgz",
|
|
||||||
"integrity": "sha512-DC0ZwxanbRhx79tlA3zY5OYJkH8FYp3WBAnAJbrcuoS8eye1P73rcgAZhyxFSPUluJUTelMB+i/+VkNU/qVm7g=="
|
|
||||||
},
|
|
||||||
"vue-loader": {
|
"vue-loader": {
|
||||||
"version": "13.7.3",
|
"version": "13.7.3",
|
||||||
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-13.7.3.tgz",
|
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-13.7.3.tgz",
|
||||||
|
|
|
@ -13,10 +13,7 @@
|
||||||
"element-ui": "^2.13.2",
|
"element-ui": "^2.13.2",
|
||||||
"konva": "^7.1.4",
|
"konva": "^7.1.4",
|
||||||
"uuid": "^8.3.1",
|
"uuid": "^8.3.1",
|
||||||
"vant": "^2.10.10",
|
|
||||||
"vue": "^2.5.2",
|
"vue": "^2.5.2",
|
||||||
"vue-draggable-float": "0.0.4",
|
|
||||||
"vue-draggable-resizable": "^2.2.0",
|
|
||||||
"vue-i18n": "^8.22.1",
|
"vue-i18n": "^8.22.1",
|
||||||
"vue-konva": "^2.1.6"
|
"vue-konva": "^2.1.6"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,49 +1,41 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div :grid='grid' @click="onParentClick"
|
<v-stage :config="{height: height, width: width}" @tap="onParentClick"
|
||||||
:style="{height: height+'px', width: width + 'px',
|
:style="{transform: 'scale(' + scale +')', 'transform-origin': '0 0', 'margin-bottom': '-' + height*(1-scale) + 'px'}">
|
||||||
border: '1px solid #13a8d5', position: 'relative',
|
<v-layer>
|
||||||
transform: 'scale(' + scale +')', 'transform-origin': '0 0',
|
<v-rect
|
||||||
'margin-bottom': '-' + height*(1-scale) + 'px'}">
|
:config="{x:0,y:0,width:width,height:height,stroke: 'cyan',strokeWidth: 1 / this.scale, dash: [5 / this.scale, 5 / this.scale]}"></v-rect>
|
||||||
<vue-draggable-resizable :parent="true" className="vdr button button-vtg"
|
<v-rect
|
||||||
@dragging="(x,y)=>onDrag(config.vToggle,x,y)" :resizable="false" :scale="scale"
|
:config="{x:4,y:16,width:slotSize+24,height:slotSize*24+24,stroke: 'gold',strokeWidth: 1 / this.scale, dash: [3 / this.scale, 3 / this.scale]}"></v-rect>
|
||||||
@resizing="(x, y, width, height)=>onResize(config.vToggle,x, y, width, height)"
|
<v-rect
|
||||||
:w="config.vToggle.rectangle.Width"
|
:config="{x:16,y:height - slotSize - 28,width:slotSize*24+24,height:slotSize+24,stroke: 'gold',strokeWidth: 1 / this.scale, dash: [3 / this.scale, 3 / this.scale]}"></v-rect>
|
||||||
:h="config.vToggle.rectangle.Height"
|
<v-group @tap="toggle">
|
||||||
:x="config.vToggle.rectangle.X"
|
<v-rect :config="getButtonConfig(config.vToggle, 'lightyellow')"></v-rect>
|
||||||
:y="config.vToggle.rectangle.Y">
|
<v-text :config="getTextConfig(config.vToggle, $t('toggle'))"></v-text>
|
||||||
<p class="button-text" @click="toggle">{{$t('toggle')}}</p>
|
</v-group>
|
||||||
</vue-draggable-resizable>
|
</v-layer>
|
||||||
<vue-draggable-resizable v-for="button in config.buttons" :key="firstNotEmpty(button.id, button.key)"
|
<v-layer>
|
||||||
:parent="true" className="vdr button" :resizable="false" :scale="scale"
|
<v-group v-for="button in config.buttons" :key="firstNotEmpty(button.id, button.key)"
|
||||||
@dragging="(x,y)=>onDrag(button,x,y)"
|
v-if="button.id !== currentButtonId" @tap="() => onActivated(button)">
|
||||||
@resizing="(x, y, width, height)=>onResize(button,x, y, width, height)"
|
<v-rect :config="getButtonConfig(button, 'darkorange')"></v-rect>
|
||||||
@activated="()=>onActivated(button)"
|
<v-text :config="getTextConfig(button, firstNotEmpty(button.alias, button.key))"></v-text>
|
||||||
:w="button.rectangle.Width"
|
</v-group>
|
||||||
:h="button.rectangle.Height"
|
<v-group v-for="button in config.buttonsExtend" :key="firstNotEmpty(button.id, button.key)"
|
||||||
:x="button.rectangle.X"
|
v-if="toggleState && button.id !== currentButtonId" @tap="() => onActivated(button)">
|
||||||
:y="button.rectangle.Y">
|
<v-rect :config="getButtonConfig(button, 'lightyellow')"></v-rect>
|
||||||
<p class="button-text">{{firstNotEmpty(button.alias, button.key)}}</p>
|
<v-text :config="getTextConfig(button, firstNotEmpty(button.alias, button.key))"></v-text>
|
||||||
</vue-draggable-resizable>
|
</v-group>
|
||||||
<vue-draggable-resizable v-for="button in config.buttonsExtend" :key="firstNotEmpty(button.id, button.key)"
|
</v-layer>
|
||||||
:parent="true" className="vdr button button-ext" v-if="toggleState" :resizable="false" :scale="scale"
|
<v-layer v-if="!isEmpty(currentButtonId)">
|
||||||
@dragging="(x,y)=>onDrag(button,x,y)"
|
<v-rect :config="getButtonConfig(currentButton, 'lightcyan')"></v-rect>
|
||||||
@resizing="(x, y, width, height)=>onResize(button,x, y, width, height)"
|
<v-text :config="getTextConfig(currentButton, firstNotEmpty(currentButton.alias, currentButton.key))"></v-text>
|
||||||
@activated="()=>onActivated(button)"
|
</v-layer>
|
||||||
:w="button.rectangle.Width"
|
</v-stage>
|
||||||
:h="button.rectangle.Height"
|
|
||||||
:x="button.rectangle.X"
|
|
||||||
:y="button.rectangle.Y">
|
|
||||||
<p class="button-text">{{firstNotEmpty(button.alias, button.key)}}</p>
|
|
||||||
</vue-draggable-resizable>
|
|
||||||
</div>
|
|
||||||
<el-drawer
|
<el-drawer
|
||||||
title=""
|
title=""
|
||||||
:visible.sync="drawer"
|
:visible.sync="drawer"
|
||||||
:direction="rtl"
|
direction="rtl"
|
||||||
size="40%"
|
size="40%"
|
||||||
:wrapperClosable="false"
|
|
||||||
:show-close="true"
|
|
||||||
:with-header="true">
|
:with-header="true">
|
||||||
<el-form ref="form" label-width="50px">
|
<el-form ref="form" label-width="50px">
|
||||||
<el-form-item :label="$t('X')">
|
<el-form-item :label="$t('X')">
|
||||||
|
@ -76,24 +68,17 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
<draggable
|
<el-button v-if="landscape && !isEmpty(currentButtonId)"
|
||||||
:distanceRight='0'
|
type="primary" icon="el-icon-edit" circle @click="drawer=true"
|
||||||
:distanceBottom='100'
|
class="button-float"></el-button>
|
||||||
:isScrollHidden='false'
|
|
||||||
:isCanDraggable='true'
|
|
||||||
:zIndex="100">
|
|
||||||
<el-button type="primary" icon="el-icon-edit" circle @click="drawer=true"></el-button>
|
|
||||||
</draggable>
|
|
||||||
<el-form ref="form" label-width="80px">
|
<el-form ref="form" label-width="80px">
|
||||||
<el-form-item :label="$t('key')">
|
<el-form-item :label="$t('key')">
|
||||||
<el-select v-model="currentButton.key" filterable :placeholder="$t('key')">
|
<el-autocomplete
|
||||||
<el-option
|
class="inline-input"
|
||||||
v-for="item in options"
|
v-model="currentButton.key"
|
||||||
:key="item.value"
|
:fetch-suggestions="querySearch"
|
||||||
:label="item.label"
|
:placeholder="$t('key')"
|
||||||
:value="item.value">
|
></el-autocomplete>
|
||||||
</el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('alias')">
|
<el-form-item :label="$t('alias')">
|
||||||
<el-col :span="10">
|
<el-col :span="10">
|
||||||
|
@ -157,18 +142,19 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {v4 as uuidv4} from 'uuid';
|
import {v4 as uuidv4} from 'uuid';
|
||||||
import Draggable from 'vue-draggable-float'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components:{Draggable},
|
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
grid: [5, 5],
|
grid: [5, 5],
|
||||||
scale: 0.4,
|
scale: 0.4,
|
||||||
|
slotSize: 80,
|
||||||
width: 1280,
|
width: 1280,
|
||||||
height: 720,
|
height: 720,
|
||||||
toggleState: true,
|
toggleState: true,
|
||||||
drawer: false,
|
drawer: false,
|
||||||
|
landscape: false,
|
||||||
|
currentButtonId: '',
|
||||||
currentButton: {
|
currentButton: {
|
||||||
key: '',
|
key: '',
|
||||||
alias: '',
|
alias: '',
|
||||||
|
@ -183,49 +169,10 @@
|
||||||
{label: "MouseMiddle", value: "MouseMiddle"},
|
{label: "MouseMiddle", value: "MouseMiddle"},
|
||||||
{label: "MouseX1", value: "MouseX1"},
|
{label: "MouseX1", value: "MouseX1"},
|
||||||
{label: "MouseX2", value: "MouseX2"},
|
{label: "MouseX2", value: "MouseX2"},
|
||||||
{label: "ControllerA", value: "ControllerA"},
|
|
||||||
{label: "ControllerB", value: "ControllerB"},
|
|
||||||
{label: "ControllerX", value: "ControllerX"},
|
|
||||||
{label: "ControllerY", value: "ControllerY"},
|
|
||||||
{label: "ControllerBack", value: "ControllerBack"},
|
|
||||||
{label: "ControllerStart", value: "ControllerStart"},
|
|
||||||
{label: "DPadUp", value: "DPadUp"},
|
|
||||||
{label: "DPadDown", value: "DPadDown"},
|
|
||||||
{label: "DPadLeft", value: "DPadLeft"},
|
|
||||||
{label: "DPadRight", value: "DPadRight"},
|
|
||||||
{label: "LeftShoulder", value: "LeftShoulder"},
|
|
||||||
{label: "RightShoulder", value: "RightShoulder"},
|
|
||||||
{label: "LeftTrigger", value: "LeftTrigger"},
|
|
||||||
{label: "RightTrigger", value: "RightTrigger"},
|
|
||||||
{label: "LeftStick", value: "LeftStick"},
|
|
||||||
{label: "RightStick", value: "RightStick"},
|
|
||||||
{label: "BigButton", value: "BigButton"},
|
|
||||||
{label: "LeftThumbstickLeft", value: "LeftThumbstickLeft"},
|
|
||||||
{label: "LeftThumbstickRight", value: "LeftThumbstickRight"},
|
|
||||||
{label: "LeftThumbstickDown", value: "LeftThumbstickDown"},
|
|
||||||
{label: "LeftThumbstickUp", value: "LeftThumbstickUp"},
|
|
||||||
{label: "RightThumbstickLeft", value: "RightThumbstickLeft"},
|
|
||||||
{label: "RightThumbstickRight", value: "RightThumbstickRight"},
|
|
||||||
{label: "RightThumbstickDown", value: "RightThumbstickDown"},
|
|
||||||
{label: "RightThumbstickUp", value: "RightThumbstickUp"},
|
|
||||||
{label: "A", value: "A"},
|
{label: "A", value: "A"},
|
||||||
{label: "Add", value: "Add"},
|
|
||||||
{label: "Apps", value: "Apps"},
|
|
||||||
{label: "Attn", value: "Attn"},
|
|
||||||
{label: "B", value: "B"},
|
{label: "B", value: "B"},
|
||||||
{label: "Back", value: "Back"},
|
|
||||||
{label: "BrowserBack", value: "BrowserBack"},
|
|
||||||
{label: "BrowserFavorites", value: "BrowserFavorites"},
|
|
||||||
{label: "BrowserForward", value: "BrowserForward"},
|
|
||||||
{label: "BrowserHome", value: "BrowserHome"},
|
|
||||||
{label: "BrowserRefresh", value: "BrowserRefresh"},
|
|
||||||
{label: "BrowserSearch", value: "BrowserSearch"},
|
|
||||||
{label: "BrowserStop", value: "BrowserStop"},
|
|
||||||
{label: "C", value: "C"},
|
{label: "C", value: "C"},
|
||||||
{label: "CapsLock", value: "CapsLock"},
|
{label: "CapsLock", value: "CapsLock"},
|
||||||
{label: "ChatPadGreen", value: "ChatPadGreen"},
|
|
||||||
{label: "ChatPadOrange", value: "ChatPadOrange"},
|
|
||||||
{label: "Crsel", value: "Crsel"},
|
|
||||||
{label: "D", value: "D"},
|
{label: "D", value: "D"},
|
||||||
{label: "D0", value: "D0"},
|
{label: "D0", value: "D0"},
|
||||||
{label: "D1", value: "D1"},
|
{label: "D1", value: "D1"},
|
||||||
|
@ -244,28 +191,13 @@
|
||||||
{label: "E", value: "E"},
|
{label: "E", value: "E"},
|
||||||
{label: "End", value: "End"},
|
{label: "End", value: "End"},
|
||||||
{label: "Enter", value: "Enter"},
|
{label: "Enter", value: "Enter"},
|
||||||
{label: "EraseEof", value: "EraseEof"},
|
|
||||||
{label: "Escape", value: "Escape"},
|
{label: "Escape", value: "Escape"},
|
||||||
{label: "Execute", value: "Execute"},
|
|
||||||
{label: "Exsel", value: "Exsel"},
|
|
||||||
{label: "F", value: "F"},
|
{label: "F", value: "F"},
|
||||||
{label: "F1", value: "F1"},
|
{label: "F1", value: "F1"},
|
||||||
{label: "F10", value: "F10"},
|
{label: "F10", value: "F10"},
|
||||||
{label: "F11", value: "F11"},
|
{label: "F11", value: "F11"},
|
||||||
{label: "F12", value: "F12"},
|
{label: "F12", value: "F12"},
|
||||||
{label: "F13", value: "F13"},
|
|
||||||
{label: "F14", value: "F14"},
|
|
||||||
{label: "F15", value: "F15"},
|
|
||||||
{label: "F16", value: "F16"},
|
|
||||||
{label: "F17", value: "F17"},
|
|
||||||
{label: "F18", value: "F18"},
|
|
||||||
{label: "F19", value: "F19"},
|
|
||||||
{label: "F2", value: "F2"},
|
{label: "F2", value: "F2"},
|
||||||
{label: "F20", value: "F20"},
|
|
||||||
{label: "F21", value: "F21"},
|
|
||||||
{label: "F22", value: "F22"},
|
|
||||||
{label: "F23", value: "F23"},
|
|
||||||
{label: "F24", value: "F24"},
|
|
||||||
{label: "F3", value: "F3"},
|
{label: "F3", value: "F3"},
|
||||||
{label: "F4", value: "F4"},
|
{label: "F4", value: "F4"},
|
||||||
{label: "F5", value: "F5"},
|
{label: "F5", value: "F5"},
|
||||||
|
@ -278,27 +210,16 @@
|
||||||
{label: "Help", value: "Help"},
|
{label: "Help", value: "Help"},
|
||||||
{label: "Home", value: "Home"},
|
{label: "Home", value: "Home"},
|
||||||
{label: "I", value: "I"},
|
{label: "I", value: "I"},
|
||||||
{label: "ImeConvert", value: "ImeConvert"},
|
|
||||||
{label: "ImeNoConvert", value: "ImeNoConvert"},
|
|
||||||
{label: "Insert", value: "Insert"},
|
{label: "Insert", value: "Insert"},
|
||||||
{label: "J", value: "J"},
|
{label: "J", value: "J"},
|
||||||
{label: "K", value: "K"},
|
{label: "K", value: "K"},
|
||||||
{label: "Kana", value: "Kana"},
|
|
||||||
{label: "Kanji", value: "Kanji"},
|
|
||||||
{label: "L", value: "L"},
|
{label: "L", value: "L"},
|
||||||
{label: "LaunchApplication1", value: "LaunchApplication1"},
|
|
||||||
{label: "LaunchApplication2", value: "LaunchApplication2"},
|
|
||||||
{label: "LaunchMail", value: "LaunchMail"},
|
|
||||||
{label: "Left", value: "Left"},
|
{label: "Left", value: "Left"},
|
||||||
{label: "LeftAlt", value: "LeftAlt"},
|
{label: "LeftAlt", value: "LeftAlt"},
|
||||||
{label: "LeftControl", value: "LeftControl"},
|
{label: "LeftControl", value: "LeftControl"},
|
||||||
{label: "LeftShift", value: "LeftShift"},
|
{label: "LeftShift", value: "LeftShift"},
|
||||||
{label: "LeftWindows", value: "LeftWindows"},
|
{label: "LeftWindows", value: "LeftWindows"},
|
||||||
{label: "M", value: "M"},
|
{label: "M", value: "M"},
|
||||||
{label: "MediaNextTrack", value: "MediaNextTrack"},
|
|
||||||
{label: "MediaPlayPause", value: "MediaPlayPause"},
|
|
||||||
{label: "MediaPreviousTrack", value: "MediaPreviousTrack"},
|
|
||||||
{label: "MediaStop", value: "MediaStop"},
|
|
||||||
{label: "Multiply", value: "Multiply"},
|
{label: "Multiply", value: "Multiply"},
|
||||||
{label: "N", value: "N"},
|
{label: "N", value: "N"},
|
||||||
{label: "NumLock", value: "NumLock"},
|
{label: "NumLock", value: "NumLock"},
|
||||||
|
@ -313,14 +234,11 @@
|
||||||
{label: "NumPad8", value: "NumPad8"},
|
{label: "NumPad8", value: "NumPad8"},
|
||||||
{label: "NumPad9", value: "NumPad9"},
|
{label: "NumPad9", value: "NumPad9"},
|
||||||
{label: "O", value: "O"},
|
{label: "O", value: "O"},
|
||||||
{label: "Oem8", value: "Oem8"},
|
|
||||||
{label: "OemAuto", value: "OemAuto"},
|
|
||||||
{label: "OemBackslash", value: "OemBackslash"},
|
{label: "OemBackslash", value: "OemBackslash"},
|
||||||
{label: "OemClear", value: "OemClear"},
|
{label: "OemClear", value: "OemClear"},
|
||||||
{label: "OemCloseBrackets", value: "OemCloseBrackets"},
|
{label: "OemCloseBrackets", value: "OemCloseBrackets"},
|
||||||
{label: "OemComma", value: "OemComma"},
|
{label: "OemComma", value: "OemComma"},
|
||||||
{label: "OemCopy", value: "OemCopy"},
|
{label: "OemCopy", value: "OemCopy"},
|
||||||
{label: "OemEnlW", value: "OemEnlW"},
|
|
||||||
{label: "OemMinus", value: "OemMinus"},
|
{label: "OemMinus", value: "OemMinus"},
|
||||||
{label: "OemOpenBrackets", value: "OemOpenBrackets"},
|
{label: "OemOpenBrackets", value: "OemOpenBrackets"},
|
||||||
{label: "OemPeriod", value: "OemPeriod"},
|
{label: "OemPeriod", value: "OemPeriod"},
|
||||||
|
@ -331,14 +249,12 @@
|
||||||
{label: "OemSemicolon", value: "OemSemicolon"},
|
{label: "OemSemicolon", value: "OemSemicolon"},
|
||||||
{label: "OemTilde", value: "OemTilde"},
|
{label: "OemTilde", value: "OemTilde"},
|
||||||
{label: "P", value: "P"},
|
{label: "P", value: "P"},
|
||||||
{label: "Pa1", value: "Pa1"},
|
|
||||||
{label: "PageDown", value: "PageDown"},
|
{label: "PageDown", value: "PageDown"},
|
||||||
{label: "PageUp", value: "PageUp"},
|
{label: "PageUp", value: "PageUp"},
|
||||||
{label: "Pause", value: "Pause"},
|
{label: "Pause", value: "Pause"},
|
||||||
{label: "Play", value: "Play"},
|
{label: "Play", value: "Play"},
|
||||||
{label: "Print", value: "Print"},
|
{label: "Print", value: "Print"},
|
||||||
{label: "PrintScreen", value: "PrintScreen"},
|
{label: "PrintScreen", value: "PrintScreen"},
|
||||||
{label: "ProcessKey", value: "ProcessKey"},
|
|
||||||
{label: "Q", value: "Q"},
|
{label: "Q", value: "Q"},
|
||||||
{label: "R", value: "R"},
|
{label: "R", value: "R"},
|
||||||
{label: "Right", value: "Right"},
|
{label: "Right", value: "Right"},
|
||||||
|
@ -349,7 +265,6 @@
|
||||||
{label: "S", value: "S"},
|
{label: "S", value: "S"},
|
||||||
{label: "Scroll", value: "Scroll"},
|
{label: "Scroll", value: "Scroll"},
|
||||||
{label: "Select", value: "Select"},
|
{label: "Select", value: "Select"},
|
||||||
{label: "SelectMedia", value: "SelectMedia"},
|
|
||||||
{label: "Separator", value: "Separator"},
|
{label: "Separator", value: "Separator"},
|
||||||
{label: "Sleep", value: "Sleep"},
|
{label: "Sleep", value: "Sleep"},
|
||||||
{label: "Space", value: "Space"},
|
{label: "Space", value: "Space"},
|
||||||
|
@ -365,8 +280,7 @@
|
||||||
{label: "W", value: "W"},
|
{label: "W", value: "W"},
|
||||||
{label: "X", value: "X"},
|
{label: "X", value: "X"},
|
||||||
{label: "Y", value: "Y"},
|
{label: "Y", value: "Y"},
|
||||||
{label: "Z", value: "Z"},
|
{label: "Z", value: "Z"}
|
||||||
{label: "Zoom", value: "Zoom"},
|
|
||||||
],
|
],
|
||||||
config: {}
|
config: {}
|
||||||
}
|
}
|
||||||
|
@ -380,6 +294,8 @@
|
||||||
this.$i18n.locale = window.webObject.getLanguage();
|
this.$i18n.locale = window.webObject.getLanguage();
|
||||||
this.width = window.webObject.getWidth();
|
this.width = window.webObject.getWidth();
|
||||||
this.height = window.webObject.getHeight();
|
this.height = window.webObject.getHeight();
|
||||||
|
this.scale = window.webObject.getScale();
|
||||||
|
this.landscape = window.webObject.isLandscape();
|
||||||
window.setJson = (json) => {
|
window.setJson = (json) => {
|
||||||
let config = JSON.parse(json);
|
let config = JSON.parse(json);
|
||||||
for (let button of config.buttons) {
|
for (let button of config.buttons) {
|
||||||
|
@ -392,36 +308,89 @@
|
||||||
};
|
};
|
||||||
window.setJson(window.webObject.getText());
|
window.setJson(window.webObject.getText());
|
||||||
window.getJsonCallback = () => {
|
window.getJsonCallback = () => {
|
||||||
return this.config;
|
let conf = JSON.parse(JSON.stringify(this.config));
|
||||||
|
for (let button of conf.buttons) {
|
||||||
|
delete button.id;
|
||||||
|
}
|
||||||
|
for (let button of conf.buttonsExtend) {
|
||||||
|
delete button.id;
|
||||||
|
}
|
||||||
|
return conf;
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
toggle: function () {
|
getTextConfig: function (button, text) {
|
||||||
|
if(button === undefined) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
debugger
|
||||||
|
return {
|
||||||
|
x: button.rectangle.X,
|
||||||
|
y: button.rectangle.Y,
|
||||||
|
width: button.rectangle.Width,
|
||||||
|
height: button.rectangle.Height,
|
||||||
|
text: text,
|
||||||
|
align: 'center',
|
||||||
|
verticalAlign: 'middle',
|
||||||
|
fontSize: Math.sqrt(144 / this.scale),
|
||||||
|
perfectDrawEnabled: false,
|
||||||
|
transformsEnabled: 'position',
|
||||||
|
};
|
||||||
|
},
|
||||||
|
getButtonConfig: function (button, color) {
|
||||||
|
if(button === undefined) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
x: button.rectangle.X,
|
||||||
|
y: button.rectangle.Y,
|
||||||
|
width: button.rectangle.Width,
|
||||||
|
height: button.rectangle.Height,
|
||||||
|
opacity: button.transparency,
|
||||||
|
fill: color,
|
||||||
|
stroke: 'black',
|
||||||
|
strokeWidth: 2 / this.scale,
|
||||||
|
perfectDrawEnabled: false,
|
||||||
|
transformsEnabled: 'position',
|
||||||
|
shadowForStrokeEnabled: false,
|
||||||
|
hitStrokeWidth: 0,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
querySearch: function(queryString, cb) {
|
||||||
|
let results = queryString ? this.options.filter((option)=> option.value.toLowerCase().includes(queryString.toLowerCase())) : this.options;
|
||||||
|
// 调用 callback 返回建议列表的数据
|
||||||
|
results.sort((a,b)=>a.value.length-b.value.length);
|
||||||
|
cb(results);
|
||||||
|
},
|
||||||
|
toggle: function (event) {
|
||||||
this.toggleState = !this.toggleState;
|
this.toggleState = !this.toggleState;
|
||||||
},
|
event.cancelBubble = true;
|
||||||
onResize: function (button, x, y, width, height) {
|
|
||||||
button.rectangle.X = x
|
|
||||||
button.rectangle.Y = y
|
|
||||||
button.rectangle.Width = width
|
|
||||||
button.rectangle.Height = height
|
|
||||||
},
|
|
||||||
onDrag: function (button, x, y) {
|
|
||||||
button.rectangle.X = x
|
|
||||||
button.rectangle.Y = y
|
|
||||||
},
|
},
|
||||||
onActivated: function (button) {
|
onActivated: function (button) {
|
||||||
this.currentButton = button;
|
this.currentButton = button;
|
||||||
|
this.currentButtonId = button.id;
|
||||||
|
},
|
||||||
|
getNodeParentFor(node, parentName, attrName){
|
||||||
|
if(node[attrName] !== undefined) {
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
else if(node[parentName] !== undefined && node[parentName] != null) {
|
||||||
|
return this.getNodeParentFor(node[parentName], parentName, attrName);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
},
|
},
|
||||||
onParentClick: function (event) {
|
onParentClick: function (event) {
|
||||||
let dx = event.clientX / this.scale - (this.currentButton.rectangle.X + this.currentButton.rectangle.Width / 2);
|
let parent = this.getNodeParentFor(event.target, 'parent', 'getPointerPosition');
|
||||||
let dy = event.clientY / this.scale - (this.currentButton.rectangle.Y + this.currentButton.rectangle.Height / 2);
|
if(parent == null)
|
||||||
|
return;
|
||||||
|
let dx = parent.getPointerPosition().x - (this.currentButton.rectangle.X + this.currentButton.rectangle.Width / 2);
|
||||||
|
let dy = parent.getPointerPosition().y - (this.currentButton.rectangle.Y + this.currentButton.rectangle.Height / 2);
|
||||||
let adx = Math.abs(dx);
|
let adx = Math.abs(dx);
|
||||||
let ady = Math.abs(dy);
|
let ady = Math.abs(dy);
|
||||||
if (adx > ady) {
|
if (adx > ady) {
|
||||||
if (adx < this.currentButton.rectangle.Width / 2) {
|
if (adx < this.currentButton.rectangle.Width / 2) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
debugger
|
|
||||||
if (dx > 0) {
|
if (dx > 0) {
|
||||||
this.currentButton.rectangle.X += this.grid[0];
|
this.currentButton.rectangle.X += this.grid[0];
|
||||||
} else {
|
} else {
|
||||||
|
@ -431,7 +400,6 @@
|
||||||
if (ady < this.currentButton.rectangle.Height / 2) {
|
if (ady < this.currentButton.rectangle.Height / 2) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
debugger
|
|
||||||
if (dy > 0) {
|
if (dy > 0) {
|
||||||
this.currentButton.rectangle.Y += this.grid[1];
|
this.currentButton.rectangle.Y += this.grid[1];
|
||||||
} else {
|
} else {
|
||||||
|
@ -493,29 +461,10 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.button-text {
|
.button-float {
|
||||||
font-size: medium
|
position: fixed;
|
||||||
}
|
z-index: 99;
|
||||||
.vdr {
|
right: 1%;
|
||||||
display: flex;
|
top: 5%;
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button {
|
|
||||||
background-color: darkorange;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button.active {
|
|
||||||
border-color: deepskyblue;
|
|
||||||
border-width: thick;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button-vtg {
|
|
||||||
background-color: lightyellow;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button-ext {
|
|
||||||
background-color: lightgoldenrodyellow;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -10,9 +10,13 @@ const messages = {
|
||||||
alias: "Alias",
|
alias: "Alias",
|
||||||
command: "Command",
|
command: "Command",
|
||||||
transparency: "Transparency",
|
transparency: "Transparency",
|
||||||
|
X: "X",
|
||||||
|
Y: "Y",
|
||||||
|
Width: "Width",
|
||||||
|
Height: "Height",
|
||||||
...enLocale
|
...enLocale
|
||||||
},
|
},
|
||||||
zh: {
|
"zh-CN": {
|
||||||
toggle: "切换",
|
toggle: "切换",
|
||||||
add: "新增",
|
add: "新增",
|
||||||
remove: "移除",
|
remove: "移除",
|
||||||
|
@ -20,6 +24,10 @@ const messages = {
|
||||||
alias: "别名",
|
alias: "别名",
|
||||||
command: "命令",
|
command: "命令",
|
||||||
transparency: "透明度",
|
transparency: "透明度",
|
||||||
|
X: "X",
|
||||||
|
Y: "Y",
|
||||||
|
Width: "宽",
|
||||||
|
Height: "高",
|
||||||
...zhLocale
|
...zhLocale
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
32
src/main.js
32
src/main.js
|
@ -4,27 +4,33 @@ import Vue from 'vue'
|
||||||
import App from './App'
|
import App from './App'
|
||||||
import VueI18n from 'vue-i18n'
|
import VueI18n from 'vue-i18n'
|
||||||
import messages from "./i18n/messages";
|
import messages from "./i18n/messages";
|
||||||
import VueDraggableResizable from 'vue-draggable-resizable'
|
import {
|
||||||
import { Row, Col, Button, Select, Option, Input, InputNumber, Slider, ColorPicker, Form, FormItem, Drawer } from 'element-ui';
|
Row,
|
||||||
|
Col,
|
||||||
|
Button,
|
||||||
|
Autocomplete,
|
||||||
|
Option,
|
||||||
|
Input,
|
||||||
|
Slider,
|
||||||
|
ColorPicker,
|
||||||
|
Form,
|
||||||
|
FormItem,
|
||||||
|
Drawer
|
||||||
|
} from 'element-ui';
|
||||||
import ElementLocale from 'element-ui/lib/locale'
|
import ElementLocale from 'element-ui/lib/locale'
|
||||||
import VueKonva from 'vue-konva'
|
import VueKonva from 'vue-konva'
|
||||||
|
|
||||||
// optionally import default styles
|
|
||||||
import 'vue-draggable-resizable/dist/VueDraggableResizable.css'
|
|
||||||
|
|
||||||
// register component to use
|
// register component to use
|
||||||
Vue.config.productionTip = false
|
Vue.config.productionTip = false
|
||||||
Vue.use(VueI18n)
|
Vue.use(VueI18n)
|
||||||
|
|
||||||
Vue.use(VueKonva)
|
Vue.use(VueKonva)
|
||||||
Vue.component('vue-draggable-resizable', VueDraggableResizable)
|
Vue.component(Row.name, Row,);
|
||||||
Vue.component(Row.name, Row, );
|
|
||||||
Vue.component(Col.name, Col);
|
Vue.component(Col.name, Col);
|
||||||
Vue.component(Button.name, Button);
|
Vue.component(Button.name, Button);
|
||||||
Vue.component(Select.name, Select);
|
Vue.component(Autocomplete.name, Autocomplete);
|
||||||
Vue.component(Option.name, Option);
|
Vue.component(Option.name, Option);
|
||||||
Vue.component(Input.name, Input);
|
Vue.component(Input.name, Input);
|
||||||
Vue.component(InputNumber.name, InputNumber);
|
|
||||||
Vue.component(Slider.name, Slider);
|
Vue.component(Slider.name, Slider);
|
||||||
Vue.component(ColorPicker.name, ColorPicker);
|
Vue.component(ColorPicker.name, ColorPicker);
|
||||||
Vue.component(Form.name, Form);
|
Vue.component(Form.name, Form);
|
||||||
|
@ -37,16 +43,18 @@ const i18n = new VueI18n({
|
||||||
messages, // set locale messages
|
messages, // set locale messages
|
||||||
})
|
})
|
||||||
window.onresize = setHtmlFontSize;
|
window.onresize = setHtmlFontSize;
|
||||||
function setHtmlFontSize(){
|
|
||||||
|
function setHtmlFontSize() {
|
||||||
const htmlWidth = document.documentElement.clientWidth || document.body.clientWidth;
|
const htmlWidth = document.documentElement.clientWidth || document.body.clientWidth;
|
||||||
const htmlDom = document.getElementsByTagName('html')[0];
|
const htmlDom = document.getElementsByTagName('html')[0];
|
||||||
htmlDom.style.fontSize = htmlWidth / 10 + 'px';
|
htmlDom.style.fontSize = htmlWidth / 10 + 'px';
|
||||||
};
|
}
|
||||||
|
|
||||||
setHtmlFontSize();
|
setHtmlFontSize();
|
||||||
/* eslint-disable no-new */
|
/* eslint-disable no-new */
|
||||||
new Vue({
|
new Vue({
|
||||||
i18n,
|
i18n,
|
||||||
el: '#app',
|
el: '#app',
|
||||||
components: { App },
|
components: {App},
|
||||||
template: '<App/>'
|
template: '<App/>'
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue