├── .gitignore
├── LICENSE
├── README.md
├── dist
├── build.js
└── examples
│ ├── assets
│ ├── aframe.png
│ ├── box.png
│ ├── floor.png
│ ├── github.png
│ └── npm.png
│ └── index.html
├── examples
├── assets
│ ├── aframe.png
│ ├── box.png
│ ├── floor.png
│ ├── github.png
│ └── npm.png
└── index.html
├── index.js
├── package-lock.json
├── package.json
├── src
├── aframe-htmlembed-component.js
└── htmlcanvas.js
└── webpack.config.js
/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 |
8 | # Runtime data
9 | pids
10 | *.pid
11 | *.seed
12 | *.pid.lock
13 |
14 | # Directory for instrumented libs generated by jscoverage/JSCover
15 | lib-cov
16 |
17 | # Coverage directory used by tools like istanbul
18 | coverage
19 |
20 | # nyc test coverage
21 | .nyc_output
22 |
23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
24 | .grunt
25 |
26 | # Bower dependency directory (https://bower.io/)
27 | bower_components
28 |
29 | # node-waf configuration
30 | .lock-wscript
31 |
32 | # Compiled binary addons (https://nodejs.org/api/addons.html)
33 | build/Release
34 |
35 | # Dependency directories
36 | node_modules/
37 | jspm_packages/
38 |
39 | # TypeScript v1 declaration files
40 | typings/
41 |
42 | # Optional npm cache directory
43 | .npm
44 |
45 | # Optional eslint cache
46 | .eslintcache
47 |
48 | # Optional REPL history
49 | .node_repl_history
50 |
51 | # Output of 'npm pack'
52 | *.tgz
53 |
54 | # Yarn Integrity file
55 | .yarn-integrity
56 |
57 | # dotenv environment variables file
58 | .env
59 |
60 | # next.js build output
61 | .next
62 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2019 Paul Brunt
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 |
5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | # HTML Embed Component
3 |
4 | HTML Embed is a component created for [A-Frame](https://aframe.io/). The HTML Embed component allows for arbitrary html to be inserted into your aframe scene. It allows you to update the display within A-Frame simply by manipulating the DOM as you normally would.
5 |
6 | In addition to rendering the html to the A-Frame scene it allows for interaction. Most css pseudo selectors such as hover, active, focus and target should work with interactivity enabled without any modifications to your css. Mouse events can be attached to the html elements as usual.
7 |
8 | ## Limitations
9 |
10 | * All styles and images must be in the same origin or allow access via CORS; this allows the component to embed all of the assets required to render the html properly to the canvas via the foreignObject element.
11 | * transform-style css is limited to flat. This is mainly due to it not being rendered properly to canvas so element bounding for preserve-3d has not yet been implemented. If the rendering is fixed as some point I may go back and get it working as well.
12 | * "a-" tags do not render correctly as XHTML embeded into SVG, so any parent "a-" elements of the embed html will be converted to div tags for rendering. This may mean your css will require modification.
13 | * Elements that require rendering outside of the DOM such as the iframe and canvas element will not work.
14 | * :before and :after pseudo elements can't be accessed via the DOM so they can't be used in the element to determine the object bounds. As such, use them with caution.
15 | * Form elements are not consistently rendered to the canvas element so some basic default styles are included for consistency.
16 | * Currently there is no support for css transitions.
17 |
18 |
19 | ## Properties
20 | | Property | Default | Description |
21 | |----------|---------|-------------|
22 | | ppu | 256 | number of pixels to display per unit of the aframescene. |
23 |
24 | ## Methods
25 |
26 | | Method | Description |
27 | |--------|-------------|
28 | | forceRender | Forces the htmlembed component to be re-render |
29 |
30 |
31 | ## Events
32 |
33 | | Name | Event Type | Description |
34 | |------|-------|-------------|
35 | |focusableenter | [FocusableEvent](#focusablervent) | Dispatched when the cursor is moved over a focusable element. Useful for providing visual/haptic feedback to the user letting them know that the element is clickable. |
36 | | focusableleave | [FocusableEvent](#focusablervent) | Dispatched when the cursor is moved out of a focusable element. |
37 | | inputrequired | [InputrequiredEvent](#inputrequiredevent) | Dispatched when an element that requires keyboard input or a user selection is clicked. Can be used to bring up a custom keyboard. |
38 | | resized | N/A | Dispatched when the embed html content size is changed. |
39 | | rendered | N/A | Dispatched when the embedded HTML content is rendered to the A-Frame Scene. |
40 |
41 | ### FocusableEvent
42 |
43 | | Property | Description |
44 | |----------|-------------|
45 | | target | The target element that the cursor is over. |
46 |
47 | ### InputrequiredEvent
48 |
49 | | Property | Description |
50 | |----------|-------------|
51 | | target | The input element that the user selected. ||
52 |
53 |
54 | ## How to Use
55 |
56 | To use the component you just add the component to the A-Frame entity containing the html. For example:
57 | ```html
58 | Lorem ipsum dolor sit amet, consectetur adipiscing elit.An Example
61 |
63 |
My HTML
128 |