-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from jeanbenitez/typing
Added initial definitions for Typescript Support
- Loading branch information
Showing
2 changed files
with
117 additions
and
1 deletion.
There are no files selected for viewing
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,114 @@ | ||
import * as PIXI from 'pixi.js' | ||
import { Viewport } from 'pixi-viewport' | ||
|
||
type OverflowScrollType = 'none' | 'scroll' | 'hidden' | 'auto' | ||
type UnderflowType = 'center' | 'top' | 'left' | 'right' | 'bottom' | string | ||
interface ResizeOptions { | ||
boxWidth?: number | ||
boxHeight?: number | ||
scrollWidth?: number | ||
scrollHeight?: number | ||
} | ||
|
||
interface ScrollBoxOptions { | ||
boxHeight?: number | ||
boxWidth?: number | ||
scrollbarSize?: number | ||
scrollbarBackground?: number | ||
scrollbarBackgroundAlpha?: number | ||
scrollbarForeground?: number | ||
scrollbarForegroundAlpha?: number | ||
dragScroll?: boolean | ||
stopPropagation?: boolean | ||
scrollbarOffsetHorizontal?: number | ||
scrollbarOffsetVertical?: number | ||
underflow?: UnderflowType | ||
fade?: boolean | ||
fadeScrollbar?: boolean | ||
fadeScrollbarTime?: number | ||
fadeScrollboxWait?: number | ||
fadeScrollboxEase?: string | Function | ||
passiveWheel?: boolean | ||
clampWheel?: boolean | ||
overflowX?: OverflowScrollType | ||
overflowY?: OverflowScrollType | ||
overflow?: OverflowScrollType | ||
noTicker?: boolean | ||
ticker?: PIXI.Ticker | ||
} | ||
|
||
/** | ||
* pixi.js scrollbox: a masked content box that can scroll vertically or horizontally with scrollbars | ||
*/ | ||
export declare class ScrollBox extends PIXI.Container { | ||
boxHeight: number | ||
boxWidth: number | ||
content: Viewport | ||
readonly contentHeight: number | ||
readonly contentWidth: number | ||
dirty: boolean | ||
disable: boolean | ||
dragScroll: boolean | ||
readonly isScrollbarHorizontal: boolean | ||
readonly isScrollbarVertical: boolean | ||
overflow: string | ||
overflowX: string | ||
overflowY: string | ||
scrollbar: PIXI.Graphics | ||
scrollbarOffsetHorizontal: number | ||
scrollbarOffsetVertical: number | ||
scrollbarSize: number | ||
scrollHeight: number | ||
scrollLeft: number | ||
scrollTop: number | ||
scrollWidth: number | ||
stopPropagation: boolean | ||
|
||
/** | ||
* create a scrollbox | ||
*/ | ||
constructor(options?: ScrollBoxOptions) | ||
|
||
/** | ||
* show the scrollbar and restart the timer for fade if options.fade is set | ||
*/ | ||
activateFade(): void | ||
|
||
/** | ||
* ensure that the bounding box is visible | ||
*/ | ||
ensureVisible(x: number, y: number, width: number, height: number): void | ||
|
||
/** | ||
* resize the mask for the container | ||
*/ | ||
resize(options?: ResizeOptions): void | ||
|
||
/** | ||
* call when scrollbox content changes | ||
*/ | ||
update(): void | ||
|
||
/** | ||
* called on each frame to update fade scrollbars (if enabled) | ||
*/ | ||
updateLoop(elapsed: number): void | ||
|
||
private _drawMask(): void | ||
private _drawScrollbars(): void | ||
|
||
/** | ||
* handle pointer down on scrollbar | ||
*/ | ||
private scrollbarDown(e: PIXI.interaction.InteractionEvent): void | ||
|
||
/** | ||
* handle pointer move on scrollbar | ||
*/ | ||
private scrollbarMove(e: PIXI.interaction.InteractionEvent): void | ||
|
||
/** | ||
* handle pointer down on scrollbar | ||
*/ | ||
private scrollbarUp(): 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