Skip to content

Commit accbc87

Browse files
Add container type to the documentation
1 parent b8688e6 commit accbc87

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

docs/documentation.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ You can use mathics-threejs-backend in 2 ways:
2828
```
2929

3030
The main function of mathics-threejs-backend is `drawGraphics3d`, takes the following arguments:
31-
- `container` (type: HTMLElement)
31+
- `container` (type: [container](/mathics-threejs-backend/types/container))
3232
- `data` (type: object) — object with the following properties:
3333
- `autoRescale` (type: bool) — whether the plot should be rescaled after spin. Default: `true`
3434
- `axes` (type: object) — default: `{}`, object with the following properties:
@@ -46,8 +46,6 @@ The main function of mathics-threejs-backend is `drawGraphics3d`, takes the foll
4646
- `lighting` (type: [element[]](/mathics-threejs-backend/types/element)) — array of lights, default: `[]`
4747
- `viewpoint` (type: number[3]) — the normalized camera coordinate (normalized means that the coordinate is going to be scaled, e.g. `[1, 1, 1]` is the upper back right corner of the bounding box independently from its size). Default: `[1.3, -2.4, 2]`
4848
- `protocol` (type: string) — protocol version (current is `1.2`), if it isn't compatible a warning is shown instead of the graphics. Only availiable in production version
49-
- `maxSize` (type: number) — default: `400`
50-
- `innerWidthMultiplier` (type: number) — the multiplier of the window inner width, the effective width is `min(maxSize, innerWidthMultiplier * window.innerWidth)`, default: `0.65`
5149

5250
## Examples
5351
- ```js
@@ -160,9 +158,3 @@ The main function of mathics-threejs-backend is `drawGraphics3d`, takes the foll
160158
{ viewpoint: [2, -4, 4] }
161159
);
162160
</script>
163-
164-
## Notes
165-
- Currently the axes labels are drawn using HTML elements with
166-
`position: absolute` so the graphics container must have
167-
`position: relative` if you want to draw the axes labels and the
168-
container is not the unique element in the page.

docs/types/container.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
A HTML element obtained with `document.getElementById` or similars.
2+
3+
The canvas will occupy the whole container.
4+
5+
The following CSS properties are added if necessary:
6+
- `display` - default: `block`
7+
- `max-width` — default: `400px`
8+
- `width` — default: `65vw`
9+
- `max-height` — default: `400px`
10+
- `height` — default: `65vw` (yes, `vw` not `vh`)
11+
- `padding-top` — default: `5px`
12+
- `padding-bottom` — default: `5px`
13+
- `position` — default: `relative`
14+
15+
## Notes
16+
- Currently the axes labels are drawn using HTML elements with
17+
`position: absolute` so the graphics container must have
18+
`position: relative` if you want to draw the axes labels.

0 commit comments

Comments
 (0)