UNPKG

8.77 kBTypeScriptView Raw
1/**
2 * ============================================================================
3 * IMPORTS
4 * ============================================================================
5 * @hidden
6 */
7import { Sprite } from "./Sprite";
8import { EventListener, TargetedEventDispatcher, AMEvent } from "./utils/EventDispatcher";
9import { IInteractionObjectEvents } from "./interaction/InteractionObject";
10import { IPointer } from "./interaction/Pointer";
11import { IPoint } from "./defs/IPoint";
12/**
13 * ============================================================================
14 * RE-EXPORTS
15 * ============================================================================
16 * @hidden
17 */
18export { AMEvent };
19/**
20 * An [[EventDispatcher]] for [[Sprite]].
21 *
22 * @important
23 */
24export declare class SpriteEventDispatcher<T extends AMEvent<Sprite, ISpriteEvents>> extends TargetedEventDispatcher<Sprite, T> {
25 /**
26 * [_interactionEvents description]
27 *
28 * @todo Description
29 */
30 private _interactionEvents;
31 /**
32 * [_dispatchSpriteEvent description]
33 *
34 * @todo Description
35 */
36 private _dispatchSpriteEvent;
37 /**
38 * [_dispatchSpritePointEvent description]
39 *
40 * @todo Description
41 */
42 private _dispatchSpritePointEvent;
43 /**
44 * [_addInteractionObjectEvent description]
45 *
46 * @todo Description
47 */
48 private _addInteractionObjectEvent;
49 /**
50 * [_on description]
51 *
52 * @todo Description
53 */
54 protected _on<A, B, Key extends keyof T>(once: boolean, type: Key | null, callback: A, context: B, shouldClone: boolean, dispatch: (type: Key, event: T[Key]) => void): EventListener<T>;
55}
56/**
57 * Defines a type of event that has a single point of reference.
58 */
59export declare type SpritePointerTypeEvent = {
60 /**
61 * Is event originated by touch pointer?
62 */
63 touch: boolean;
64};
65/**
66 * Defines property set for a [[Sprite]] event that contains point information.
67 */
68export declare type SpritePointEvent = {
69 /**
70 * Event point in global (document) coordinates.
71 */
72 point: IPoint;
73 /**
74 * Event point in local Sprite coordinates.
75 */
76 spritePoint: IPoint;
77 /**
78 * Event point with chart (svg) coodinates.
79 */
80 svgPoint: IPoint;
81};
82/**
83 * Defines a type of event that has a related Pointer.
84 */
85export declare type SpritePointerEvent = {
86 /**
87 * Coordinates of the primary cursor position.
88 */
89 pointer: IPointer;
90};
91/**
92 * Defines property set for a [[Sprite]] event that contains mouse or touch
93 * event.
94 */
95export declare type SpriteMouseTouchEvent = {
96 /**
97 * Original mouse/touch event.
98 */
99 event: MouseEvent | TouchEvent;
100};
101/**
102 * Defines property set for a [[Sprite]] event that contains coordinate shift
103 * information, such as drag events.
104 */
105export declare type SpriteShiftEvent = {
106 /**
107 * Shift in coordinates after dragging.
108 */
109 shift: IPoint;
110};
111/**
112 * Defines available events available for [[Sprite]].
113 */
114export interface ISpriteEvents extends IInteractionObjectEvents {
115 /**
116 * Invoked when Sprite completes transition to a [[SpriteState]].
117 */
118 transitionended: {};
119 /**
120 * Invoked when size of the Sprite changes.
121 */
122 sizechanged: {};
123 /**
124 * Invoked when maximum available size of the Sprite changes, i.e. when the
125 * size of parent container changes.
126 */
127 maxsizechanged: {
128 previousWidth: number;
129 previousHeight: number;
130 };
131 /**
132 * @todo Description
133 */
134 transformed: {
135 /**
136 * [string description]
137 * @todo Needs description
138 */
139 dummyData?: string;
140 };
141 /**
142 * Invoked when position of the [[Sprite]] changes.
143 */
144 positionchanged: {};
145 /**
146 * Invoked when [[Sprite]] is initialized.
147 */
148 inited: {};
149 /**
150 * Invoked when [[Sprite]] appears. Sprite appears when `sprite.appear()` method
151 * is called and show animation is finished.
152 */
153 appeared: {};
154 /**
155 * Invoked when chart is shown if `am4core.options.queue = true` or/and `am4core.options.onlyShowOnViewport = true`.
156 */
157 removedfromqueue: {};
158 /**
159 * Invoked when [[Sprite]] is becomes ready, that is it has finished all
160 * calculations and building itself.
161 *
162 * For [[Container]] object (and all those inheriting it, including charts)
163 * this event will fire when all children become ready.
164 */
165 ready: {};
166 /**
167 * Invoked before [[Sprite]] is validated.
168 *
169 * @todo Description (check)
170 */
171 beforevalidated: {};
172 /**
173 * Invoked when [[Sprite]] is validated. (on init or after update)
174 *
175 * @todo Description (check)
176 */
177 validated: {};
178 /**
179 * Invoked when visibility of the [[Sprite]] changes. (from visible to hidden,
180 * and vice versa)
181 */
182 visibilitychanged: {
183 visible: boolean;
184 };
185 /**
186 * Invoked when hidden [[Sprite]] is shown.
187 */
188 shown: {};
189 /**
190 * Invoked when visible [[Sprite]] is hidden.
191 */
192 hidden: {};
193 /**
194 * Invoked when zIndex of a sprite is changed
195 */
196 zIndexChanged: {};
197 /**
198 * Invoked when property of the [[Sprite]] changes.
199 */
200 propertychanged: {
201 /**
202 * Property key.
203 */
204 property: string;
205 };
206 /**
207 * Invoked when the global scale changed, meaning that scale of [[Sprite]]
208 * or any of its ascendants changed.
209 */
210 globalscalechanged: {};
211 /**
212 * Invoked when [[Sprite]] is clicked or touched.
213 */
214 hit: SpritePointerTypeEvent & SpritePointEvent & SpriteMouseTouchEvent;
215 /**
216 * Invoked when [[Sprite]] is clicked or touched twice in rapid succession.
217 */
218 doublehit: SpritePointerTypeEvent & SpritePointEvent & SpriteMouseTouchEvent;
219 /**
220 * Invoked when pointer (mouse cursor or touch point) moves over `trackable`
221 * [[Sprite]].
222 */
223 track: SpritePointerTypeEvent & SpritePointEvent & SpritePointerEvent & SpriteMouseTouchEvent;
224 /**
225 * Invoked when user turns mouse wheel while over the [[Sprite]].
226 */
227 wheel: SpritePointEvent & SpriteShiftEvent & {
228 /**
229 * Original JavaScript event.
230 */
231 event: WheelEvent;
232 };
233 /**
234 * Invoked when user turns mouse wheel upwards while over the [[Sprite]].
235 */
236 wheelup: SpritePointEvent & SpriteShiftEvent & {
237 /**
238 * Original JavaScript event
239 */
240 event: WheelEvent;
241 };
242 /**
243 * Invoked when user turns mouse wheel downwards while over the [[Sprite]].
244 */
245 wheeldown: SpritePointEvent & SpriteShiftEvent & {
246 /**
247 * Original JavaScript event.
248 */
249 event: WheelEvent;
250 };
251 /**
252 * Invoked when user turns mouse wheel leftwards while over the [[Sprite]].
253 */
254 wheelleft: SpritePointEvent & SpriteShiftEvent & {
255 /**
256 * Original JavaScript event
257 */
258 event: WheelEvent;
259 };
260 /**
261 * Invoked when user turns mouse wheel rightwards while over the [[Sprite]].
262 */
263 wheelright: SpritePointEvent & SpriteShiftEvent & {
264 /**
265 * Original JavaScript event.
266 */
267 event: WheelEvent;
268 };
269 /**
270 * Invoked when `togglable` Sprite is being toggled on and off. (its
271 * `isActive` property is being changed)
272 */
273 toggled: {};
274 /**
275 * Invoked just before Sprite is disposed.
276 */
277 beforedisposed: {};
278 /**
279 * Invoked when sprite is disabled
280 */
281 disabled: {};
282 /**
283 * Invoked when sprite is enabled
284 */
285 enabled: {};
286 /**
287 * Invoked when `draggable` object is being dragged. (using mouse, touch or
288 * keyboard).
289 *
290 * This is simmilar but different then `"drag"` event in that it kicks in
291 * after `"drag"` which modifies [[Sprite]] coordinates. This allows doing
292 * own manipulations and corrections to element positions.
293 */
294 dragged: SpritePointerTypeEvent & SpriteShiftEvent & SpritePointEvent & {
295 /**
296 * Original coordinates of the pointer's position when the dragging started.
297 */
298 startPoint: IPoint;
299 /**
300 * An original JavaScript event that triggered dragging.
301 */
302 event?: MouseEvent | TouchEvent | KeyboardEvent;
303 };
304 /**
305 * Invoked when a sprite is added to a parent
306 */
307 parentset: {};
308}
309
\No newline at end of file