@operato/scene-indoor-map 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- package/@types/global/index.d.ts +1 -0
- package/CHANGELOG.md +16 -0
- package/LICENSE +21 -0
- package/README.md +15 -0
- package/assets/beacon.png +0 -0
- package/assets/indoor-map.png +0 -0
- package/assets/no-image.png +0 -0
- package/assets/rack.png +0 -0
- package/demo/imu-mqtt-node/imu-publisher.js +66 -0
- package/demo/imu-mqtt-node/package.json +16 -0
- package/demo/index-camera.html +108 -0
- package/demo/index-gaussian.html +184 -0
- package/demo/index-indoor-map-property.html +96 -0
- package/demo/index-indoor-map.html +289 -0
- package/demo/index-rack-property.html +76 -0
- package/demo/index.html +365 -0
- package/demo/things-scene-indoor-map.html +6 -0
- package/dist/beacon.d.ts +19 -0
- package/dist/beacon.js +61 -0
- package/dist/beacon.js.map +1 -0
- package/dist/camera.d.ts +20 -0
- package/dist/camera.js +158 -0
- package/dist/camera.js.map +1 -0
- package/dist/editors/index.d.ts +5 -0
- package/dist/editors/index.js +11 -0
- package/dist/editors/index.js.map +1 -0
- package/dist/editors/things-editor-action.d.ts +7 -0
- package/dist/editors/things-editor-action.js +40 -0
- package/dist/editors/things-editor-action.js.map +1 -0
- package/dist/floor.d.ts +23 -0
- package/dist/floor.js +66 -0
- package/dist/floor.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/indoor-map.d.ts +34 -0
- package/dist/indoor-map.js +161 -0
- package/dist/indoor-map.js.map +1 -0
- package/dist/quaternion.d.ts +39 -0
- package/dist/quaternion.js +79 -0
- package/dist/quaternion.js.map +1 -0
- package/dist/rack.d.ts +27 -0
- package/dist/rack.js +84 -0
- package/dist/rack.js.map +1 -0
- package/dist/templates/beacon.d.ts +15 -0
- package/dist/templates/beacon.js +16 -0
- package/dist/templates/beacon.js.map +1 -0
- package/dist/templates/camera.d.ts +20 -0
- package/dist/templates/camera.js +21 -0
- package/dist/templates/camera.js.map +1 -0
- package/dist/templates/index.d.ts +36 -0
- package/dist/templates/index.js +4 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/templates/indoor-map.d.ts +16 -0
- package/dist/templates/indoor-map.js +17 -0
- package/dist/templates/indoor-map.js.map +1 -0
- package/dist/templates/rack.d.ts +22 -0
- package/dist/templates/rack.js +23 -0
- package/dist/templates/rack.js.map +1 -0
- package/helps/scene/component/indoor-map.ko.md +65 -0
- package/helps/scene/component/indoor-map.md +65 -0
- package/helps/scene/component/indoor-map.zh.md +65 -0
- package/helps/scene/component/rack.ko.md +17 -0
- package/helps/scene/component/rack.md +15 -0
- package/helps/scene/component/rack.zh.md +16 -0
- package/helps/scene/images/button-evnet-mapping-01.png +0 -0
- package/helps/scene/images/button-evnet-mapping-02.png +0 -0
- package/helps/scene/images/button-evnet-mapping-03.png +0 -0
- package/helps/scene/images/container-03.png +0 -0
- package/helps/scene/images/indoor-button-finish-01.gif +0 -0
- package/helps/scene/images/indoor-create-01.png +0 -0
- package/helps/scene/images/indoor-create-02.png +0 -0
- package/helps/scene/images/indoor-create-03.png +0 -0
- package/helps/scene/images/indoor-setting-01.png +0 -0
- package/images/icon-button.png +0 -0
- package/package.json +61 -0
- package/src/beacon.ts +69 -0
- package/src/camera.ts +207 -0
- package/src/editors/index.ts +11 -0
- package/src/editors/things-editor-action.ts +48 -0
- package/src/floor.ts +386 -0
- package/src/index.ts +9 -0
- package/src/indoor-map.ts +211 -0
- package/src/quaternion.ts +129 -0
- package/src/rack.ts +104 -0
- package/src/templates/beacon.ts +16 -0
- package/src/templates/camera.ts +21 -0
- package/src/templates/index.ts +4 -0
- package/src/templates/indoor-map.ts +18 -0
- package/src/templates/rack.ts +23 -0
- package/test/basic-test.html +67 -0
- package/test/index.html +22 -0
- package/things-scene.config.js +7 -0
- package/tsconfig.json +23 -0
- package/tsconfig.tsbuildinfo +1 -0
@@ -0,0 +1 @@
|
|
1
|
+
declare module '*.png'
|
package/CHANGELOG.md
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
|
+
|
6
|
+
### [0.0.16](https://github.com/things-scene/operato-scene/compare/v0.0.15...v0.0.16) (2021-12-09)
|
7
|
+
|
8
|
+
|
9
|
+
### :rocket: New Features
|
10
|
+
|
11
|
+
* add indoor-map and gauge component ([35d8a75](https://github.com/things-scene/operato-scene/commit/35d8a75f7d691dd23ea299fd772b79d19eec5d2f))
|
12
|
+
|
13
|
+
|
14
|
+
### :bug: Bug Fix
|
15
|
+
|
16
|
+
* upgrade [@operato](https://github.com/operato) dependencies ([92985c7](https://github.com/things-scene/operato-scene/commit/92985c76d2b7e6d3941c2c809a85b3676a579b0e))
|
package/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2021 Hearty, Oh
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# things-scene-indoor-map
|
2
|
+
|
3
|
+
## build
|
4
|
+
|
5
|
+
`$ yarn build`
|
6
|
+
|
7
|
+
| type | filename | for | tested |
|
8
|
+
| ---- | ----------------------------- | -------------- | ------ |
|
9
|
+
| UMD | things-scene-indoor-map.js | modern browser | O |
|
10
|
+
| UMD | things-scene-indoor-map-ie.js | ie 11 | O |
|
11
|
+
| ESM | things-scene-indoor-map.mjs | modern browser | O |
|
12
|
+
|
13
|
+
## publish
|
14
|
+
|
15
|
+
`$ yarn publish`
|
Binary file
|
Binary file
|
Binary file
|
package/assets/rack.png
ADDED
Binary file
|
@@ -0,0 +1,66 @@
|
|
1
|
+
// https://learn.sparkfun.com/tutorials/9dof-razor-imu-m0-hookup-guide
|
2
|
+
var SerialPort = require('serialport');
|
3
|
+
var mqtt = require('mqtt')
|
4
|
+
var client;
|
5
|
+
|
6
|
+
var port = new SerialPort('/dev/tty.usbmodem141141', function (err) {
|
7
|
+
if (err)
|
8
|
+
return console.log('Error: ', err.message);
|
9
|
+
});
|
10
|
+
|
11
|
+
var values = [];
|
12
|
+
var length = 0;
|
13
|
+
var readonce = false;
|
14
|
+
var initialized = false;
|
15
|
+
var connected = false;
|
16
|
+
|
17
|
+
port.on('data', function (data) {
|
18
|
+
values = data.toString('utf8').split(',').map(v => Number(v.trim()));
|
19
|
+
length = values.length;
|
20
|
+
|
21
|
+
if(!readonce) {
|
22
|
+
readonce = true;
|
23
|
+
init();
|
24
|
+
client = mqtt.connect('mqtt://localhost:1883');
|
25
|
+
client.on('connect', function () {
|
26
|
+
connected = true;
|
27
|
+
console.log('connected');
|
28
|
+
})
|
29
|
+
}
|
30
|
+
|
31
|
+
if(initialized && connected) {
|
32
|
+
// client.publish('imu', data.toString('utf8'));
|
33
|
+
client.publish('imu', JSON.stringify({
|
34
|
+
yaw: values[5] * 0.0174533,
|
35
|
+
pitch: values[6] * 0.0174533,
|
36
|
+
roll: values[7] * 0.0174533
|
37
|
+
}));
|
38
|
+
} else {
|
39
|
+
// console.log('Data:', data.toString('utf8'));
|
40
|
+
}
|
41
|
+
});
|
42
|
+
|
43
|
+
function init() {
|
44
|
+
function setOptions(option, on) {
|
45
|
+
return function() {
|
46
|
+
var before = length;
|
47
|
+
port.write(option, function(err) {
|
48
|
+
setTimeout(function() {
|
49
|
+
if((on && before > length) || (!on && before < length))
|
50
|
+
port.write(option)
|
51
|
+
}, 100);
|
52
|
+
})
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
// a, g, m을 OFF시키고, q, e를 ON 시킴.
|
57
|
+
setTimeout(setOptions('a', false), 100);
|
58
|
+
setTimeout(setOptions('g', false), 300);
|
59
|
+
setTimeout(setOptions('m', false), 500);
|
60
|
+
setTimeout(setOptions('q', true), 700);
|
61
|
+
setTimeout(setOptions('e', true), 900);
|
62
|
+
}
|
63
|
+
|
64
|
+
setTimeout(function() {
|
65
|
+
initialized = true
|
66
|
+
}, 1100);
|
@@ -0,0 +1,16 @@
|
|
1
|
+
{
|
2
|
+
"name": "imu-mqtt-node",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"description": "",
|
5
|
+
"main": "test.js",
|
6
|
+
"dependencies": {
|
7
|
+
"mqtt": "^2.11.0",
|
8
|
+
"serialport": "^5.0.0"
|
9
|
+
},
|
10
|
+
"devDependencies": {},
|
11
|
+
"scripts": {
|
12
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
13
|
+
},
|
14
|
+
"author": "",
|
15
|
+
"license": "ISC"
|
16
|
+
}
|
@@ -0,0 +1,108 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<!--
|
3
|
+
@license
|
4
|
+
Copyright © HatioLab Inc. All rights reserved.
|
5
|
+
-->
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<meta charset="utf-8">
|
9
|
+
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
10
|
+
<title>things-scene-camera Demo</title>
|
11
|
+
<script src="../../webcomponentsjs/webcomponents-lite.min.js"></script>
|
12
|
+
|
13
|
+
<link rel="import" href="../../things-scene-viewer/things-scene-viewer.html">
|
14
|
+
<link rel="import" href="../../things-scene-modeler/things-scene-properties.html">
|
15
|
+
<link rel="import" href="../../things-scene-mqtt/things-scene-mqtt.html">
|
16
|
+
|
17
|
+
<link rel="import" href="./things-scene-indoor-map.html">
|
18
|
+
<link rel="import" href="../../things-scene-mqtt/things-scene-mqtt.html">
|
19
|
+
|
20
|
+
<style is="custom-style">
|
21
|
+
|
22
|
+
things-scene-viewer {
|
23
|
+
display: block;
|
24
|
+
width: 100%;
|
25
|
+
height: 500px;
|
26
|
+
}
|
27
|
+
|
28
|
+
</style>
|
29
|
+
</head>
|
30
|
+
<body unresolved>
|
31
|
+
|
32
|
+
<template is="dom-bind" id="app">
|
33
|
+
<p>An example of <code><things-scene-camera></code>:</p>
|
34
|
+
|
35
|
+
<things-scene-viewer id='scene'
|
36
|
+
scene='{{scene}}'
|
37
|
+
selected='{{selected}}'
|
38
|
+
model='[[model]]'
|
39
|
+
mode="0">
|
40
|
+
<things-scene-layer type="selection-layer"></things-scene-layer>
|
41
|
+
<things-scene-layer type="modeling-layer"></things-scene-layer>
|
42
|
+
<things-scene-handler type="text-editor"></things-scene-handler>
|
43
|
+
<things-scene-handler type="move-handler"></things-scene-handler>
|
44
|
+
</things-scene-viewer>
|
45
|
+
|
46
|
+
<things-scene-properties scene="[[scene]]"
|
47
|
+
selected="[[selected]]"
|
48
|
+
model="{{target}}"
|
49
|
+
bounds="{{bounds}}">
|
50
|
+
<fieldset class="same-width">
|
51
|
+
<legend>Camera Properties</legend>
|
52
|
+
<div>
|
53
|
+
<label>yaw</label>
|
54
|
+
<input type="number" value-as-number="{{target.yaw::change}}"/>
|
55
|
+
<label>pitch</label>
|
56
|
+
<input type="number" value-as-number="{{target.pitch::change}}"/>
|
57
|
+
<label>roll</label>
|
58
|
+
<input type="number" value-as-number="{{target.roll::change}}"/>
|
59
|
+
</div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
</fieldset>
|
63
|
+
</things-scene-properties>
|
64
|
+
|
65
|
+
</template>
|
66
|
+
|
67
|
+
<script>
|
68
|
+
window.addEventListener('WebComponentsReady', function(e) {
|
69
|
+
var app = document.querySelector('#app')
|
70
|
+
|
71
|
+
app.model = {
|
72
|
+
width:1000,
|
73
|
+
height: 1000,
|
74
|
+
components: [{
|
75
|
+
id: "hatio-imu",
|
76
|
+
type: 'camera',
|
77
|
+
id: 'imu',
|
78
|
+
left: 100,
|
79
|
+
top: 100,
|
80
|
+
width: 600,
|
81
|
+
height: 400,
|
82
|
+
lineWidth: 1,
|
83
|
+
strokeStyle: 'black',
|
84
|
+
fillStyle: 'yellow',
|
85
|
+
yaw: 0.2,
|
86
|
+
pitch: 0.2,
|
87
|
+
roll: 0.2
|
88
|
+
}, {
|
89
|
+
type: 'mqtt',
|
90
|
+
left: -10,
|
91
|
+
top: -10,
|
92
|
+
width: 30,
|
93
|
+
height: 30,
|
94
|
+
hidden: true,
|
95
|
+
broker: 'test.mosquitto.org',
|
96
|
+
port: 8080,
|
97
|
+
topic: 'hatio-imu',
|
98
|
+
qos: 0,
|
99
|
+
clientId: 'MQTT-DEVICE-001',
|
100
|
+
retain: true,
|
101
|
+
format: 'JSON'
|
102
|
+
}]
|
103
|
+
}
|
104
|
+
});
|
105
|
+
|
106
|
+
</script>
|
107
|
+
</body>
|
108
|
+
</html>
|
@@ -0,0 +1,184 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<!--
|
3
|
+
@license
|
4
|
+
Copyright © HatioLab Inc. All rights reserved.
|
5
|
+
-->
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<meta charset="utf-8">
|
9
|
+
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
10
|
+
<title>things-scene-gaussian Demo</title>
|
11
|
+
<script src="../../webcomponentsjs/webcomponents-lite.min.js"></script>
|
12
|
+
|
13
|
+
<link rel="import" href="../../things-scene-viewer/things-scene-viewer.html">
|
14
|
+
<link rel="import" href="../../things-scene-modeler/things-scene-properties.html">
|
15
|
+
|
16
|
+
<link rel="import" href="./things-scene-indoor-map.html">
|
17
|
+
|
18
|
+
<style is="custom-style">
|
19
|
+
|
20
|
+
things-scene-viewer {
|
21
|
+
display: block;
|
22
|
+
width: 100%;
|
23
|
+
height: 500px;
|
24
|
+
}
|
25
|
+
|
26
|
+
</style>
|
27
|
+
</head>
|
28
|
+
<body unresolved>
|
29
|
+
|
30
|
+
<template is="dom-bind" id="app">
|
31
|
+
<p>An example of <code><things-scene-gaussian></code>:</p>
|
32
|
+
|
33
|
+
<things-scene-viewer id='scene'
|
34
|
+
scene='{{scene}}'
|
35
|
+
selected='{{selected}}'
|
36
|
+
model='[[model]]'
|
37
|
+
mode="1">
|
38
|
+
<things-scene-layer type="selection-layer"></things-scene-layer>
|
39
|
+
<things-scene-layer type="modeling-layer"></things-scene-layer>
|
40
|
+
<things-scene-handler type="text-editor"></things-scene-handler>
|
41
|
+
<things-scene-handler type="move-handler"></things-scene-handler>
|
42
|
+
</things-scene-viewer>
|
43
|
+
|
44
|
+
<things-scene-properties scene="[[scene]]"
|
45
|
+
selected="[[selected]]"
|
46
|
+
model="{{target}}"
|
47
|
+
bounds="{{bounds}}">
|
48
|
+
<fieldset class="same-width">
|
49
|
+
<legend>Camera Properties</legend>
|
50
|
+
<div>
|
51
|
+
<label>yaw</label>
|
52
|
+
<input type="number" value-as-number="{{target.yaw::change}}"/>
|
53
|
+
<label>pitch</label>
|
54
|
+
<input type="number" value-as-number="{{target.pitch::change}}"/>
|
55
|
+
<label>roll</label>
|
56
|
+
<input type="number" value-as-number="{{target.roll::change}}"/>
|
57
|
+
</div>
|
58
|
+
</div>
|
59
|
+
|
60
|
+
</fieldset>
|
61
|
+
</things-scene-properties>
|
62
|
+
|
63
|
+
</template>
|
64
|
+
|
65
|
+
<script>
|
66
|
+
window.addEventListener('WebComponentsReady', function(e) {
|
67
|
+
var app = document.querySelector('#app')
|
68
|
+
|
69
|
+
app.model = {
|
70
|
+
width:1000,
|
71
|
+
height: 1000,
|
72
|
+
components: [{
|
73
|
+
type: 'indoor-map',
|
74
|
+
left: 50,
|
75
|
+
top: 20,
|
76
|
+
width: 800,
|
77
|
+
height: 400,
|
78
|
+
fontSize: 80,
|
79
|
+
fontColor: '#000000',
|
80
|
+
lineWidth: 10,
|
81
|
+
activeIndex: 0,
|
82
|
+
components: [{
|
83
|
+
type: 'floor',
|
84
|
+
name: 'floor A',
|
85
|
+
fillStyle: 'orange',
|
86
|
+
width: 100,
|
87
|
+
height: 100,
|
88
|
+
depth: 100,
|
89
|
+
components: [{
|
90
|
+
type: 'beacon',
|
91
|
+
id: '1',
|
92
|
+
left: 0,
|
93
|
+
top: 0,
|
94
|
+
width: 100,
|
95
|
+
height: 100,
|
96
|
+
depth: 100,
|
97
|
+
fillStyle: 'red',
|
98
|
+
lineWidth: 4,
|
99
|
+
strokeStyle: 'black',
|
100
|
+
locked: true
|
101
|
+
}, {
|
102
|
+
type: 'beacon',
|
103
|
+
id: '2',
|
104
|
+
left: 100,
|
105
|
+
top: 300,
|
106
|
+
sheaf: 1,
|
107
|
+
width: 100,
|
108
|
+
height: 100,
|
109
|
+
depth: 100,
|
110
|
+
fillStyle: 'navy',
|
111
|
+
lineWidth: 1,
|
112
|
+
strokeStyle: 'black',
|
113
|
+
locked: true
|
114
|
+
}, {
|
115
|
+
type: 'beacon',
|
116
|
+
id: '3',
|
117
|
+
left: 200,
|
118
|
+
top: 0,
|
119
|
+
sheaf: 1,
|
120
|
+
width: 100,
|
121
|
+
height: 100,
|
122
|
+
depth: 100,
|
123
|
+
fillStyle: 'blue',
|
124
|
+
lineWidth: 4,
|
125
|
+
locked: true
|
126
|
+
}
|
127
|
+
, {
|
128
|
+
type: 'beacon',
|
129
|
+
id: '4',
|
130
|
+
left: 300,
|
131
|
+
top: 300,
|
132
|
+
sheaf: 1,
|
133
|
+
width: 100,
|
134
|
+
height: 100,
|
135
|
+
depth: 100,
|
136
|
+
fillStyle: 'blue',
|
137
|
+
lineWidth: 4,
|
138
|
+
locked: true
|
139
|
+
}, {
|
140
|
+
type: 'beacon',
|
141
|
+
id: '5',
|
142
|
+
left: 400,
|
143
|
+
top: 0,
|
144
|
+
sheaf: 1,
|
145
|
+
width: 100,
|
146
|
+
height: 100,
|
147
|
+
depth: 100,
|
148
|
+
fillStyle: 'blue',
|
149
|
+
lineWidth: 4,
|
150
|
+
locked: true
|
151
|
+
}, {
|
152
|
+
type: 'beacon',
|
153
|
+
id: '6',
|
154
|
+
left: 500,
|
155
|
+
top: 300,
|
156
|
+
sheaf: 1,
|
157
|
+
width: 100,
|
158
|
+
height: 100,
|
159
|
+
depth: 100,
|
160
|
+
fillStyle: 'blue',
|
161
|
+
lineWidth: 4,
|
162
|
+
locked: true
|
163
|
+
}, {
|
164
|
+
type: 'beacon',
|
165
|
+
id: '7',
|
166
|
+
left: 600,
|
167
|
+
top: 0,
|
168
|
+
sheaf: 1,
|
169
|
+
width: 100,
|
170
|
+
height: 100,
|
171
|
+
depth: 100,
|
172
|
+
fillStyle: 'blue',
|
173
|
+
lineWidth: 4,
|
174
|
+
locked: true
|
175
|
+
}
|
176
|
+
]
|
177
|
+
}]
|
178
|
+
}]
|
179
|
+
}
|
180
|
+
});
|
181
|
+
|
182
|
+
</script>
|
183
|
+
</body>
|
184
|
+
</html>
|
@@ -0,0 +1,96 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<!--
|
3
|
+
@license
|
4
|
+
Copyright © HatioLab Inc. All rights reserved.
|
5
|
+
-->
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<meta charset="utf-8">
|
9
|
+
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
10
|
+
<title>things-scene-indoor-map-properties Demo</title>
|
11
|
+
<script src="../../webcomponentsjs/webcomponents-lite.min.js"></script>
|
12
|
+
|
13
|
+
<link rel="import" href="../../things-scene-viewer/things-scene-viewer.html">
|
14
|
+
<link rel="import" href="../../things-scene-viewer/things-scene-layer.html">
|
15
|
+
<link rel="import" href="../../things-scene-viewer/things-scene-handler.html">
|
16
|
+
|
17
|
+
<link rel="import" href="../../things-designer-elements/things-editor-properties.html">
|
18
|
+
<link rel="import" href="../../things-designer-elements/things-editor-property.html">
|
19
|
+
|
20
|
+
<link rel="import" href="./things-scene-indoor-map.html">
|
21
|
+
|
22
|
+
</head>
|
23
|
+
<body unresolved>
|
24
|
+
|
25
|
+
<template is="dom-bind" id="app">
|
26
|
+
<style is="custom-style">
|
27
|
+
textarea {
|
28
|
+
width: 600px;
|
29
|
+
height: 300px;
|
30
|
+
}
|
31
|
+
|
32
|
+
#target {
|
33
|
+
width: 300px;
|
34
|
+
height: 300px;
|
35
|
+
background: var(--theme-color, red);
|
36
|
+
}
|
37
|
+
</style>
|
38
|
+
|
39
|
+
<p>An example of <code><things-scene-indoor-map-properties></code>:</p>
|
40
|
+
<div>
|
41
|
+
<textarea spellcheck="false">[[propertyValueText]]</textarea>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<things-editor-properties id="properties"
|
45
|
+
target="{{value}}"
|
46
|
+
props="[[props]]">
|
47
|
+
<div>
|
48
|
+
<div>
|
49
|
+
<span id='add-floor' on-click="addFloor">+</span>
|
50
|
+
</div>
|
51
|
+
|
52
|
+
<template is="dom-repeat" items="[[floors]]">
|
53
|
+
<div>
|
54
|
+
<span>[[item.name]]</span>
|
55
|
+
<span>-</span>
|
56
|
+
</div>
|
57
|
+
</template>
|
58
|
+
</div>
|
59
|
+
|
60
|
+
</things-editor-properties>
|
61
|
+
|
62
|
+
</template>
|
63
|
+
|
64
|
+
<script>
|
65
|
+
window.addEventListener('WebComponentsReady', function(e) {
|
66
|
+
var app = document.querySelector('#app')
|
67
|
+
|
68
|
+
app.props = scene.Component.register('indoor-map').nature.props
|
69
|
+
|
70
|
+
app.value = {
|
71
|
+
activeIndex: 0
|
72
|
+
}
|
73
|
+
|
74
|
+
app.floors = [{
|
75
|
+
name: 'B1'
|
76
|
+
}, {
|
77
|
+
name: '1F'
|
78
|
+
}, {
|
79
|
+
name: '2F'
|
80
|
+
}]
|
81
|
+
|
82
|
+
app.$.properties.addEventListener('change', function(e) {
|
83
|
+
app.propertyValueText = JSON.stringify(app.value, "null", "\t");
|
84
|
+
})
|
85
|
+
|
86
|
+
app.$.properties.fire('change');
|
87
|
+
|
88
|
+
setInterval(function() {
|
89
|
+
app.set("value.depth", app.value.depth + 1);
|
90
|
+
app.propertyValueText = JSON.stringify(app.value, "null", "\t");
|
91
|
+
}, 1000)
|
92
|
+
})
|
93
|
+
</script>
|
94
|
+
|
95
|
+
</body>
|
96
|
+
</html>
|