@operato/scene-tab 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@types/global/index.d.ts +1 -0
- package/CHANGELOG.md +11 -0
- package/LICENSE +21 -0
- package/README.md +33 -0
- package/assets/tab.png +0 -0
- package/demo/index.html +252 -0
- package/demo/things-scene-tab.html +5 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/tab-button.d.ts +18 -0
- package/dist/tab-button.js +78 -0
- package/dist/tab-button.js.map +1 -0
- package/dist/tab.d.ts +48 -0
- package/dist/tab.js +256 -0
- package/dist/tab.js.map +1 -0
- package/dist/templates/index.d.ts +20 -0
- package/dist/templates/index.js +3 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/templates/tab.d.ts +20 -0
- package/dist/templates/tab.js +21 -0
- package/dist/templates/tab.js.map +1 -0
- package/helps/scene/component/tab.ko.md +14 -0
- package/helps/scene/component/tab.md +13 -0
- package/helps/scene/component/tab.zh.md +13 -0
- package/helps/scene/images/container-04.png +0 -0
- package/images/icon-button.png +0 -0
- package/package.json +61 -0
- package/src/index.ts +4 -0
- package/src/tab-button.ts +100 -0
- package/src/tab.ts +328 -0
- package/src/templates/index.ts +3 -0
- package/src/templates/tab.ts +21 -0
- package/test/basic-test.html +67 -0
- package/test/index.html +22 -0
- package/things-scene.config.js +5 -0
- package/tsconfig.json +22 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare module '*.png'
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
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.22](https://github.com/things-scene/operato-scene/compare/v0.0.21...v0.0.22) (2021-12-14)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### :rocket: New Features
|
|
10
|
+
|
|
11
|
+
* add @operato/scene-tab ([0f52fcf](https://github.com/things-scene/operato-scene/commit/0f52fcf6374426474afa3afde702f52cdd13a2cf))
|
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,33 @@
|
|
|
1
|
+
# things-scene-tab
|
|
2
|
+
|
|
3
|
+
## node package를 설치한다.
|
|
4
|
+
|
|
5
|
+
`$ yarn`
|
|
6
|
+
|
|
7
|
+
## 실행
|
|
8
|
+
|
|
9
|
+
`$ yarn serve`
|
|
10
|
+
`$ yarn serve:dev`
|
|
11
|
+
|
|
12
|
+
## 포트를 바꾸려면, -p 3001 식으로 추가해준다.
|
|
13
|
+
|
|
14
|
+
`$ yarn serve`
|
|
15
|
+
`$ yarn serve -p 3001`
|
|
16
|
+
|
|
17
|
+
## test in browser
|
|
18
|
+
|
|
19
|
+
http://localhost:3000
|
|
20
|
+
|
|
21
|
+
## build
|
|
22
|
+
|
|
23
|
+
`$ yarn build`
|
|
24
|
+
|
|
25
|
+
| type | filename | for | tested |
|
|
26
|
+
| ---- | ---------------------- | -------------- | ------ |
|
|
27
|
+
| UMD | things-scene-tab.js | modern browser | 0 |
|
|
28
|
+
| UMD | things-scene-tab-ie.js | ie 11 | 0 |
|
|
29
|
+
| ESM | things-scene-tab.mjs | modern browser | 0 |
|
|
30
|
+
|
|
31
|
+
## publish
|
|
32
|
+
|
|
33
|
+
`$ yarn publish`
|
package/assets/tab.png
ADDED
|
Binary file
|
package/demo/index.html
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
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-tab 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-indoor-map/things-scene-indoor-map.html">
|
|
15
|
+
<link rel="import" href="../../things-scene-modeler/things-scene-properties.html">
|
|
16
|
+
|
|
17
|
+
<script src="../things-scene-tab.js"></script>
|
|
18
|
+
|
|
19
|
+
<style is="custom-style">
|
|
20
|
+
|
|
21
|
+
@font-face {
|
|
22
|
+
font-family: "Bitstream Vera Serif Bold";
|
|
23
|
+
src: url("fonts/VeraSeBd.ttf");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
things-scene-viewer {
|
|
27
|
+
display: block;
|
|
28
|
+
width: 100%;
|
|
29
|
+
height: 560px;
|
|
30
|
+
}
|
|
31
|
+
</style>
|
|
32
|
+
</head>
|
|
33
|
+
<body unresolved>
|
|
34
|
+
|
|
35
|
+
<template is="dom-bind" id="app">
|
|
36
|
+
<p>An example of <code><things-scene-tab></code>:</p>
|
|
37
|
+
|
|
38
|
+
<things-scene-viewer id='scene'
|
|
39
|
+
scene='{{scene}}'
|
|
40
|
+
selected='{{selected}}'
|
|
41
|
+
model='[[model]]'
|
|
42
|
+
mode="1">
|
|
43
|
+
<things-scene-layer type="selection-layer"></things-scene-layer>
|
|
44
|
+
<things-scene-layer type="modeling-layer"></things-scene-layer>
|
|
45
|
+
<things-scene-handler type="text-editor"></things-scene-handler>
|
|
46
|
+
<things-scene-handler type="move-handler"></things-scene-handler>
|
|
47
|
+
</things-scene-viewer>
|
|
48
|
+
|
|
49
|
+
<things-scene-properties scene="[[scene]]"
|
|
50
|
+
selected="[[selected]]"
|
|
51
|
+
model="{{target}}"
|
|
52
|
+
bounds="{{bounds}}">
|
|
53
|
+
<fieldset class="same-width">
|
|
54
|
+
<legend>Stack style</legend>
|
|
55
|
+
|
|
56
|
+
<label>Active Floor</label>
|
|
57
|
+
<input type="number" value-as-number="{{target.layoutConfig.activeIndex::change}}" min="0" max="100" step="1" numberonly="true" />
|
|
58
|
+
|
|
59
|
+
<label>reference</label>
|
|
60
|
+
<input type="text" value="{{target.reference::change}}" />
|
|
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: 500,
|
|
73
|
+
height: 500,
|
|
74
|
+
components: [{
|
|
75
|
+
type: 'tab',
|
|
76
|
+
reference: 'indoor-map',
|
|
77
|
+
left: 100,
|
|
78
|
+
top: 100,
|
|
79
|
+
width: 100,
|
|
80
|
+
height: 400,
|
|
81
|
+
lineWidth: 10,
|
|
82
|
+
// lineWidth: 0,
|
|
83
|
+
fillStyle: 'navy',
|
|
84
|
+
strokeStyle: 'red',
|
|
85
|
+
activeFillStyle: 'red',
|
|
86
|
+
fontColor: 'black',
|
|
87
|
+
activeFontColor: 'white',
|
|
88
|
+
activeIndex: 2
|
|
89
|
+
}, {
|
|
90
|
+
type: 'indoor-map',
|
|
91
|
+
id: 'indoor-map',
|
|
92
|
+
left: 250,
|
|
93
|
+
top: 100,
|
|
94
|
+
width: 600,
|
|
95
|
+
height: 400,
|
|
96
|
+
fontSize: 80,
|
|
97
|
+
fontColor: '#000000',
|
|
98
|
+
lineWidth: 10,
|
|
99
|
+
strokeStyle: 'red',
|
|
100
|
+
active: 0,
|
|
101
|
+
components: [{
|
|
102
|
+
type: 'floor',
|
|
103
|
+
fillStyle: 'orange',
|
|
104
|
+
width: 100,
|
|
105
|
+
height: 100,
|
|
106
|
+
text: 'first',
|
|
107
|
+
components: [{
|
|
108
|
+
type: 'rect',
|
|
109
|
+
left: 100,
|
|
110
|
+
top: 220,
|
|
111
|
+
width: 100,
|
|
112
|
+
height: 100,
|
|
113
|
+
fillStyle: 'red',
|
|
114
|
+
lineWidth: 4
|
|
115
|
+
}, {
|
|
116
|
+
type: 'ellipse',
|
|
117
|
+
cx: 400,
|
|
118
|
+
cy: 200,
|
|
119
|
+
rx: 100,
|
|
120
|
+
ry: 100,
|
|
121
|
+
fillStyle: 'blue',
|
|
122
|
+
lineWidth: 4
|
|
123
|
+
}, {
|
|
124
|
+
type: 'polygon',
|
|
125
|
+
path: [{
|
|
126
|
+
x: 100,
|
|
127
|
+
y: 100
|
|
128
|
+
}, {
|
|
129
|
+
x: 200,
|
|
130
|
+
y: 150
|
|
131
|
+
}, {
|
|
132
|
+
x: 150,
|
|
133
|
+
y: 200
|
|
134
|
+
}],
|
|
135
|
+
fillStyle: 'blue',
|
|
136
|
+
lineWidth: 4
|
|
137
|
+
}]
|
|
138
|
+
}, {
|
|
139
|
+
type: 'floor',
|
|
140
|
+
fillStyle: 'navy',
|
|
141
|
+
width: 100,
|
|
142
|
+
height: 100,
|
|
143
|
+
components: [{
|
|
144
|
+
type: 'rect',
|
|
145
|
+
left: 100,
|
|
146
|
+
top: 220,
|
|
147
|
+
width: 100,
|
|
148
|
+
height: 100,
|
|
149
|
+
fillStyle: 'red',
|
|
150
|
+
lineWidth: 4
|
|
151
|
+
}, {
|
|
152
|
+
type: 'ellipse',
|
|
153
|
+
cx: 400,
|
|
154
|
+
cy: 200,
|
|
155
|
+
rx: 100,
|
|
156
|
+
ry: 100,
|
|
157
|
+
fillStyle: 'blue',
|
|
158
|
+
lineWidth: 4
|
|
159
|
+
}, {
|
|
160
|
+
type: 'polygon',
|
|
161
|
+
path: [{
|
|
162
|
+
x: 100,
|
|
163
|
+
y: 100
|
|
164
|
+
}, {
|
|
165
|
+
x: 200,
|
|
166
|
+
y: 150
|
|
167
|
+
}, {
|
|
168
|
+
x: 150,
|
|
169
|
+
y: 200
|
|
170
|
+
}],
|
|
171
|
+
fillStyle: 'blue',
|
|
172
|
+
lineWidth: 4
|
|
173
|
+
}]
|
|
174
|
+
}, {
|
|
175
|
+
type: 'floor',
|
|
176
|
+
fillStyle: 'black',
|
|
177
|
+
width: 100,
|
|
178
|
+
height: 100,
|
|
179
|
+
components: [{
|
|
180
|
+
type: 'rect',
|
|
181
|
+
left: 100,
|
|
182
|
+
top: 220,
|
|
183
|
+
width: 100,
|
|
184
|
+
height: 100,
|
|
185
|
+
fillStyle: 'red',
|
|
186
|
+
lineWidth: 4
|
|
187
|
+
}, {
|
|
188
|
+
type: 'ellipse',
|
|
189
|
+
cx: 400,
|
|
190
|
+
cy: 200,
|
|
191
|
+
rx: 100,
|
|
192
|
+
ry: 100,
|
|
193
|
+
fillStyle: 'blue',
|
|
194
|
+
lineWidth: 4
|
|
195
|
+
}, {
|
|
196
|
+
type: 'polygon',
|
|
197
|
+
path: [{
|
|
198
|
+
x: 100,
|
|
199
|
+
y: 100
|
|
200
|
+
}, {
|
|
201
|
+
x: 200,
|
|
202
|
+
y: 150
|
|
203
|
+
}, {
|
|
204
|
+
x: 150,
|
|
205
|
+
y: 200
|
|
206
|
+
}],
|
|
207
|
+
fillStyle: 'blue',
|
|
208
|
+
lineWidth: 4
|
|
209
|
+
}]
|
|
210
|
+
}, {
|
|
211
|
+
type: 'floor',
|
|
212
|
+
fillStyle: 'green',
|
|
213
|
+
width: 100,
|
|
214
|
+
height: 100,
|
|
215
|
+
components: [{
|
|
216
|
+
type: 'rect',
|
|
217
|
+
left: 100,
|
|
218
|
+
top: 220,
|
|
219
|
+
width: 100,
|
|
220
|
+
height: 100,
|
|
221
|
+
fillStyle: 'red',
|
|
222
|
+
lineWidth: 4
|
|
223
|
+
}, {
|
|
224
|
+
type: 'ellipse',
|
|
225
|
+
cx: 400,
|
|
226
|
+
cy: 200,
|
|
227
|
+
rx: 100,
|
|
228
|
+
ry: 100,
|
|
229
|
+
fillStyle: 'blue',
|
|
230
|
+
lineWidth: 4
|
|
231
|
+
}, {
|
|
232
|
+
type: 'polygon',
|
|
233
|
+
path: [{
|
|
234
|
+
x: 100,
|
|
235
|
+
y: 100
|
|
236
|
+
}, {
|
|
237
|
+
x: 200,
|
|
238
|
+
y: 150
|
|
239
|
+
}, {
|
|
240
|
+
x: 150,
|
|
241
|
+
y: 200
|
|
242
|
+
}],
|
|
243
|
+
fillStyle: 'blue',
|
|
244
|
+
lineWidth: 4
|
|
245
|
+
}]
|
|
246
|
+
}]
|
|
247
|
+
}]
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
</script>
|
|
251
|
+
</body>
|
|
252
|
+
</html>
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Tab } from './tab';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,OAAO,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\nexport { default as Tab } from './tab'\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Component, State } from '@hatiolab/things-scene';
|
|
2
|
+
import Tab from './tab';
|
|
3
|
+
declare const TabButton_base: typeof Component;
|
|
4
|
+
export default class TabButton extends TabButton_base {
|
|
5
|
+
get index(): any;
|
|
6
|
+
get activated(): boolean;
|
|
7
|
+
removed(parent: Tab): void;
|
|
8
|
+
private _fillStyle?;
|
|
9
|
+
private _fontColor?;
|
|
10
|
+
private _strokeStyle?;
|
|
11
|
+
private _lineWidth?;
|
|
12
|
+
prerender(context: CanvasRenderingContext2D): void;
|
|
13
|
+
render(context: CanvasRenderingContext2D): void;
|
|
14
|
+
postrender(context: CanvasRenderingContext2D): void;
|
|
15
|
+
onclick(e: MouseEvent): void;
|
|
16
|
+
onchange(after: State): void;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { Component, RectPath } from '@hatiolab/things-scene';
|
|
5
|
+
export default class TabButton extends RectPath(Component) {
|
|
6
|
+
get index() {
|
|
7
|
+
return this.model.index;
|
|
8
|
+
}
|
|
9
|
+
get activated() {
|
|
10
|
+
return this.parent.activeIndex === this.index;
|
|
11
|
+
}
|
|
12
|
+
removed(parent) {
|
|
13
|
+
this.dispose();
|
|
14
|
+
}
|
|
15
|
+
prerender(context) {
|
|
16
|
+
super.prerender(context);
|
|
17
|
+
let { fillStyle, activeFillStyle, activeLineColor, activeLineWidth, fontColor, activeFontColor } = this.model;
|
|
18
|
+
// backup style
|
|
19
|
+
if (!this.hasOwnProperty('_fillStyle')) {
|
|
20
|
+
this._fillStyle = fillStyle;
|
|
21
|
+
}
|
|
22
|
+
if (!this.hasOwnProperty('_fontColor')) {
|
|
23
|
+
this._fontColor = fontColor;
|
|
24
|
+
}
|
|
25
|
+
if (this.activated) {
|
|
26
|
+
this.model.fillStyle = activeFillStyle;
|
|
27
|
+
this.model.fontColor = activeFontColor;
|
|
28
|
+
this.model.strokeStyle = activeLineColor;
|
|
29
|
+
this.model.lineWidth = activeLineWidth;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
this.model.fillStyle = this._fillStyle;
|
|
33
|
+
this.model.fontColor = this._fontColor;
|
|
34
|
+
this.model.strokeStyle = this._strokeStyle;
|
|
35
|
+
this.model.lineWidth = this._lineWidth;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
render(context) {
|
|
39
|
+
var { left = 0, top = 0, width, height } = this.bounds;
|
|
40
|
+
// 컨테이너의 바운드를 표현한다.(컨테이너의 기본 그리기 기능)
|
|
41
|
+
context.beginPath();
|
|
42
|
+
context.rect(left, top, width, height);
|
|
43
|
+
this.drawFill(context);
|
|
44
|
+
this.drawStroke(context);
|
|
45
|
+
}
|
|
46
|
+
postrender(context) {
|
|
47
|
+
super.postrender(context);
|
|
48
|
+
// restore style
|
|
49
|
+
this.model.fillStyle = this._fillStyle;
|
|
50
|
+
this.model.fontColor = this._fontColor;
|
|
51
|
+
this.model.strokeStyle = this._strokeStyle;
|
|
52
|
+
this.model.lineWidth = this._lineWidth;
|
|
53
|
+
delete this._fillStyle;
|
|
54
|
+
delete this._fontColor;
|
|
55
|
+
delete this._strokeStyle;
|
|
56
|
+
delete this._lineWidth;
|
|
57
|
+
}
|
|
58
|
+
onclick(e) {
|
|
59
|
+
this.parent.activeIndex = this.index;
|
|
60
|
+
this.parent.invalidate();
|
|
61
|
+
}
|
|
62
|
+
onchange(after) {
|
|
63
|
+
if (after.hasOwnProperty('fillStyle'))
|
|
64
|
+
this._fillStyle = after.fillStyle;
|
|
65
|
+
if (after.hasOwnProperty('fontColor'))
|
|
66
|
+
this._fontColor = after.fontColor;
|
|
67
|
+
if (after.hasOwnProperty('strokeStyle'))
|
|
68
|
+
this._fontColor = after.fontColor;
|
|
69
|
+
if (after.hasOwnProperty('lineWidth'))
|
|
70
|
+
this._fontColor = after.fontColor;
|
|
71
|
+
if (after.hasOwnProperty('text')) {
|
|
72
|
+
this.parent.reference.getAt(this.index).set('text', after.text);
|
|
73
|
+
}
|
|
74
|
+
this.invalidate();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
Component.register('tab-button', TabButton);
|
|
78
|
+
//# sourceMappingURL=tab-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tab-button.js","sourceRoot":"","sources":["../src/tab-button.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAS,MAAM,wBAAwB,CAAA;AAInE,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,QAAQ,CAAC,SAAS,CAAC;IACxD,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAA;IACzB,CAAC;IAED,IAAI,SAAS;QACX,OAAQ,IAAI,CAAC,MAAc,CAAC,WAAW,KAAK,IAAI,CAAC,KAAK,CAAA;IACxD,CAAC;IAED,OAAO,CAAC,MAAW;QACjB,IAAI,CAAC,OAAO,EAAE,CAAA;IAChB,CAAC;IAOD,SAAS,CAAC,OAAiC;QACzC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;QACxB,IAAI,EAAE,SAAS,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,SAAS,EAAE,eAAe,EAAE,GAAG,IAAI,CAAC,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C,CAAA;SACzE;QAED,IAAI,CAAC,UAAU,EAAE,CAAA;IACnB,CAAC;CACF;AAED,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,SAAS,CAAC,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\nimport { Component, RectPath, State } from '@hatiolab/things-scene'\n\nimport Tab from './tab'\n\nexport default class TabButton extends RectPath(Component) {\n get index() {\n return this.model.index\n }\n\n get activated() {\n return (this.parent as Tab).activeIndex === this.index\n }\n\n removed(parent: Tab) {\n this.dispose()\n }\n\n private _fillStyle?: string\n private _fontColor?: string\n private _strokeStyle?: string\n private _lineWidth?: string\n\n prerender(context: CanvasRenderingContext2D) {\n super.prerender(context)\n let { fillStyle, activeFillStyle, activeLineColor, activeLineWidth, fontColor, activeFontColor } = this.model\n\n // backup style\n if (!this.hasOwnProperty('_fillStyle')) {\n this._fillStyle = fillStyle\n }\n if (!this.hasOwnProperty('_fontColor')) {\n this._fontColor = fontColor\n }\n\n if (this.activated) {\n this.model.fillStyle = activeFillStyle\n this.model.fontColor = activeFontColor\n this.model.strokeStyle = activeLineColor\n this.model.lineWidth = activeLineWidth\n } else {\n this.model.fillStyle = this._fillStyle\n this.model.fontColor = this._fontColor\n this.model.strokeStyle = this._strokeStyle\n this.model.lineWidth = this._lineWidth\n }\n }\n\n render(context: CanvasRenderingContext2D) {\n var { left = 0, top = 0, width, height } = this.bounds\n\n // 컨테이너의 바운드를 표현한다.(컨테이너의 기본 그리기 기능)\n context.beginPath()\n\n context.rect(left, top, width, height)\n\n this.drawFill(context)\n this.drawStroke(context)\n }\n\n postrender(context: CanvasRenderingContext2D) {\n super.postrender(context)\n\n // restore style\n this.model.fillStyle = this._fillStyle\n this.model.fontColor = this._fontColor\n this.model.strokeStyle = this._strokeStyle\n this.model.lineWidth = this._lineWidth\n\n delete this._fillStyle\n delete this._fontColor\n delete this._strokeStyle\n delete this._lineWidth\n }\n\n onclick(e: MouseEvent) {\n (this.parent as Tab).activeIndex = this.index\n this.parent.invalidate()\n }\n\n onchange(after: State) {\n if (after.hasOwnProperty('fillStyle')) this._fillStyle = after.fillStyle\n\n if (after.hasOwnProperty('fontColor')) this._fontColor = after.fontColor\n\n if (after.hasOwnProperty('strokeStyle')) this._fontColor = after.fontColor\n\n if (after.hasOwnProperty('lineWidth')) this._fontColor = after.fontColor\n\n if (after.hasOwnProperty('text')) {\n (this.parent as Tab).reference.getAt(this.index).set('text', after.text)\n }\n\n this.invalidate()\n }\n}\n\nComponent.register('tab-button', TabButton)\n"]}
|
package/dist/tab.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Container, State, Style } from '@hatiolab/things-scene';
|
|
2
|
+
export default class Tab extends Container {
|
|
3
|
+
get layout(): import("@hatiolab/things-scene").LAYOUT;
|
|
4
|
+
get nature(): {
|
|
5
|
+
mutable: boolean;
|
|
6
|
+
resizable: boolean;
|
|
7
|
+
rotatable: boolean;
|
|
8
|
+
properties: ({
|
|
9
|
+
type: string;
|
|
10
|
+
label: string;
|
|
11
|
+
name: string;
|
|
12
|
+
property: {
|
|
13
|
+
component: string;
|
|
14
|
+
min?: undefined;
|
|
15
|
+
step?: undefined;
|
|
16
|
+
};
|
|
17
|
+
} | {
|
|
18
|
+
type: string;
|
|
19
|
+
label: string;
|
|
20
|
+
name: string;
|
|
21
|
+
property: {
|
|
22
|
+
min: number;
|
|
23
|
+
step: number;
|
|
24
|
+
component?: undefined;
|
|
25
|
+
};
|
|
26
|
+
} | {
|
|
27
|
+
type: string;
|
|
28
|
+
label: string;
|
|
29
|
+
name: string;
|
|
30
|
+
property: string;
|
|
31
|
+
})[];
|
|
32
|
+
};
|
|
33
|
+
get focusible(): boolean;
|
|
34
|
+
get reference(): any;
|
|
35
|
+
get labelHeight(): any;
|
|
36
|
+
get activeIndex(): any;
|
|
37
|
+
private _reference;
|
|
38
|
+
set reference(reference: any);
|
|
39
|
+
set activeIndex(index: any);
|
|
40
|
+
render(context: CanvasRenderingContext2D): void;
|
|
41
|
+
postrender(context: CanvasRenderingContext2D): void;
|
|
42
|
+
contains(x: number, y: number): boolean;
|
|
43
|
+
dispose(): void;
|
|
44
|
+
rebuildTabButtons(): void;
|
|
45
|
+
setTabButtonsStyle(style: Style): void;
|
|
46
|
+
onRefChanged(after: any, before: any, hint: any): void;
|
|
47
|
+
onchange(after: State, before: State): void;
|
|
48
|
+
}
|