@operato/scene-basic 8.0.0-beta.1 → 8.0.0

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/src/text.ts DELETED
@@ -1,12 +0,0 @@
1
- /*
2
- * Copyright © HatioLab Inc. All rights reserved.
3
- */
4
- import { Component, RectPath } from '@hatiolab/things-scene'
5
-
6
- export default class Text extends RectPath(Component) {
7
- is3dish() {
8
- return true
9
- }
10
- }
11
-
12
- Component.register('text', Text)
package/src/triangle.ts DELETED
@@ -1,87 +0,0 @@
1
- /*
2
- * Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- import { Component, ComponentNature, Shape } from '@hatiolab/things-scene'
6
-
7
- const NATURE: ComponentNature = {
8
- mutable: true,
9
- resizable: false,
10
- rotatable: true,
11
- properties: [
12
- {
13
- type: 'number',
14
- label: 'round',
15
- name: 'round',
16
- property: {
17
- min: 0,
18
- max: 100,
19
- step: 1
20
- }
21
- }
22
- ],
23
- help: 'scene/component/triangle'
24
- }
25
-
26
- export default class Triangle extends Shape {
27
- contains(x: number, y: number) {
28
- var { x1, y1, x2, y2, x3, y3 } = this.state
29
- var path = [x1, y1, x2, y2, x3, y3]
30
-
31
- var result = false
32
-
33
- for (let i = 0; i < path.length; i += 2) {
34
- let j = (i + 2) % path.length
35
- let x1 = path[i]
36
- let y1 = path[i + 1]
37
- let x2 = path[j]
38
- let y2 = path[j + 1]
39
-
40
- if (y1 > y != y2 > y && x < ((x2 - x1) * (y - y1)) / (y2 - y1) + x1) result = !result
41
- }
42
-
43
- return result
44
- }
45
-
46
- get mutable() {
47
- return true
48
- }
49
-
50
- get path() {
51
- var { x1, y1, x2, y2, x3, y3 } = this.state
52
-
53
- return [
54
- {
55
- x: x1,
56
- y: y1
57
- },
58
- {
59
- x: x2,
60
- y: y2
61
- },
62
- {
63
- x: x3,
64
- y: y3
65
- }
66
- ]
67
- }
68
-
69
- set path(path) {
70
- this.set({
71
- x1: path[0].x,
72
- y1: path[0].y,
73
- x2: path[1].x,
74
- y2: path[1].y,
75
- x3: path[2].x,
76
- y3: path[2].y
77
- })
78
- }
79
-
80
- get nature(): ComponentNature {
81
- return NATURE
82
- }
83
- }
84
-
85
- Component.memoize(Triangle.prototype, 'path', false)
86
-
87
- Component.register('triangle', Triangle)
@@ -1,63 +0,0 @@
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
-
11
- <script src="../../webcomponentsjs/webcomponents-lite.js"></script>
12
- <script src="../../web-component-tester/browser.js"></script>
13
-
14
- <!-- Step 1: import the element to test -->
15
- <link rel="import" href="../things-scene-basic.html" />
16
- </head>
17
- <body>
18
- <!-- You can use the document as a place to set up your fixtures. -->
19
- <test-fixture id="things-scene-basic-fixture">
20
- <template>
21
- <things-scene-basic>
22
- <h2>things-scene-basic</h2>
23
- </things-scene-basic>
24
- </template>
25
- </test-fixture>
26
-
27
- <script>
28
- suite('<things-scene-basic>', function () {
29
- var myEl
30
-
31
- setup(function () {
32
- myEl = fixture('things-scene-basic-fixture')
33
- })
34
-
35
- test('defines the "author" property', function () {
36
- assert.equal(myEl.author.name, 'Dimitri Glazkov')
37
- assert.equal(myEl.author.image, 'http://addyosmani.com/blog/wp-content/uploads/2013/04/unicorn.jpg')
38
- })
39
-
40
- test('says hello', function () {
41
- assert.equal(myEl.sayHello(), 'things-scene-basic says, Hello World!')
42
-
43
- var greetings = myEl.sayHello('greetings Earthlings')
44
- assert.equal(greetings, 'things-scene-basic says, greetings Earthlings')
45
- })
46
-
47
- test('fires lasers', function (done) {
48
- myEl.addEventListener('things-scene-basic-lasers', function (event) {
49
- assert.equal(event.detail.sound, 'Pew pew!')
50
- done()
51
- })
52
- myEl.fireLasers()
53
- })
54
-
55
- test('distributed children', function () {
56
- var els = myEl.getContentChildren()
57
- assert.equal(els.length, 1, 'one distributed node')
58
- assert.equal(els[0], myEl.querySelector('h2'), 'content distributed correctly')
59
- })
60
- })
61
- </script>
62
- </body>
63
- </html>
package/test/index.html DELETED
@@ -1,22 +0,0 @@
1
- <!doctype html>
2
- <!--
3
- @license
4
- Copyright © HatioLab Inc. All rights reserved.
5
- -->
6
- <html><head>
7
- <meta charset="utf-8">
8
- <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
9
-
10
- <script src="../../webcomponentsjs/webcomponents-lite.js"></script>
11
- <script src="../../web-component-tester/browser.js"></script>
12
- </head>
13
- <body>
14
- <script>
15
- // Load and run all tests (.html, .js):
16
- WCT.loadSuites([
17
- 'basic-test.html',
18
- 'basic-test.html?dom=shadow'
19
- ]);
20
- </script>
21
-
22
- </body></html>
package/tsconfig.json DELETED
@@ -1,23 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "es2018",
4
- "module": "esnext",
5
- "moduleResolution": "node",
6
- "noEmitOnError": true,
7
- "lib": ["es2019", "dom"],
8
- "strict": true,
9
- "esModuleInterop": false,
10
- "allowJs": true,
11
- "allowSyntheticDefaultImports": true,
12
- "experimentalDecorators": true,
13
- "importHelpers": true,
14
- "outDir": "dist",
15
- "sourceMap": true,
16
- "inlineSources": true,
17
- "rootDir": "src",
18
- "declaration": true,
19
- "incremental": true,
20
- "skipLibCheck": true
21
- },
22
- "include": ["**/*.ts", "*.d.ts"]
23
- }