Skip to content

Commit a13b7b9

Browse files
committed
chore(release): 4.0.0 [skip ci]
# [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
1 parent b082b5a commit a13b7b9

34 files changed

+2296
-44
lines changed

README.md

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ setTimeout(() => panzoom.pan(100, 100))
138138

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

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

143143
**Parameters:**
144144

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

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

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

166166
Whether to animate transitions
167167

@@ -171,7 +171,7 @@ Whether to animate transitions
171171

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

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

176176
Duration of the transition (ms)
177177

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

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

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

186186
CSS Easing used for transitions
187187

@@ -191,7 +191,7 @@ CSS Easing used for transitions
191191

192192
**exclude**? : _Element[]_
193193

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

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

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

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

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

218218
**force**? : _boolean_
219219

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

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

240240
**handleStartEvent**? : _function_
241241

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

244244
On the first pointer event, when panning starts,
245245
the default Panzoom behavior is to call
@@ -279,7 +279,7 @@ Panzoom(elem, {
279279

280280
**origin**? : _string_
281281

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

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

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

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

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

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

310310
**setTransform**? : _setTransform_
311311

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

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

334334
**silent**? : _boolean_
335335

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

338338
Silence all events
339339

@@ -343,7 +343,7 @@ Silence all events
343343

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

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

348348
Scale used to set the beginning transform
349349

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

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

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

358358
X Value used to set the beginning transform
359359

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

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

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

368368
Y Value used to set the beginning transform
369369

@@ -377,7 +377,7 @@ Includes `MiscOptions`
377377

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

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

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

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

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

400400
The cursor style to set on the panzoom element
401401

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

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

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

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

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

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

422422
Pan only on the Y axis
423423

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

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

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

432432
Pan only on the X axis
433433

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

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

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

442442
Disable panning while the scale is equal to the starting value
443443

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

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

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

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

@@ -461,7 +461,7 @@ Includes `MiscOptions`
461461

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

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

466466
Disable zooming functionality
467467

@@ -471,7 +471,7 @@ Disable zooming functionality
471471

472472
**focal**? : _object_
473473

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

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

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

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

495495
The maximum scale when zooming
496496

@@ -500,7 +500,7 @@ The maximum scale when zooming
500500

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

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

505505
The minimum scale when zooming
506506

@@ -510,7 +510,7 @@ The minimum scale when zooming
510510

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

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

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

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

525525
**destroy**: _function_
526526

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

529529
Remove all event listeners bind to the the Panzoom element
530530

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

539539
**getOptions**: _function_
540540

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

543543
Returns a _copy_ of the current options object
544544

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

553553
**getPan**: _function_
554554

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

557557
Get the current x/y translation
558558

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

571571
**getScale**: _function_
572572

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

575575
Get the current scale
576576

@@ -584,7 +584,7 @@ Get the current scale
584584

585585
**pan**: _function_
586586

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

589589
Pan the Panzoom element to the given x and y coordinates
590590

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

614614
**reset**: _function_
615615

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

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

641641
**setOptions**: _function_
642642

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

645645
Change options for the Panzoom instance
646646

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

661661
**setStyle**: _function_
662662

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

665665
A convenience method for setting prefixed styles on the Panzoom element
666666

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

682682
**zoom**: _function_
683683

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

686686
Zoom the Panzoom element to the given scale
687687

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

708708
**zoomIn**: _function_
709709

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

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

735735
**zoomOut**: _function_
736736

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

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

762762
**zoomToPoint**: _function_
763763

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

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

796796
**zoomWithWheel**: _function_
797797

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

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

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

840840
**scale**: _number_
841841

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

844844
---
845845

846846
### x
847847

848848
**x**: _number_
849849

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

852852
---
853853

854854
### y
855855

856856
**y**: _number_
857857

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

860860
## Events
861861

dist/demo/Code.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/// <reference types="react" />
2+
import 'prismjs/themes/prism-tomorrow.css';
3+
interface Props {
4+
language?: string;
5+
children: string;
6+
}
7+
export default function Code({ children, language }: Props): JSX.Element;
8+
export {};

0 commit comments

Comments
 (0)