Skip to content

Commit 8c36726

Browse files
committed
Merge remote-tracking branch 'github-private/master' into release
2 parents 87f42fe + 4585d6f commit 8c36726

File tree

97 files changed

+1530
-432
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+1530
-432
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ var context = infiniteCanvas.getContext("2d");
2323
Include `InfiniteCanvas` in your web page:
2424

2525
```html
26-
<script src="https://cdn.jsdelivr.net/npm/[email protected].4-alpha/dist/infinite-canvas.js"></script>
26+
<script src="https://cdn.jsdelivr.net/npm/[email protected].7-alpha/dist/infinite-canvas.js"></script>
2727
```
2828

2929
or install it using npm:

dist/infinite-canvas.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* Options that can be provided when adding an event listener to an {@link InfiniteCanvas}
3+
*/
4+
export interface AddEventListenerOptions {
5+
/**
6+
* If `true`, the listener will be invoked at most once
7+
*/
8+
once: boolean;
9+
}

dist/types/config.d.ts

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { Units } from "./units";
2+
/**
3+
* This interface contains properties that determine the behavior of the {@link InfiniteCanvas}.
4+
*/
5+
export interface Config {
6+
/**
7+
* Determines whether rotating the {@link InfiniteCanvas} is possible or not
8+
*
9+
* @defaultValue true
10+
*/
11+
rotationEnabled: boolean;
12+
/**
13+
* If `true`, this means that the {@link InfiniteCanvas} will pan when touched with one finger, and that it will zoom when the user scrolls without pressing the Ctrl key
14+
*
15+
* @defaultValue false
16+
*/
17+
greedyGestureHandling: boolean;
18+
/**
19+
* Determines the units to use when drawing on an {@link InfiniteCanvas}
20+
*
21+
* @defaultValue {@link Units.CANVAS}
22+
*/
23+
units: Units;
24+
}

dist/types/config/infinite-canvas-config.d.ts

-6
This file was deleted.

dist/types/custom-events/event-listener.d.ts

-1
This file was deleted.

dist/types/custom-events/infinite-canvas-add-event-listener-options.d.ts

-3
This file was deleted.

dist/types/custom-events/infinite-canvas-draw-event.d.ts

-5
This file was deleted.

dist/types/custom-events/infinite-canvas-event-listener.d.ts

-3
This file was deleted.

dist/types/custom-events/infinite-canvas-event-map.d.ts

-8
This file was deleted.

dist/types/custom-events/infinite-canvas-transformation-event.d.ts

-5
This file was deleted.

dist/types/custom-events/transformation-representation.d.ts

-8
This file was deleted.

dist/types/draw-event.d.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { Transformed } from "./transformed";
2+
export interface DrawEvent extends Transformed {
3+
}

dist/types/event-listener.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import { EventMap } from "./event-map";
2+
export declare type EventListener<K extends keyof EventMap> = (ev: EventMap[K]) => void;

dist/types/event-map.d.ts

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { DrawEvent } from "./draw-event";
2+
import { TransformationEvent } from "./transformation-event";
3+
export interface EventMap {
4+
/**
5+
* Emitted when the {@link InfiniteCanvas} has drawn its content on the underlying `<canvas>`
6+
*/
7+
"draw": DrawEvent;
8+
/**
9+
* Emitted when {@link InfiniteCanvas} begins transforming (for example when the user begins to pan)
10+
*/
11+
"transformationStart": TransformationEvent;
12+
/**
13+
* Emitted when {@link InfiniteCanvas} transforms (for example when the user pans)
14+
*/
15+
"transformationChange": TransformationEvent;
16+
/**
17+
* Emitted when {@link InfiniteCanvas} has finished transforming
18+
*/
19+
"transformationEnd": TransformationEvent;
20+
}
21+
export * from './draw-event';
22+
export * from './transformation-event';
23+
export * from './transformed';

dist/types/infinite-canvas-declaration.d.ts

-19
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* This interface inherits all properties and methods from [`CanvasRenderingContext2D`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D)
3+
*
4+
* @remarks
5+
* `InfiniteCanvasRenderingContext2D` currently does **not** support [`getImageData()`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/getImageData), [`createImageData()`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/createImageData), [`globalAlpha`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalAlpha), [`globalCompositeOperation`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation), [`isPointInPath()`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/isPointInPath), [`isPointInStroke()`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/isPointInStroke), [`filter`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/filter), [`imageSmoothingEnabled`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/imageSmoothingEnabled), [`imageSmoothingQuality`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/imageSmoothingQuality), [`lineJoin`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin), [`miterLimit`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/miterLimit), [`drawFocusIfNeeded()`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawFocusIfNeeded) and [`scrollPathIntoView()`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/scrollPathIntoView)
6+
*/
7+
export interface InfiniteCanvasRenderingContext2D extends CanvasRenderingContext2D {
8+
/**
9+
* Modifies the current sub-path by adding a ray that starts at the sub-path's last point and extends to infinity in the direction of a given vector
10+
* @param x The horizontal component of the vector that indicates the direction of the line
11+
* @param y The vertical component of the vector that indicates the direction of the line
12+
*/
13+
lineToInfinityInDirection(x: number, y: number): void;
14+
/**
15+
* Begins a new sub-path at a 'point at infinity' that lies in the direction indicated by a given vector
16+
* @param x The horizontal component of the vector that indicates the direction of the 'point at infinity' at which to begin a new sub-path
17+
* @param y The vertical component of the vector that indicates the direction of the 'point at infinity' at which to begin a new sub-path
18+
*/
19+
moveToInfinityInDirection(x: number, y: number): void;
20+
}

