touchcontroller
Advanced tools
Comparing version 3.7.0 to 3.8.0
@@ -0,3 +1,4 @@ | ||
import { Touch } from '../touch/Touch'; | ||
import { TouchController } from '../touch/TouchController'; | ||
import { IEmulateTouchOptions } from './IEmulateTouchOptions'; | ||
export declare function emulateTouch(touchController: TouchController, options: IEmulateTouchOptions): Promise<void>; | ||
export declare function emulateTouch(touchController: TouchController, options: IEmulateTouchOptions): Promise<Touch>; |
@@ -15,6 +15,6 @@ import { MultitouchControllerDebugLayer } from './debug/MultiTouchControllerDebugLayer'; | ||
import { TouchListener } from './listeners/TouchListener'; | ||
import { Multitouch } from './multitouch/Multitouch'; | ||
import { MultitouchController } from './multitouch/MultitouchController'; | ||
import { IMultitouchTransformsOptions, multitouchTransforms } from './multitouch/multitouchTransforms/multitouchTransforms'; | ||
import { multitouchTransformsOnElement } from './multitouch/multitouchTransforms/multitouchTransformsOnElement'; | ||
import { Multitouch } from './multitouch/MultiTouch'; | ||
import { MultitouchController } from './multitouch/MultiTouchController'; | ||
import { IMultitouchTransformsOptions, multitouchTransforms } from './multitouch/multiTouchTransforms/multiTouchTransforms'; | ||
import { multitouchTransformsOnElement } from './multitouch/multiTouchTransforms/multitouchTransformsOnElement'; | ||
import { Touch } from './touch/Touch'; | ||
@@ -30,3 +30,5 @@ import { TouchController } from './touch/TouchController'; | ||
import { sign } from './utils/mathTools'; | ||
import { Omit } from './utils/Omit'; | ||
import { padArray } from './utils/padArray'; | ||
export { sign, Touch, Scene, IEvent, average, padArray, IElement, Particle, IListener, Awaitable, TouchFrame, Multitouch, SourceCache, EventManager, emulateTouch, VectorAverage, TAverageItems, TouchListener, MouseListener, DrawController, CanvasRectangle, TouchController, ITouchController, IParticleOptions, IElementListeners, createImageFromSrc, createCanvasFromSrc, multitouchTransforms, MultitouchController, IEmulateTouchOptions, particleOptionsAverage, IParticleOptionsExternals, TouchControllerDebugLayer, createColoredCanvasFromSrc, IMultitouchTransformsOptions, IEmulateTouchOptionsAdvanced, getBoundingClientRectEnhanced, multitouchTransformsOnElement, MultitouchControllerDebugLayer }; | ||
import { WithOptional } from './utils/WithOptional'; | ||
export { Omit, sign, Touch, Scene, IEvent, average, padArray, IElement, Particle, IListener, Awaitable, TouchFrame, Multitouch, SourceCache, WithOptional, EventManager, emulateTouch, VectorAverage, TAverageItems, TouchListener, MouseListener, DrawController, CanvasRectangle, TouchController, ITouchController, IParticleOptions, IElementListeners, createImageFromSrc, createCanvasFromSrc, multitouchTransforms, MultitouchController, IEmulateTouchOptions, particleOptionsAverage, IParticleOptionsExternals, TouchControllerDebugLayer, createColoredCanvasFromSrc, IMultitouchTransformsOptions, IEmulateTouchOptionsAdvanced, getBoundingClientRectEnhanced, multitouchTransformsOnElement, MultitouchControllerDebugLayer }; |
@@ -7,9 +7,17 @@ import { Observable } from 'rxjs/internal/Observable'; | ||
import { TouchFrame } from '../touch/TouchFrame'; | ||
import { WithOptional } from '../utils/WithOptional'; | ||
import { Multitouch } from './Multitouch'; | ||
interface IMultitouchControllerOptions<TElement extends BoundingBox> { | ||
touchController: ITouchController; | ||
elementBinder: (frame: TouchFrame) => Awaitable<TElement | undefined>; | ||
} | ||
declare const multitouchControllerOptionsDefault: { | ||
elementBinder: () => undefined; | ||
}; | ||
export declare class MultitouchController<TElement extends BoundingBox> { | ||
readonly touchController: ITouchController; | ||
private readonly elementBinder; | ||
readonly multitouches: Subject<Multitouch<TElement>>; | ||
private ongoingMultitouches; | ||
constructor(touchController: ITouchController, elementBinder: (frame: TouchFrame) => Awaitable<TElement | undefined>); | ||
private readonly elementBinder; | ||
constructor(options: WithOptional<IMultitouchControllerOptions<TElement>, keyof typeof multitouchControllerOptionsDefault>); | ||
private watchNewTouchesAndPassThemToMultitouches; | ||
@@ -22,1 +30,2 @@ get hoveredElements(): Observable<TElement | undefined>; | ||
} | ||
export {}; |
import { Observable } from 'rxjs/internal/Observable'; | ||
import { BoundingBox, ITransform, Transform, Vector } from 'xyzt'; | ||
import { TouchController } from '../../main'; | ||
import { Multitouch } from '../Multitouch'; | ||
export interface IMultitouchTransformsOptions { | ||
touchController: TouchController; | ||
multitouch: Multitouch<BoundingBox>; | ||
@@ -9,2 +11,2 @@ getElementCenter: () => Vector; | ||
} | ||
export declare function multitouchTransforms({ multitouch, getElementCenter, pick, }: IMultitouchTransformsOptions): Observable<Transform>; | ||
export declare function multitouchTransforms({ touchController, multitouch, getElementCenter, pick, }: IMultitouchTransformsOptions): Observable<Transform>; |
import { Observable } from 'rxjs/internal/Observable'; | ||
import { ITransform, Transform, Vector } from 'xyzt'; | ||
import { Touch } from '../../main'; | ||
import { Touch, TouchController } from '../../main'; | ||
interface ITwoFingerringOptions { | ||
touchController: TouchController; | ||
touch1: Touch; | ||
@@ -10,3 +11,3 @@ touch2: Touch; | ||
} | ||
export declare function _twoFingerring({ touch1, touch2, getElementCenter, pick, }: ITwoFingerringOptions): Observable<Transform>; | ||
export declare function _twoFingerring({ touchController, touch1, touch2, getElementCenter, pick, }: ITwoFingerringOptions): Observable<Transform>; | ||
export {}; |
import { Subject } from 'rxjs/internal/Subject'; | ||
import { IElement } from '../interfaces/IElement'; | ||
import { WithOptional } from '../utils/WithOptional'; | ||
import { TouchFrame } from './TouchFrame'; | ||
interface ITouchOptions { | ||
type: 'TOUCH' | 'MOUSE'; | ||
anchorElement: IElement; | ||
buttonIdentifier?: string | number; | ||
} | ||
declare const touchOptionsDefault: {}; | ||
export declare class Touch { | ||
readonly type: 'TOUCH' | 'MOUSE'; | ||
readonly anchorElement: IElement; | ||
readonly buttonIdentifier?: string | number | undefined; | ||
readonly buttonIdentifier?: string | number; | ||
readonly id: number; | ||
@@ -16,4 +23,3 @@ readonly uuid: string; | ||
*/ | ||
constructor(type: 'TOUCH' | 'MOUSE', // TODO: maybe as second optional param and extendable | ||
anchorElement: IElement, buttonIdentifier?: string | number | undefined); | ||
constructor(options: WithOptional<ITouchOptions, keyof typeof touchOptionsDefault>); | ||
frameTuples({ itemsPerTuple, startImmediately }: ITouchFrameTuplingOptions): Subject<TouchFrame[]>; | ||
@@ -20,0 +26,0 @@ toString(): string; |
@@ -7,8 +7,17 @@ import { Subject } from 'rxjs/internal/Subject'; | ||
import { EventManager } from '../utils/EventManager'; | ||
import { WithOptional } from '../utils/WithOptional'; | ||
import { Touch } from './Touch'; | ||
import { TouchFrame } from './TouchFrame'; | ||
interface ITouchControllerOptions { | ||
elements: IElement[]; | ||
anchorElement: HTMLElement; | ||
setListeners: boolean; | ||
} | ||
declare const touchControllerOptionsDefault: { | ||
setListeners: boolean; | ||
}; | ||
export declare class TouchController implements ITouchController { | ||
static fromCanvas(canvas: HTMLCanvasElement): TouchController; | ||
readonly elements: IElement[]; | ||
readonly anchorElement: HTMLElement; | ||
static fromCanvas(canvas: HTMLCanvasElement): TouchController; | ||
readonly touches: Subject<Touch>; | ||
@@ -18,4 +27,3 @@ readonly hoveredFrames: Subject<TouchFrame>; | ||
private listeners; | ||
constructor(elements: IElement[], // TODO: syntax sugar if set only one element | ||
anchorElement: HTMLElement, setListeners?: boolean); | ||
constructor(options: WithOptional<ITouchControllerOptions, keyof typeof touchControllerOptionsDefault>); | ||
addListener(listener: IListener): void; | ||
@@ -26,1 +34,2 @@ addElement(element: IElement): void; | ||
} | ||
export {}; |
import { Vector } from 'xyzt'; | ||
import { IElement } from '../interfaces/IElement'; | ||
import { WithOptional } from '../utils/WithOptional'; | ||
interface ITouchFrameOptions { | ||
element: IElement; | ||
anchorElement: IElement; | ||
positionRelative: Vector; | ||
time: number | null; | ||
rotating: boolean; | ||
force: number; | ||
radius: Vector; | ||
countPosition: boolean; | ||
} | ||
declare const touchFrameOptionsDefault: { | ||
positionRelative: Vector; | ||
time: null; | ||
rotating: boolean; | ||
force: number; | ||
radius: Vector; | ||
countPosition: boolean; | ||
}; | ||
export declare class TouchFrame { | ||
@@ -7,3 +26,3 @@ readonly element: IElement; | ||
readonly positionRelative: Vector; | ||
readonly time: number; | ||
readonly time: number | null; | ||
readonly rotating: boolean; | ||
@@ -13,7 +32,8 @@ readonly force: number; | ||
position: Vector; | ||
constructor(element: IElement, anchorElement: IElement, positionRelative?: Vector, time?: number, rotating?: boolean, force?: number, radius?: Vector, countPosition?: boolean); | ||
constructor(options: WithOptional<ITouchFrameOptions, keyof typeof touchFrameOptionsDefault>); | ||
clone(): TouchFrame; | ||
} | ||
export {}; | ||
/** | ||
* TODO: Maybe? TC first frame and frames access in every touch frame | ||
*/ |
@@ -1,2 +0,2 @@ | ||
import { BoundingBox, ITransform } from 'xyzt'; | ||
import { BoundingBox, ITransform, Transform } from 'xyzt'; | ||
interface ICanvasRectangleOptions { | ||
@@ -10,5 +10,5 @@ transform: ITransform; | ||
constructor(options: ICanvasRectangleOptions); | ||
render(ctx: CanvasRenderingContext2D): void; | ||
render(ctx: CanvasRenderingContext2D, transform: Transform): void; | ||
applyTransform(transform: ITransform): void; | ||
} | ||
export {}; |
{ | ||
"name": "touchcontroller", | ||
"version": "3.7.0", | ||
"version": "3.8.0", | ||
"author": "Pavol Hejný <me@pavolhejny.com> (https://pavolhejny.com)", | ||
@@ -69,4 +69,4 @@ "description": "Touch and mouse controller for web apps and games", | ||
"webpack-cli": "^4.2.0", | ||
"xyzt": "^4.4.2" | ||
"xyzt": "^4.6.0" | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
840387
44
1321
0