Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
plegner committed Aug 28, 2023
1 parent 3d091f5 commit 3d8e00e
Show file tree
Hide file tree
Showing 10 changed files with 97 additions and 29 deletions.
2 changes: 1 addition & 1 deletion acknowledgements.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
layout: page
nav_order: 9
description: todo
description: Acknowledgements
---

# Acknowledgements
Expand Down
2 changes: 1 addition & 1 deletion boost/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
layout: page
nav_order: 5
has_children: true
description: todo
description: Boost.js API Docs
title: Boost.js
---

Expand Down
2 changes: 1 addition & 1 deletion contributing.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
layout: page
nav_order: 8
description: todo
description: Contributing
---

# Contributing
Expand Down
2 changes: 1 addition & 1 deletion euclid/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
layout: page
nav_order: 3
has_children: true
description: todo
description: Euclid.js API Docs
---

# Euclid.js
Expand Down
2 changes: 1 addition & 1 deletion fermat/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
layout: page
nav_order: 2
has_children: true
description: todo
description: Fermat.js API Docs
---

# Fermat.js
Expand Down
2 changes: 1 addition & 1 deletion hilbert/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
layout: page
nav_order: 4
has_children: true
description: todo
description: Hilbert.js API Docs
---

# Hilbert.js
Expand Down
28 changes: 24 additions & 4 deletions polypad/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,34 @@
layout: page
nav_order: 2
parent: Polypad API Docs
description: Polypad Changelog
---

# Polypad Changelog

## v4.6.7 (19 July 2023)
## v4.7.0 (28 August 2023)

### Breaking Changes
* Disable double-click-to-roll/flip if the corresponding action bar item is disabled. This applies to the "flip", "draw" and "randomise" actions. If you want to enable these actions for existing canvases, you can use `if (data.options.actionbar && data.options.actionbar !== 'hidden') data.options.actionbar += ',flip,draw,randomise'`.
### New Features
* Set `exportToCL: true` to allow exporting of drop zone values. This happens using a new dropdown in the tile action bar to define exports using a list of different functions, and the new `Polypad.getExports()` and `instance.getExports()` methods and the new `instance.on('export')` event.
* Customisable text labels for polygon tiles (authoring mode).
* Border radius for rectangle tiles (authoring mode).
* Input fields for rectangle width/height and circle radius (authoring mode).
* New instruments and sound samples. The "Song" tile is now called a "Track".

### Bug Fixes
* Fix an issue that caused "cables" between different tiles to disappear when loading a canvas.
* Fix undo/redo issues with "colliding" tiles (number cards, prime factor circles, playing cards and number dot arrangements).
* Fix saving and moving bugs with geometry utensils (ruler, protractor, compass, set triangle).
* Enforce the "tile limit" of drop zones. Any additional tiles will cause an existing tiles to move out of the drop zone.
* Only highlight a single dropzone when moving tiles.
* Fix an issue with detecting loops in expression dependencies.
* Fix an issue with flipping number jump tiles.
* Hide the fixed size canvas outline when `canvasMargin: 0`.
* Fix issues with saving number grid colours.
* Fix issues with Song tile resizing


## v4.6.7 (19 July 2023)

### New Features
* Alpha and ellipse masking of images
Expand All @@ -21,6 +41,7 @@ parent: Polypad API Docs

### Bug Fixes
* Lots of bug fixes related to the categorizer / drop zone tile, including padding for small zones, issues when resizing zones containing tiles, issues with groups inside zones, and support for narrower zones.
* Disable double-click-to-roll/flip if the corresponding action bar item is disabled
* Fix tabulating multiple grouped coins in other languages
* Fix merging grouped number tiles

Expand All @@ -30,7 +51,6 @@ parent: Polypad API Docs
### New Features
* Prefix and suffix options for number line labels


## v4.6.3 (25 June 2023)

### Bug Fixes
Expand Down
30 changes: 19 additions & 11 deletions polypad/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
layout: page
nav_order: 7
has_children: true
description: Polypad API Docs
---

# Polypad API Docs
Expand All @@ -11,7 +12,7 @@ has_children: true
Our JavaScript API allows you to add interactive Polypad canvases to any website. You simply need to include our JS source file, create a parent element for Polypad, and then call `Polypad.create()`:

```html
<script src="https://static.mathigon.org/api/polypad-en-v4.5.4.js"></script>
<script src="https://static.mathigon.org/api/polypad-en-v4.7.0.js"></script>
<div id="polypad" style="width: 800px; height: 500px;"></div>
<script>Polypad.create(document.querySelector('#polypad'), {apiKey: 'test'})</script>
```
Expand Down Expand Up @@ -56,7 +57,6 @@ interface PolypadOptions {
sidebar?: string; // Comma-separated list of sidebar sections to show
actionbar?: string; // Comma-separated list of actionbar items to show

uiPreset?: 'simple'|'default'|'advanced'|'custom';
grid?: 'none'|'square2-grid'|'square-dots'|'square-grid'|'tri-dots'|'tri-grid'|'tri2-dots'|'tri2-grid';
background?: string;

Expand Down Expand Up @@ -108,10 +108,10 @@ interface Polypad {
sidebarSettings?: boolean; // Whether to show the settings sidebar
toolbar?: boolean; // Whether to show the toolbar
settings?: boolean; // Whether to show the settings bar
exportToCL?: boolean; // Enable value exporting from drop zones
canvasMargin?: number; // The margin around fixed size canvases (default 40px)

initial?: PolypadData; // Initial data to show
isTeacher?: boolean; // Whether to show editable question fields

// Whether to show a second sidebar tab, or a custom tiles sidebar panel
customSidebar?: {title: string, tiles: TileData[]};
Expand All @@ -126,7 +126,10 @@ interface Polypad {

// Load custom WebFonts (Source Sans Pro) from Google Fonts
loadFonts: () => string;


// Extract all exported values from a Polypad data instance.
getExports: (data: PolypadData) => Record<string, {type: string, value: unknown}|undefined>;

// Get a static image corresponding to a Polypad data object.
toImage: (data: PolypadData, type?: 'png'|'svg'|'jpg', width?: number, height?: number) => string;

Expand Down Expand Up @@ -187,6 +190,9 @@ interface PolypadInstance {
// using window.resize() and the ResizeObserver API (if available in the Browser).
resize: () => void;

// Get all exported values from drop zones
getExports: () => Record<string, {type: string, value: unknown}|undefined>;

// Show a floating hand gesture that animates either clicking on a DOM element (no slide)
// or dragging a DOM element by a certain distance (with slide). The gesture disappears as
// soon as the target is interacted with.
Expand All @@ -195,10 +201,10 @@ interface PolypadInstance {
// Pin or unpin the actionbar programatically. Note that the actionbar is always pinned for
// screen widths smaller than 600px.
pinActionbar: (pin: boolean) => void;

// Enable keyboard and accessibility shortcuts. See below for details
bindKeyboardEvents: (keys?: KeyboardShortcuts) => void;

// Remove and clean up this Polypad instance. This action is irreversible, and any further
// interaction with the instance class may throw undefined Errors.
destroy(): void;
Expand Down Expand Up @@ -321,11 +327,6 @@ stack of changes.

__Callback Options__: `Event`

### `.on('options')`

Triggered whenever the user changes the canvas options using the settings bar on the left. The
available options are listed in the `PolypadOptions` object.

__Callback Options__: `Partial<PolypadOptions>`

### `.on('selection')`
Expand All @@ -341,6 +342,13 @@ contains the ID and the current position of all currently selected tiles.

__Callback Options__: `{tiles: {id: string, x: number, y: number}[]}`

### `.on('export')`

Triggered whenever the value of an exported variable changes, when a new export is added or when
an existing export is deleted (`undefined`).

__Callback Options__: `{[name: string]: {type: string, value: unknown}|undefined}`


## Internationalisation

Expand Down
54 changes: 47 additions & 7 deletions polypad/tiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,12 @@ parent: Polypad API Docs
### Clock

* `name: 'clock'`
* `clock: 'live'`
* `clock: 'free' | 'geared' | 'live'`
* `showSeconds: boolean`
* `clock: 'geared'`
* `ms: number`
* `showSeconds: boolean`
* `clock: 'free'`
* `h: number`
* `m: number`
* `s: number`
* `showSeconds: boolean`

### Currency Tile

Expand Down Expand Up @@ -123,17 +119,19 @@ parent: Polypad API Docs
* `name: 'piano'`
* `width: number`
* `startNote: number`
* `musicScale: 'blues' | 'chromatic' | 'major' | 'minor' | 'pentatonic'`

### Song

* `name: 'song'`
* `width: number`
* `height: number`
* `loops: number`
* `musicScale: 'blues' | 'chromatic' | 'major' | 'minor' | 'none' | 'pentatonic'`
* `startNote: number`
* `playbackType: 'sequence' | 'timeline'`
* `colSize: number`
* `rowSize: number`
* `barLength: number`
* `showGrid: boolean`

## Fractions

Expand All @@ -143,26 +141,42 @@ parent: Polypad API Docs
* `denominator: number`
* `count: number`
* `active: number`
* `combine: boolean`
* `size: number`

### Fraction Circle

* `name: 'fraction-circle'`
* `denominator: number`
* `count: number`
* `active: number`
* `combine: boolean`
* `size: number`

## Geometry

### Aperiodic Hat Tile

* `name: 'aperiodic-hat'`
* `a: number` – The two side lengths in the construction Tile(a,b)
* `b: number`

### Circle Tile

* `name: 'circle'`
* `radius: number`
* `textLabel: string` – Max length: 25.
* `textLabelFontSize: number`
* `textLabelRotate: boolean`

### Custom Polygon Tile

* `name: 'custom-polygon'`
* `shape: string` – Max length: 10000.
* `scale: number`
* `textLabel: string` – Max length: 25.
* `textLabelFontSize: number`
* `textLabelRotate: boolean`

### Egg Tangram

Expand Down Expand Up @@ -199,6 +213,9 @@ parent: Polypad API Docs
* `name: 'polygon'`
* `shape: string` – Either a named polygon like 'square', 'reg-hexagon' or 'kite', or a string of vertex coordinates like `0 0,1 0,1 1,0 1`. Max length: 10000.
* `scale: number`
* `textLabel: string` – Max length: 25.
* `textLabelFontSize: number`
* `textLabelRotate: boolean`

### Polyhedron Tile

Expand All @@ -212,13 +229,20 @@ parent: Polypad API Docs
* `name: 'rectangle'`
* `width: number`
* `height: number`
* `cornerRadius: number`
* `scale: number`
* `textLabel: string` – Max length: 25.
* `textLabelFontSize: number`
* `textLabelRotate: boolean`

### Regular Polygon Tile

* `name: 'reg-polygon'`
* `sides: number`
* `scale: number`
* `textLabel: string` – Max length: 25.
* `textLabelFontSize: number`
* `textLabelRotate: boolean`

### Tangram

Expand Down Expand Up @@ -315,6 +339,8 @@ parent: Polypad API Docs
* `cols: number`
* `rows: number`
* `colors: string` – Max length: 5000.
* `hStart: number`
* `vStart: number`

### Jump Tile

Expand All @@ -332,6 +358,9 @@ parent: Polypad API Docs
* `size: number`
* `minor: number`
* `arrows: 'both' | 'none' | 'positive'`
* `simplify: 'all' | 'integers' | 'none'`
* `prefix: string` – Max length: 10.
* `suffix: string` – Max length: 10.

### Number Tile

Expand All @@ -357,6 +386,16 @@ parent: Polypad API Docs

## Others

### Categorizer Tile

* `name: 'categorizer'`
* `width: number`
* `height: number`
* `layout: 'center' | 'flow' | 'none'`
* `allowed: string` – Max length: 100.
* `max: number`
* `padding: number`

### Equation Tile

* `name: 'equation'`
Expand All @@ -383,6 +422,7 @@ parent: Polypad API Docs
* `name: 'image'`
* `href: string` – The URL of the image, which should be returned by the `imageUpload()` config function. Max length: 100.
* `width: number`
* `mask: string` – Max length: 5000.

### Blank Question Tile

Expand Down
2 changes: 1 addition & 1 deletion studio/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
layout: page
nav_order: 6
has_children: true
description: todo
description: Mathigon Studion API Docs
---

# Mathigon Studio
Expand Down

0 comments on commit 3d8e00e

Please sign in to comment.