-
Notifications
You must be signed in to change notification settings - Fork 0
/
scrollmapWithZoom.d.ts
435 lines (435 loc) · 17.6 KB
/
scrollmapWithZoom.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
declare var isDebug: boolean;
declare var debug: any;
declare var error: any;
declare const define: Function;
declare const ebg: any;
declare const $: Function;
declare const dojo: any;
declare const dijit: any;
declare function _(str: string): string;
declare function __(lanf: string, str: string): string;
declare const g_gamethemeurl: string;
declare const gameui: any;
declare const toint: Function;
declare const aspect: any;
type _optionsChangedT = {
bWheelZooming?: boolean;
wheelZooming?: number;
pinchZooming?: boolean;
btnsDivOnMap?: boolean;
btnsDivPositionOutsideMap?: string;
btns_visible?: boolean;
bRevertArrowsScroll?: boolean;
bOneFingerScrolling?: boolean;
bShowMoveCursor?: boolean;
bAutoCompensatePanelsHeight?: boolean;
bAutoCompensateChatIcon?: boolean;
};
interface Position {
x: number;
y: number;
}
declare class ScrollmapWithZoom {
version: String;
private static count;
private static instances;
private static _form;
private static _formDialog;
private static _core_patched;
/**
* board properties
*/
board_x: number;
board_y: number;
startPosition: Position;
container_div: HTMLElement;
container_subdiv: HTMLElement;
scrollable_div: HTMLElement;
surface_div: HTMLElement;
onsurface_div: HTMLElement;
clipped_div: HTMLElement;
animation_div: HTMLElement;
/**
* zoom properties
*/
zoom: number;
maxZoom: number;
minZoom: number;
defaultZoom: number;
zoomingOptions: {
bWheelZooming: boolean;
wheelZooming: number;
pinchZooming: boolean;
};
zoomChangeHandler: Function;
zoomPinchDelta: number;
zoomWheelDelta: number;
zoomDelta: number;
get bEnableZooming(): boolean;
set bEnableZooming(value: boolean);
/**
* scrolling properties
*/
bEnableScrolling: boolean;
scrollingOptions: {
bOneFingerScrolling: boolean;
bShowMoveCursor: boolean;
};
bScrollDeltaAlignWithZoom: boolean;
bRestoreScrollPosition: boolean;
scrollDelta: number;
scrollingTresh: number;
defaultPosition: Position;
centerPositionOffset: Position;
centerCssQuery: string;
centerCalcUseAlsoOnsurface: boolean;
get bRevertArrowsScroll(): boolean;
set bRevertArrowsScroll(value: boolean);
/**
* resizing properties
*/
set minHeight(value: number);
get minHeight(): number;
incrHeightGlobalKey: string;
incrHeightDelta: number;
bIncrHeightKeepInPos: boolean;
bAdaptHeightAutoCompensateChatIcon: boolean;
bAdaptHeightAutoCompensatePanelsHeight: boolean;
get bAdaptHeightAuto(): boolean;
set bAdaptHeightAuto(value: boolean);
set adaptHeightCorrDivs(value: HTMLDivElement[]);
get adaptHeightCorrDivs(): HTMLDivElement[];
get bIncrHeightGlobally(): boolean;
set bIncrHeightGlobally(value: boolean);
get bIncrHeightBtnVisible(): boolean;
set bIncrHeightBtnVisible(value: boolean);
get bIncrHeightBtnIsShort(): boolean;
set bIncrHeightBtnIsShort(value: boolean);
get bIncrHeightBtnGroupedWithOthers(): boolean;
set bIncrHeightBtnGroupedWithOthers(value: boolean);
adaptHeightCorr: number;
get bInfoBtnVisible(): boolean;
/**
* enable/disble keys
*/
static get bEnableKeys(): boolean;
static set bEnableKeys(value: boolean);
bEnableKeysArrows: boolean;
bEnableKeysPlusMinus: boolean;
bEnableKeyHome: boolean;
bEnableKeyEnd: boolean;
/**
* enable/disble long press on buttons
*/
bEnableLongPress: boolean;
/**
* info button
*/
set bInfoBtnVisible(value: boolean);
/**
* buttons default classes
*/
btnMoveRightClasses: string;
btnMoveLeftClasses: string;
btnMoveTopClasses: string;
btnMoveDownClasses: string;
btnZoomPlusClasses: string;
btnZoomMinusClasses: string;
btnResetClasses: string;
btnZoomToFitClasses: string;
btnResetHeightClasses: string;
btnMaximizeHeightClasses: string;
btnIncreaseHeightClasses: string;
btnDecreaseHeightClasses: string;
btnToggleButtonsVisibilityClasses: string;
btnSettingsClasses: string;
btnInfoClasses: string;
btnsDivClasses: string;
btnMoveRightHtml: string;
btnMoveLeftHtml: string;
btnMoveTopHtml: string;
btnMoveDownHtml: string;
btnZoomPlusHtml: string;
btnZoomMinusHtml: string;
btnResetHtml: string;
btnInfoHtml: string;
btnZoomToFitHtml: string;
btnIncreaseHeightHtml: string;
btnDecreaseHeightHtml: string;
btnIncreaseHeightShortHtml: string;
btnDecreaseHeightShortHtml: string;
btnResetHeightHtml: string;
btnMaximizeHeightHtml: string;
btnToggleButtonsVisibilityHtml: string;
btnSettingsHtml: string;
btnsDivPositionnable: boolean;
btnsDivOnMap: boolean;
btns2DivOnMap: boolean;
btnsDivPositionOutsideMap: string;
btnsPositionClasses: string;
btns2PositionClasses: string;
btnsBackgroundColor: string;
btnsMarginX: string;
btnsMarginY: string;
btnsOffsetX: string;
btnsOffsetY: string;
btnsOutsideMapOffsetX: string;
btnsOutsideMapOffsetY: string;
btnsSize: string;
btnsFontSize: string;
btnsAroundSize: string;
get longPressScroll(): number;
set longPressScroll(value: number);
longPressZoom: number;
protected static _optionsChanged: _optionsChangedT;
protected _cover_arrows: boolean;
protected _x_extra_l: number;
protected _x_extra_r: number;
protected _y_extra_u: number;
protected _y_extra_d: number;
protected _prevZoom: number;
protected _bEnableZooming: boolean;
protected _scrollDeltaAlignWithZoom: number;
protected _longPressScrollAlignWithZoom: number;
protected _bHeightChanged: boolean;
protected _bMaxHeight: boolean;
protected _minHeight: number;
protected _orig_minHeight: number;
protected _bAdaptHeightAuto: boolean;
protected _adaptHeightCorrDivs: Array<HTMLDivElement>;
protected _bIncrHeightGlobally: boolean;
protected _bIncrHeightBtnVisible: boolean;
protected _bIncrHeightBtnIsShort: boolean;
protected _bIncrHeightBtnGroupedWithOthers: boolean;
protected _bInfoBtnVisible: boolean;
protected _bBtnsVisible: boolean;
protected _pointers: Map<number, any>;
protected _classNameSuffix: string;
protected _longPress: boolean;
protected _keysPressed: Map<string, any>;
protected static _bEnableKeys: boolean;
protected _enableTooltipsAndClickTimerId: number;
protected _enabledTooltips: boolean;
protected _enabledClicks: boolean;
protected _enableTooltipsAndClick_handler: (this: HTMLElement, ev: MouseEvent) => any;
protected _resizeObserver: ResizeObserver;
protected _resizeHeadersObserver: ResizeObserver;
protected _onpointermove_handler: (this: HTMLElement, ev: MouseEvent) => any;
protected _onpointerup_handler: (this: HTMLElement, ev: MouseEvent) => any;
protected _onpointerup_handled: boolean;
protected _suppressCLickEvent_handler: (this: HTMLElement, ev: MouseEvent) => any;
protected _touchInteracting: boolean;
protected _setupDone: boolean;
protected _zoomFitCalledDuringSetup: boolean;
protected _adaptHeightDone: boolean;
protected _titleHeight: number;
protected _bConfigurableInUserPreference: boolean;
protected _btnMoveRight: HTMLElement;
protected _btnMoveLeft: HTMLElement;
protected _btnMoveTop: HTMLElement;
protected _btnMoveDown: HTMLElement;
protected _btnZoomPlus: HTMLElement;
protected _btnZoomMinus: HTMLElement;
protected _btnReset: HTMLElement;
protected _btnInfo: HTMLElement;
protected _btnZoomToFit: HTMLElement;
protected _btnIncreaseHeight: HTMLElement;
protected _btnDecreaseHeight: HTMLElement;
protected _btnResetHeight: HTMLElement;
protected _btnMaximizeHeight: HTMLElement;
protected _btnToggleButtonsVisiblity: HTMLElement;
protected _btnZoomPlusNames: string;
protected _btnZoomMinusNames: string;
protected _btnResetNames: string;
protected _btnZoomToFitNames: string;
protected _btnIncreaseHeightNames: string;
protected _btnDecreaseHeightNames: string;
protected _bEnlargeReduceButtonsInsideMap: boolean;
protected _buttons_div: HTMLElement;
protected _buttons_div2: HTMLElement;
protected _buttons_divs_wrapper: HTMLElement;
protected _defaultHeight: number;
protected _xPrev: number;
protected _yPrev: number;
protected _xPrevMid: number;
protected _yPrevMid: number;
protected _scrolling: boolean;
protected _scrolltoBusy: boolean;
protected _startScrollAnimDuration: number;
protected _passiveEventListener: {};
protected _notPassiveEventListener: {};
protected _loadedSettings: boolean;
private static _localStorageGameKey;
protected _localStorageKey: string;
protected _localStorageOldKey: string;
protected _scrolled: boolean;
protected _prevDist: number;
protected _gestureStart: boolean;
protected _prevTouchesDist: number;
protected _prevTouchesMiddle: DOMPoint;
protected _isScrolling: number;
protected _resetMode: ScrollmapWithZoom.ResetMode;
protected _bRevertArrowsScroll: boolean;
protected _longPressScroll: number;
protected _longPressScrollOriented: number;
constructor();
protected static onShowTooltip(this: typeof dijit.Tooltip): void;
create(container_div: HTMLElement, scrollable_div: HTMLElement, surface_div: HTMLElement, onsurface_div: HTMLElement, clipped_div?: HTMLElement, animation_div?: HTMLElement, page?: object, create_extra?: Function): void;
createCompletely(container_div: HTMLElement, page?: object, create_extra?: Function, bEnlargeReduceButtonsInsideMap?: boolean): void;
protected _init(): void;
protected _RepositionButtonsDiv(options?: {
btnsDivOnMap?: boolean;
btnsDivPositionOutsideMap?: string;
}): void;
protected _createForm(): void;
protected _showForm(): void;
protected _submitForm(): boolean;
protected _closeForm(): boolean;
protected _adaptHeight(): void;
protected _onResize(): void;
protected _clearOldSettings(): void;
protected _loadSettings(): boolean;
protected saveSettings(): void;
protected static _saveGameSettings(): void;
protected _onvisibility_changehandler(e: Event): void;
protected _onbeforeunload_handler(e: Event): void;
protected _updatePointers(event: PointerEvent | TouchEvent | MouseEvent): any;
protected _removePointers(event: PointerEvent | TouchEvent | MouseEvent): void;
protected _getPageZoom(): number;
protected _getInterfaceFactor(): number;
protected _getXYCoord(ev: PointerEvent | Touch | MouseEvent, ev2?: PointerEvent | Touch | MouseEvent): any[];
protected _enableInteractions(): void;
protected _disableInteractions(): void;
protected _enableTooltipsAndClick(): void;
protected _disableTooltipsAndClick(setTimer?: boolean): void;
protected _suppressCLickEvent(e: Event): void;
protected _getTouchesDist(e: TouchEvent): number;
protected _getTouchesMiddle(e: TouchEvent): DOMPoint;
protected _handleTouch(e: TouchEvent): void;
protected _onPointerEnter(ev: PointerEvent): void;
protected _onPointerDown(ev: PointerEvent): void;
protected _onPointerMove(ev: PointerEvent | TouchEvent | MouseEvent): void;
protected _onPointerUp(ev: PointerEvent | TouchEvent | MouseEvent): void;
protected _onWheel(evt: WheelEvent): void;
scroll(dx: number, dy: number, duration?: number, delay?: number): void;
scrollto(x: number, y: number, duration?: number, delay?: number): void;
scrolltoAndZoom(x: number, y: number, zoom: number, duration?: number, delay?: number): void;
scrolltoObjectAndZoom(obj: HTMLElement | string, zoom: number, duration?: number, delay?: number): void;
scrolltoObject(obj: HTMLElement | string, duration?: number, delay?: number): void;
protected _scrollto(x: number, y: number, duration?: number, delay?: number): void;
zoomToFitAndScrollToCenter(custom_css_query?: string, duration?: number, delay?: number, x_extra_l?: number, x_extra_r?: number, y_extra_u?: number, y_extra_d?: number, cover_arrows?: boolean): {
x: number;
y: number;
};
scrollToCenter(custom_css_query?: string, duration?: number, delay?: number, x_extra_l?: number, x_extra_r?: number, y_extra_u?: number, y_extra_d?: number): {
x: number;
y: number;
};
protected reset(duration?: number): void;
protected _isRectInside(outerRect: DOMRectReadOnly, innerRect: DOMRectReadOnly): boolean;
protected _intersect(rect1: DOMRectReadOnly, rect2: DOMRectReadOnly): boolean;
protected _adjustToContain(outerRect: DOMRect, innerRect: DOMRect, margin?: number): {
x: number;
y: number;
};
isObjVisible(obj: HTMLElement): boolean;
isVisible(x: number, y: number, w?: number, h?: number): boolean;
_makeRectVisible(obj_rect: DOMRect, board_rect: DOMRect, centerOnIt?: boolean, excl_width?: number, excl_height?: number, pos?: "topleft" | "topright" | "bottomleft" | "bottomright"): void;
makeObjVisible(obj: HTMLElement, centerOnIt?: boolean, excl_width?: number, excl_height?: number, pos?: "topleft" | "topright" | "bottomleft" | "bottomright"): void;
makeVisible(x: number, y: number, w?: number, h?: number, centerOnIt?: boolean, excl_width?: number, excl_height?: number, pos?: "topleft" | "topright" | "bottomleft" | "bottomright"): void;
getMapLimits(custom_css_query?: string): {
min_x: number;
max_x: number;
min_y: number;
max_y: number;
};
getMapCenter(custom_css_query?: string): {
x: number;
y: number;
};
zoomToFit(x_extra_l?: number, x_extra_r?: number, y_extra_u?: number, y_extra_d?: number, cover_arrows?: boolean): void;
changeMapZoom(diff: number, x?: number, y?: number): void;
setMapZoom(zoom: number, x?: number, y?: number): void;
protected _setScale(elemId: HTMLElement, scale: number): void;
protected _getButton(btnNames: string[] | string, idSuffix?: string): HTMLElement;
protected _toggleButtonsVisiblity(): void;
protected _setButtonsVisiblity(visible: boolean, dispatch?: boolean): void;
private static _toggleButtonsVisiblity;
protected _hideButton($btn: HTMLElement, idSuffix?: string): void;
protected _showButton($btn: HTMLElement, idSuffix?: string, display?: string): void;
protected _enableButton($btn: HTMLElement, idSuffix?: string): void;
protected _disableButton($btn: HTMLElement, idSuffix?: string, display?: string): void;
protected _createButton(button_code: string): HTMLElement;
protected _initButton(btnNames: string, defaultButton: string, tooltip?: string, onClick?: Function, onLongPressedAnim?: Function, destDiv?: HTMLElement, idSuffix?: string, display?: string): HTMLElement;
protected _onButtonLongPress(onLongPressedAnim: Function, evt: Event): void;
protected _onButtonLongPressEnd(evt: Event): void;
setupKeys(): void;
protected _onKeyDown(e: KeyboardEvent): void;
protected _onKeyLongPress(key: string): boolean;
protected _onKeyLongPressAnim(key: string): boolean;
protected _onKeyUp(e: KeyboardEvent): void;
setupOnScreenArrows(scrollDelta: number, bScrollDeltaAlignWithZoom?: boolean): void;
showOnScreenArrows(): void;
hideOnScreenArrows(): void;
protected _onMoveTop(evt?: Event): void;
protected _onMoveLeft(evt?: Event): void;
protected _onMoveRight(evt?: Event): void;
protected _onMoveDown(evt?: Event): void;
enableScrolling(): void;
disableScrolling(): void;
setupOnScreenZoomButtons(zoomDelta?: number): void;
showOnScreenZoomButtons(): void;
hideOnScreenZoomButtons(): void;
protected _onZoomIn(evt?: Event): void;
protected _onZoomOut(evt?: Event): void;
setupOnScreenResetButtons(resetMode?: ScrollmapWithZoom.ResetMode): void;
showOnScreenResetButtons(): void;
hideOnScreenResetButtons(): void;
protected onReset(): void;
protected _getEnlargeReduceButtonsProps(bInsideMap: boolean): {
idSuffix: string;
display: string;
};
protected _setupEnlargeReduceButtons(bInsideMap: boolean, bShort?: boolean, destDiv?: HTMLElement): boolean;
setupEnlargeReduceButtons(incrHeightDelta: number, bIncrHeightKeepInPos?: boolean, minHeight?: number, bShort?: boolean, bGroupedWithOthers?: boolean): void;
showEnlargeReduceButtons(): void;
hideEnlargeReduceButtons(): void;
protected _onResetHeight(evt: Event): void;
protected _onMaximizeHeight(evt: Event): void;
protected _onIncreaseDisplayHeight(evt: Event): void;
protected _onDecreaseDisplayHeight(evt: Event): void;
changeDisplayHeight(delta: number): boolean;
setDisplayHeight(new_height: number, dispatch?: boolean): boolean;
static updateHeight(new_height: number, incrHeightGlobalKey: string): void;
getDisplayHeight(): number;
setupInfoButton(bConfigurableInUserPreference?: boolean): void;
showInfoButton(): void;
hideInfoButton(): void;
getInfoButtonTooltip(): string;
setInfoButtonTooltip(): void;
setBShowMoveCursor(): void;
getWheelZoomingOptionTranslated(): string;
}
declare namespace ScrollmapWithZoom {
enum wheelZoomingKeys {
Any = 1,
None = 2,
AnyOrNone = 3,
Ctrl = 4,
Alt = 8,
Shift = 16,
Meta = 32
}
enum ResetMode {
Scroll = 0,
ScrollAndZoom = 1,
ScrollAndZoomFit = 2
}
enum btnsDivPositionE {
Top = "scrollmap_btns_top",
Bottom = "scrollmap_btns_bottom",
Left = "scrollmap_btns_left",
Right = "scrollmap_btns_right",
Center = "scrollmap_btns_center"
}
}