-
-
Notifications
You must be signed in to change notification settings - Fork 421
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
2,104 additions
and
53 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import type { CurrentValues, PanzoomOptions } from './types'; | ||
/** | ||
* Gets a style value expected to be a number | ||
*/ | ||
export declare function getCSSNum(name: string, style: CSSStyleDeclaration): number; | ||
/** | ||
* Set a style using the properly prefixed name | ||
*/ | ||
export declare function setStyle(elem: HTMLElement | SVGElement, name: string, value: string): void; | ||
/** | ||
* Constructs the transition from panzoom options | ||
* and takes care of prefixing the transition and transform | ||
*/ | ||
export declare function setTransition(elem: HTMLElement | SVGElement, options: PanzoomOptions): void; | ||
/** | ||
* Set the transform using the proper prefix | ||
* | ||
* Override the transform setter. | ||
* This is exposed mostly so the user could | ||
* set other parts of a transform | ||
* aside from scale and translate. | ||
* Default is defined in src/css.ts. | ||
* | ||
* ```js | ||
* // This example always sets a rotation | ||
* // when setting the scale and translation | ||
* const panzoom = Panzoom(elem, { | ||
* setTransform: (elem, { scale, x, y }) => { | ||
* panzoom.setStyle('transform', `rotate(0.5turn) scale(${scale}) translate(${x}px, ${y}px)`) | ||
* } | ||
* }) | ||
* ``` | ||
*/ | ||
export declare function setTransform(elem: HTMLElement | SVGElement, { x, y, scale, isSVG }: CurrentValues, _options?: PanzoomOptions): void; | ||
/** | ||
* Dimensions used in containment and focal point zooming | ||
*/ | ||
export declare function getDimensions(elem: HTMLElement | SVGElement): { | ||
elem: { | ||
style: CSSStyleDeclaration; | ||
width: number; | ||
height: number; | ||
top: number; | ||
bottom: number; | ||
left: number; | ||
right: number; | ||
margin: { | ||
left: number; | ||
right: number; | ||
top: number; | ||
bottom: number; | ||
}; | ||
border: { | ||
left: number; | ||
right: number; | ||
top: number; | ||
bottom: number; | ||
}; | ||
}; | ||
parent: { | ||
style: CSSStyleDeclaration; | ||
width: number; | ||
height: number; | ||
top: number; | ||
bottom: number; | ||
left: number; | ||
right: number; | ||
padding: { | ||
left: number; | ||
right: number; | ||
top: number; | ||
bottom: number; | ||
}; | ||
border: { | ||
left: number; | ||
right: number; | ||
top: number; | ||
bottom: number; | ||
}; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
declare let events: { | ||
down: string; | ||
move: string; | ||
up: string; | ||
}; | ||
export { events as eventNames }; | ||
export declare function onPointer(event: 'down' | 'move' | 'up', elem: HTMLElement | SVGElement | Document, handler: (event: PointerEvent) => void, eventOpts?: boolean | AddEventListenerOptions): void; | ||
export declare function destroyPointer(event: 'down' | 'move' | 'up', elem: HTMLElement | SVGElement | Document, handler: (event: PointerEvent) => void): void; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/** | ||
* Determine if an element is attached to the DOM | ||
* Panzoom requires this so events work properly | ||
*/ | ||
export default function isAttached(elem: HTMLElement | SVGElement | Document): boolean; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import type { PanzoomOptions } from './types'; | ||
export default function isExcluded(elem: Element, options: PanzoomOptions): boolean; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default function isSVGElement(elem: HTMLElement | SVGElement): boolean; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* Panzoom for panning and zooming elements using CSS transforms | ||
* https://github.com/timmywil/panzoom | ||
* | ||
* Copyright Timmy Willison and other contributors | ||
* Released under the MIT license | ||
* https://github.com/timmywil/panzoom/blob/main/MIT-License.txt | ||
* | ||
*/ | ||
import './polyfills'; | ||
import type { PanzoomObject, PanzoomOptions } from './types'; | ||
declare function Panzoom(elem: HTMLElement | SVGElement, options?: Omit<PanzoomOptions, 'force'>): PanzoomObject; | ||
declare namespace Panzoom { | ||
var defaultOptions: PanzoomOptions; | ||
} | ||
export { PanzoomObject, PanzoomOptions }; | ||
export default Panzoom; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* Utilites for working with multiple pointer events | ||
*/ | ||
export declare function addPointer(pointers: PointerEvent[], event: PointerEvent): void; | ||
export declare function removePointer(pointers: PointerEvent[], event: PointerEvent): void; | ||
/** | ||
* Calculates a center point between | ||
* the given pointer events, for panning | ||
* with multiple pointers. | ||
*/ | ||
export declare function getMiddle(pointers: PointerEvent[]): Pick<PointerEvent, "clientX" | "clientY">; | ||
/** | ||
* Calculates the distance between two points | ||
* for pinch zooming. | ||
* Limits to the first 2 | ||
*/ | ||
export declare function getDistance(pointers: PointerEvent[]): number; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default function shallowClone(obj: any): any; |
Oops, something went wrong.