dist/types/infinite-canvas-units.d.ts

-4
This file was deleted.

dist/types/infinite-canvas.d.ts

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import { Config } from "./config";
2+
import { Units } from "./units";
3+
import { InfiniteCanvasRenderingContext2D } from "./infinite-canvas-rendering-context-2d";
4+
import { EventMap } from "./event-map";
5+
import { AddEventListenerOptions } from "./add-event-listener-options";
6+
import { EventListener } from "./event-listener";
7+
export interface InfiniteCanvas extends Config {
8+
/**
9+
* This methods return the {@link InfiniteCanvasRenderingContext2D} belonging to this instance of {@link InfiniteCanvas}
10+
*
11+
* @param contextType for (partial) compatibility with the other [getContext()](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext)
12+
*/
13+
getContext(contextType?: '2d'): InfiniteCanvasRenderingContext2D;
14+
/**
15+
* Adds an event listener to an {@link InfiniteCanvas}
16+
*
17+
* @example
18+
* ```js
19+
* infCanvas.addEventListener('draw', () => {
20+
* console.log('drawn!')
21+
* })
22+
* ```
23+
* @param type The type of event to listen to
24+
* @param listener The listener to add
25+
* @param options An optional options object
26+
*/
27+
addEventListener<K extends keyof EventMap>(type: K, listener: EventListener<K>, options?: AddEventListenerOptions): void;
28+
/**
29+
* Removes an event listener
30+
* @param type The type of event that the listener to remove is listening to
31+
* @param listener The listener to remove
32+
*/
33+
removeEventListener<K extends keyof EventMap>(type: K, listener: EventListener<K>): void;
34+
}
35+
export interface InfiniteCanvasCtr {
36+
/**
37+
* Creates a new instance of an {@link InfiniteCanvas}
38+
*
39+
* @param canvas The canvas on which to draw the {@link InfiniteCanvas}
40+
* @param config The {@link InfiniteCanvas}'s initial configuration
41+
*/
42+
new (canvas: HTMLCanvasElement, config?: Partial<Config>): InfiniteCanvas;
43+
prototype: InfiniteCanvas;
44+
/**
45+
* Static property with a value of {@link Units.CANVAS}
46+
*/
47+
CANVAS_UNITS: Units;
48+
/**
49+
* Static property with a value of {@link Units.CSS}
50+
*/
51+
CSS_UNITS: Units;
52+
}
53+
declare var InfiniteCanvasConstructor: InfiniteCanvasCtr;
54+
export * from './add-event-listener-options';
55+
export * from './config';
56+
export * from './event-map';
57+
export * from './event-listener';
58+
export * from './infinite-canvas-rendering-context-2d';
59+
export * from './units';
60+
export default InfiniteCanvasConstructor;

dist/types/infinite-context/infinite-canvas-rendering-context-2d.d.ts

-4
This file was deleted.

