Skip to content

Commit

Permalink
chore(release): 4.0.0 [skip ci]
Browse files Browse the repository at this point in the history
# [4.0.0](3.2.3...4.0.0) (2019-12-16)

### Bug Fixes

* **contain:** always set scale before using constrainXY ([761a0ec](761a0ec)), closes [#426](#426)
* **css:** fix border width retrieval in Firefox ([5d2f580](5d2f580))
* **events:** fallback to touch and mouse events ([#399](#399)) ([2c4c303](2c4c303))
* **events:** fix triggering panzoomend for one pointer event ([f23e0fa](f23e0fa)), closes [#428](#428)
* **handledown:** exclude descendents of excluded parents ([b2f943a](b2f943a)), closes [#431](#431)
* **handleup:** remove pointer regardless of isPanning state ([8938b29](8938b29)), closes [#402](#402) [#403](#403)
* **reset:** use setTransform passed to reset options ([2adbb4e](2adbb4e))
* **setoptions:** set cursor style with the option ([9c8efb4](9c8efb4))
* **setstyle:** remove unnecessary param from exposed setStyle ([c9bcf94](c9bcf94))
* **zoom:** account for smaller elements and padding/border ([3fe89a1](3fe89a1))
* **zoom:** need the before and after dimensions to constrain ([7c2c982](7c2c982)), closes [#426](#426)
* **zoom:** set min and max scale based on containment ([d05f1e7](d05f1e7)), closes [#426](#426)

### Features

* basic panning and zooming functionality ([e80270f](e80270f))
* clean slate with typescript, rollup, and semantic-release ([27a0887](27a0887))
* **centering:** switch to default transform origins ([b483cda](b483cda))
* **contain:** add contain: 'outside' option ([1571e99](1571e99))
* **events:** add custom events for panning and zooming ([#398](#398)) ([7713025](7713025))
* **exclude:** add exclude option; change clickableClass to excludeClass ([da72c32](da72c32)), closes [#411](#411)
* **handlestartevent:** add option to handle the start event ([931743a](931743a)), closes [#414](#414)
* **overflow:** add an option to override the parent's overflow ([77032bb](77032bb)), closes [#427](#427)
* add a destroy method ([#404](#404)) ([c88ef75](c88ef75))
* add animate option to transition the transforms ([d9a8e67](d9a8e67))
* **pan:** add contain: 'inside' option ([a7078e8](a7078e8))
* **pan:** add panOnlyWhenZoomed option ([5559967](5559967))
* **panzoom:** add the force option ([0ba521a](0ba521a)), closes [#413](#413)
* **zoom:** implement focal point zooming without matrices ([5d077f1](5d077f1))
* **zoom:** pinch zooming with pointer events! ([5ddbd30](5ddbd30))

### Performance Improvements

* **pan:** make move/cancel listeners passive ([f647163](f647163))

### BREAKING CHANGES

* This is a complete rewrite of the panzoom library
to be a standard JS lib that doesn't rely on jQuery,
but can still integrate as a plugin
  • Loading branch information
timmywil committed Dec 16, 2019
1 parent b082b5a commit a13b7b9
Show file tree
Hide file tree
Showing 34 changed files with 2,296 additions and 44 deletions.
86 changes: 43 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ setTimeout(() => panzoom.pan(100, 100))

**Panzoom**(`elem`: HTMLElement | SVGElement, `options?`: Omit‹[PanzoomOptions](#PanzoomOptions), "force"›): _[PanzoomObject](#PanzoomObject)_

_Defined in [panzoom.ts:49](https://github.com/timmywil/panzoom/blob/d0b9505/src/panzoom.ts#L49)_
_Defined in [panzoom.ts:49](https://github.com/timmywil/panzoom/blob/b082b5a/src/panzoom.ts#L49)_

**Parameters:**

Expand All @@ -161,7 +161,7 @@ Includes `MiscOptions`, `PanOptions`, and `ZoomOptions`

**animate**? : _boolean_ (Default: **false**)

_Defined in [types.ts:13](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L13)_
_Defined in [types.ts:13](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L13)_

Whether to animate transitions

Expand All @@ -171,7 +171,7 @@ Whether to animate transitions

**duration**? : _number_ (Default: **200**)

_Defined in [types.ts:15](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L15)_
_Defined in [types.ts:15](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L15)_

Duration of the transition (ms)

Expand All @@ -181,7 +181,7 @@ Duration of the transition (ms)

**easing**? : _string_ (Default: **"ease-in-out"**)

_Defined in [types.ts:17](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L17)_
_Defined in [types.ts:17](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L17)_

CSS Easing used for transitions

Expand All @@ -191,7 +191,7 @@ CSS Easing used for transitions

**exclude**? : _Element[]_

_Defined in [types.ts:24](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L24)_
_Defined in [types.ts:24](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L24)_

Add elements to this array that should be excluded
from Panzoom handling.
Expand All @@ -204,7 +204,7 @@ e.g. links and buttons that should not propagate the click event.

**excludeClass**? : _string_ (Default: **"panzoom-exclude"**)

_Defined in [types.ts:31](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L31)_
_Defined in [types.ts:31](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L31)_

Add this class to any element within the Panzoom element
that you want to exclude from Panzoom handling. That
Expand All @@ -217,7 +217,7 @@ e.g. links and buttons that should not propagate the click event.

**force**? : _boolean_

_Defined in [types.ts:47](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L47)_
_Defined in [types.ts:47](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L47)_

`force` should be used sparingly to temporarily
override and ignore options such as disablePan,
Expand All @@ -239,7 +239,7 @@ panzoom.zoom(1, { force: true })

**handleStartEvent**? : _function_

_Defined in [types.ts:71](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L71)_
_Defined in [types.ts:71](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L71)_

On the first pointer event, when panning starts,
the default Panzoom behavior is to call
Expand Down Expand Up @@ -279,7 +279,7 @@ Panzoom(elem, {

**origin**? : _string_

_Defined in [types.ts:85](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L85)_
_Defined in [types.ts:85](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L85)_

**Change this at your own risk.**
The `transform-origin` is the origin from which transforms are applied.
Expand All @@ -299,7 +299,7 @@ And again, changing this for SVG in IE doesn't work at all.

**overflow**? : _string_ (Default: **"hidden"**)

_Defined in [types.ts:87](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L87)_
_Defined in [types.ts:87](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L87)_

The overflow CSS value for the parent. Defaults to 'hidden'

Expand All @@ -309,7 +309,7 @@ The overflow CSS value for the parent. Defaults to 'hidden'

**setTransform**? : _setTransform_

_Defined in [types.ts:105](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L105)_
_Defined in [types.ts:105](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L105)_

Override the transform setter.
This is exposed mostly so the user could
Expand All @@ -333,7 +333,7 @@ const panzoom = Panzoom(elem, {

**silent**? : _boolean_

_Defined in [types.ts:107](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L107)_
_Defined in [types.ts:107](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L107)_

Silence all events

Expand All @@ -343,7 +343,7 @@ Silence all events

**startScale**? : _number_ (Default: **1**)

_Defined in [types.ts:113](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L113)_
_Defined in [types.ts:113](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L113)_

Scale used to set the beginning transform

Expand All @@ -353,7 +353,7 @@ Scale used to set the beginning transform

**startX**? : _number_ (Default: **0**)

_Defined in [types.ts:109](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L109)_
_Defined in [types.ts:109](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L109)_

X Value used to set the beginning transform

Expand All @@ -363,7 +363,7 @@ X Value used to set the beginning transform

**startY**? : _number_ (Default: **0**)

_Defined in [types.ts:111](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L111)_
_Defined in [types.ts:111](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L111)_

Y Value used to set the beginning transform

Expand All @@ -377,7 +377,7 @@ Includes `MiscOptions`

**contain**? : _"inside" | "outside"_

_Defined in [types.ts:130](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L130)_
_Defined in [types.ts:130](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L130)_

Contain the panzoom element either
inside or outside the parent.
Expand All @@ -395,7 +395,7 @@ empty space around the element will be shown.

**cursor**? : _string_ (Default: **"move"**)

_Defined in [types.ts:132](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L132)_
_Defined in [types.ts:132](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L132)_

The cursor style to set on the panzoom element

Expand All @@ -405,7 +405,7 @@ The cursor style to set on the panzoom element

**disablePan**? : _boolean_ (Default: **false**)

_Defined in [types.ts:138](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L138)_
_Defined in [types.ts:138](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L138)_

Disable panning functionality.
Note: disablePan does not affect focal point zooming or the constrain option.
Expand All @@ -417,7 +417,7 @@ The element will still pan accordingly.

**disableXAxis**? : _boolean_ (Default: **false**)

_Defined in [types.ts:140](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L140)_
_Defined in [types.ts:140](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L140)_

Pan only on the Y axis

Expand All @@ -427,7 +427,7 @@ Pan only on the Y axis

**disableYAxis**? : _boolean_ (Default: **false**)

_Defined in [types.ts:142](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L142)_
_Defined in [types.ts:142](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L142)_

Pan only on the X axis

Expand All @@ -437,7 +437,7 @@ Pan only on the X axis

**panOnlyWhenZoomed**? : _boolean_ (Default: **false**)

_Defined in [types.ts:146](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L146)_
_Defined in [types.ts:146](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L146)_

Disable panning while the scale is equal to the starting value

Expand All @@ -447,7 +447,7 @@ Disable panning while the scale is equal to the starting value

**relative**? : _boolean_ (Default: **false**)

_Defined in [types.ts:144](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L144)_
_Defined in [types.ts:144](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L144)_

When passing x and y values to .pan(), treat the values as relative to their current values

Expand All @@ -461,7 +461,7 @@ Includes `MiscOptions`

**disableZoom**? : _boolean_ (Default: **false**)

_Defined in [types.ts:151](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L151)_
_Defined in [types.ts:151](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L151)_

Disable zooming functionality

Expand All @@ -471,7 +471,7 @@ Disable zooming functionality

**focal**? : _object_

_Defined in [types.ts:158](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L158)_
_Defined in [types.ts:158](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L158)_

Zoom to the given point on the panzoom element.
This point is expected to be relative to
Expand All @@ -490,7 +490,7 @@ to the parent dimensions.

**maxScale**? : _number_ (Default: **4**)

_Defined in [types.ts:162](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L162)_
_Defined in [types.ts:162](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L162)_

The maximum scale when zooming

Expand All @@ -500,7 +500,7 @@ The maximum scale when zooming

**minScale**? : _number_ (Default: **0.125**)

_Defined in [types.ts:160](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L160)_
_Defined in [types.ts:160](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L160)_

The minimum scale when zooming

Expand All @@ -510,7 +510,7 @@ The minimum scale when zooming

**step**? : _number_ (Default: **0.3**)

_Defined in [types.ts:164](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L164)_
_Defined in [types.ts:164](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L164)_

The step affects zoom calculation when zooming with a mouse wheel, when pinch zooming, or when using zoomIn/zoomOut

Expand All @@ -524,7 +524,7 @@ These methods are available after initializing Panzoom

**destroy**: _function_

_Defined in [types.ts:179](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L179)_
_Defined in [types.ts:179](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L179)_

Remove all event listeners bind to the the Panzoom element

Expand All @@ -538,7 +538,7 @@ Remove all event listeners bind to the the Panzoom element

**getOptions**: _function_

_Defined in [types.ts:185](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L185)_
_Defined in [types.ts:185](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L185)_

Returns a _copy_ of the current options object

Expand All @@ -552,7 +552,7 @@ Returns a _copy_ of the current options object

**getPan**: _function_

_Defined in [types.ts:181](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L181)_
_Defined in [types.ts:181](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L181)_

Get the current x/y translation

Expand All @@ -570,7 +570,7 @@ Get the current x/y translation

**getScale**: _function_

_Defined in [types.ts:183](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L183)_
_Defined in [types.ts:183](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L183)_

Get the current scale

Expand All @@ -584,7 +584,7 @@ Get the current scale

**pan**: _function_

_Defined in [types.ts:196](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L196)_
_Defined in [types.ts:196](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L196)_

Pan the Panzoom element to the given x and y coordinates

Expand Down Expand Up @@ -613,7 +613,7 @@ panzoom.pan(10, 10, { relative: true })

**reset**: _function_

_Defined in [types.ts:207](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L207)_
_Defined in [types.ts:207](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L207)_

Reset the pan and zoom to startX, startY, and startScale.
Animates by default, ignoring the global option.
Expand All @@ -640,7 +640,7 @@ panzoom.reset({ animate: false })

**setOptions**: _function_

_Defined in [types.ts:209](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L209)_
_Defined in [types.ts:209](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L209)_

Change options for the Panzoom instance

Expand All @@ -660,7 +660,7 @@ Change options for the Panzoom instance

**setStyle**: _function_

_Defined in [types.ts:211](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L211)_
_Defined in [types.ts:211](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L211)_

A convenience method for setting prefixed styles on the Panzoom element

Expand All @@ -681,7 +681,7 @@ A convenience method for setting prefixed styles on the Panzoom element

**zoom**: _function_

_Defined in [types.ts:220](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L220)_
_Defined in [types.ts:220](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L220)_

Zoom the Panzoom element to the given scale

Expand All @@ -707,7 +707,7 @@ panzoom.zoom(2.2, { animate: true })

**zoomIn**: _function_

_Defined in [types.ts:231](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L231)_
_Defined in [types.ts:231](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L231)_

Zoom in using the predetermined increment set in options.
Animates by default, ignoring the global option.
Expand All @@ -734,7 +734,7 @@ panzoom.zoomIn({ animate: false })

**zoomOut**: _function_

_Defined in [types.ts:242](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L242)_
_Defined in [types.ts:242](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L242)_

Zoom out using the predetermined increment set in options.
Animates by default, ignoring the global option.
Expand All @@ -761,7 +761,7 @@ panzoom.zoomOut({ animate: false })

**zoomToPoint**: _function_

_Defined in [types.ts:253](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L253)_
_Defined in [types.ts:253](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L253)_

Zoom the Panzoom element to a focal point using
the given pointer/touch/mouse event or constructed point.
Expand Down Expand Up @@ -795,7 +795,7 @@ panzoom.zoomToPoint(1.2, pointerEvent)

**zoomWithWheel**: _function_

_Defined in [types.ts:282](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L282)_
_Defined in [types.ts:282](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L282)_

Zoom the Panzoom element to a focal point using the given WheelEvent

Expand Down Expand Up @@ -839,23 +839,23 @@ elem.parentElement.addEventListener('wheel', function(event) {

**scale**: _number_

_Defined in [types.ts:174](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L174)_
_Defined in [types.ts:174](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L174)_

---

### x

**x**: _number_

_Defined in [types.ts:172](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L172)_
_Defined in [types.ts:172](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L172)_

---

### y

**y**: _number_

_Defined in [types.ts:173](https://github.com/timmywil/panzoom/blob/d0b9505/src/types.ts#L173)_
_Defined in [types.ts:173](https://github.com/timmywil/panzoom/blob/b082b5a/src/types.ts#L173)_

## Events

Expand Down
8 changes: 8 additions & 0 deletions dist/demo/Code.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/// <reference types="react" />
import 'prismjs/themes/prism-tomorrow.css';
interface Props {
language?: string;
children: string;
}
export default function Code({ children, language }: Props): JSX.Element;
export {};
Loading

0 comments on commit a13b7b9

Please sign in to comment.