dist/types/transformation-event.d.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { Transformed } from "./transformed";
2+
export interface TransformationEvent extends Transformed {
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* A plain object containing number-valued properties `a`, `b`, `c`, `d`, `e` and `f`, which mean the same as the parameters of the same name in [`setTransform()`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/transform#parameters).
3+
*/
4+
export interface TransformationRepresentation {
5+
/**
6+
* See "a" on [this](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/transform#parameters) page
7+
*/
8+
a: number;
9+
/**
10+
* See "b" on [this](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/transform#parameters) page
11+
*/
12+
b: number;
13+
/**
14+
* See "c" on [this](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/transform#parameters) page
15+
*/
16+
c: number;
17+
/**
18+
* See "d" on [this](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/transform#parameters) page
19+
*/
20+
d: number;
21+
/**
22+
* See "e" on [this](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/transform#parameters) page
23+
*/
24+
e: number;
25+
/**
26+
* See "f" on [this](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/transform#parameters) page
27+
*/
28+
f: number;
29+
}

dist/types/transformed.d.ts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { TransformationRepresentation } from "./transformation-representation";
2+
export interface Transformed {
3+
/**
4+
* The transformation that, when applied to a point `(x, y)` in the CSS-pixel-base coordinate system of the `<canvas>` (which has its origin at the top-left corner of the canvas), returns the corresponding point in the {@link InfiniteCanvas}'s coordinate system
5+
*/
6+
readonly transformation: TransformationRepresentation;
7+
/**
8+
* The inverse of {@link transformation}
9+
*/
10+
readonly inverseTransformation: TransformationRepresentation;
11+
}
12+
export * from './transformation-representation';

dist/types/units.d.ts

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export declare enum Units {
2+
/**
3+
* This value indicates that the {@link InfiniteCanvas} will use a coordinate system whose units correspond to CSS pixels.
4+
*/
5+
CSS = 0,
6+
/**
7+
* This value indicates that the {@link InfiniteCanvas} will use a coordinate system that corresponds to the underlying `<canvas>`'s `width` and `height` properties.
8+
*/
9+
CANVAS = 1
10+
}

docs/_sidebar.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
* [Home](/)
22
* [Live demo](live-demo.md)
33
* [Getting started](getting-started.md)
4-
* [API Reference](api_reference.md)
4+
* [API Reference](api/)
55
* [Infinity](infinity.md)

docs/api/.nojekyll

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.

docs/api/README.md

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
ef-infinite-canvas
2+
3+
# ef-infinite-canvas
4+
5+
## Enumerations
6+
7+
- [Units](api/enums/Units.md)
8+
9+
## Interfaces
10+
11+
- [AddEventListenerOptions](api/interfaces/AddEventListenerOptions.md)
12+
- [Config](api/interfaces/Config.md)
13+
- [DrawEvent](api/interfaces/DrawEvent.md)
14+
- [EventMap](api/interfaces/EventMap.md)
15+
- [InfiniteCanvas](api/interfaces/InfiniteCanvas.md)
16+
- [InfiniteCanvasCtr](api/interfaces/InfiniteCanvasCtr.md)
17+
- [InfiniteCanvasRenderingContext2D](api/interfaces/InfiniteCanvasRenderingContext2D.md)
18+
- [TransformationEvent](api/interfaces/TransformationEvent.md)
19+
- [TransformationRepresentation](api/interfaces/TransformationRepresentation.md)
20+
- [Transformed](api/interfaces/Transformed.md)
21+
22+
## Type Aliases
23+
24+
### EventListener
25+
26+
Ƭ **EventListener**<`K`\>: (`ev`: [`EventMap`](api/interfaces/EventMap.md)[`K`]) => `void`
27+
28+
#### Type parameters
29+
30+
| Name | Type |
31+
| :------ | :------ |
32+
| `K` | extends keyof [`EventMap`](api/interfaces/EventMap.md) |
33+
34+
#### Type declaration
35+
36+
▸ (`ev`): `void`
37+
38+
##### Parameters
39+
40+
| Name | Type |
41+
| :------ | :------ |
42+
| `ev` | [`EventMap`](api/interfaces/EventMap.md)[`K`] |
43+
44+
##### Returns
45+
46+
`void`
47+
48+
#### Defined in
49+
50+
[event-listener.ts:4](https://github.com/emilefokkema/infinite-canvas/blob/c465771/src/api-surface/event-listener.ts#L4)
51+
52+
## Variables
53+
54+
### default
55+
56+
**default**: [`InfiniteCanvasCtr`](api/interfaces/InfiniteCanvasCtr.md)
57+
58+
#### Defined in
59+
60+
[infinite-canvas.ts:56](https://github.com/emilefokkema/infinite-canvas/blob/c465771/src/api-surface/infinite-canvas.ts#L56)

docs/api/enums/Units.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[ef-infinite-canvas](api/README.md) / Units
2+
3+
# Enumeration: Units
4+
5+
## Enumeration Members
6+
7+
### CANVAS
8+
9+
**CANVAS** = ``1``
10+
11+
This value indicates that the [InfiniteCanvas](api/interfaces/InfiniteCanvas.md) will use a coordinate system that corresponds to the underlying `<canvas>`'s `width` and `height` properties.
12+
13+
#### Defined in
14+
15+
[units.ts:9](https://github.com/emilefokkema/infinite-canvas/blob/c465771/src/api-surface/units.ts#L9)
16+
17+
___
18+
19+
### CSS
20+
21+
**CSS** = ``0``
22+
23+
This value indicates that the [InfiniteCanvas](api/interfaces/InfiniteCanvas.md) will use a coordinate system whose units correspond to CSS pixels.
24+
25+
#### Defined in
26+
27+
[units.ts:5](https://github.com/emilefokkema/infinite-canvas/blob/c465771/src/api-surface/units.ts#L5)

0 commit comments

Comments
 (0)