Home Manual Reference Source
import Highendrawer from 'highendrawer/src/highendrawer.js'
public class | source

Highendrawer

Class providing a drawer function.

Example:

var drawer = new Highendrawer({
  element: document.getElementById('drawer')
});

Constructor Summary

Public Constructor
public

constructor(drawer: Drawer)

Initialize object.

Member Summary

Public Members
public

Drawer status ('open' or 'close')

Private Members
private

_drawer: *

private
private
private

_id: *

private
private
private
private
private
private

Method Summary

Public Methods
public

close(duration: number, isFireEvent: boolean, isChangeHistory: boolean): Promise

Close drawer.

public

create()

Create the drawer set.

public

Destroy the drawer set.

public

open(duration: number, isFireEvent: boolean, isChangeHistory: boolean): Promise

Open drawer.

public

toggle(duration: number, isFireEvent: boolean, isChangeHistory: boolean): Promise

Toggle drawer.

Private Methods
private

Change overlay state.

private

_changeState(position: number, duration: number, callbacks: Object, isChangeHistory: boolean): Promise

Return whether or not a valid touch.

private

Return a value converted to the absolute value of the pixel.

private

Create drawer.

private

Create overlay.

private

_cssAnimate(duration: number)

Make animation with CSS3.

private

Destroy drawer.

private

Destroy overlay.

private

_getDistance(moveInfo: Object): number

Return the distance of the drawer.

private

Return drawer event handler.

private

Return the position in the style.

private

Return the position of the drawer.

private

_getDrawerStyle(position: number, duration: number): Object

Return style for moving the drawer.

private

Return initial style of drawer.

private

Return to the minimum position for the drawer.

private

Return the opacity of the overlay.

private

Return the opacity in the style.

private

_getOverlayStyle(opacity: float, duration: number): Object

Return style for moving the overlay.

private

Return the swipe range.

private

Return the state of the drawer.

private

_getTouchMoveInfo(touchbasis: Object, touchlast: Object): Object

Return the information of touch move.

private

Return state by touch movement.

private

_handleCallback(promise: Promise, callbacks: Object): Promise

Return the information of touch move.

private

Hide drawer.

private

Hide overlay.

private

Return whether or not a valid touch direction.

private

Return whether or not a valid touch point.

private

_jsAnimate(duration: number)

Make animation with Javascript.

private

Return the numeric normalized information.

private

Return the normalized pixel value.

private

_onTouchFinish(ev: Event)

Touch finish event handler.

private

_onTouchMove(ev: Event)

Touch move event handler.

private

_onTouchStart(ev: Event)

Touch start event handler.

private

_resetDrawer(isUnset: boolean)

Reset drawer.

private

Set properties.

private

Show drawer.

private

Show overlay.

private

_touchHandler(ev: Event): boolean

Touch event handler.

Public Constructors

public constructor(drawer: Drawer) source

Initialize object.

Params:

NameTypeAttributeDescription
drawer Drawer

Initial parameters of drawer.

Public Members

public state: string source

Drawer status ('open' or 'close')

Private Members

private _drawer: * source

private _enabled: boolean source

private _handler: * source

private _id: * source

private _intervalId: * source

private _overlay: * source

private _position: * source

private _process: * source

private _sizePixel: * source

private _timeoutId: * source

Public Methods

public close(duration: number, isFireEvent: boolean, isChangeHistory: boolean): Promise source

Close drawer.

Params:

NameTypeAttributeDescription
duration number
  • optional

Drawer moving time.

isFireEvent boolean
  • optional

Whether to fire an event on the drawer.

isChangeHistory boolean
  • optional
  • default: false

Make a change in history.

Return:

Promise

Promise object for close.

public create() source

Create the drawer set.

public destroy() source

Destroy the drawer set.

public open(duration: number, isFireEvent: boolean, isChangeHistory: boolean): Promise source

Open drawer.

Params:

NameTypeAttributeDescription
duration number
  • optional

Drawer moving time.

isFireEvent boolean
  • optional

Whether to fire an event on the drawer.

isChangeHistory boolean
  • optional
  • default: false

Make a change in history.

Return:

Promise

Promise object for open.

public toggle(duration: number, isFireEvent: boolean, isChangeHistory: boolean): Promise source

Toggle drawer.

Params:

NameTypeAttributeDescription
duration number
  • optional

Drawer moving time.

isFireEvent boolean
  • optional

Whether to fire an event on the drawer.

isChangeHistory boolean
  • optional
  • default: false

Make a change in history.

Return:

Promise

Promise object for toggle.

Private Methods

private _changeOverlayState(state: string) source

Change overlay state.

Params:

NameTypeAttributeDescription
state string

Drawer status ('open' or 'close')

private _changeState(position: number, duration: number, callbacks: Object, isChangeHistory: boolean): Promise source

Return whether or not a valid touch.

Params:

NameTypeAttributeDescription
position number

Moving position.

duration number
  • optional
  • default: null

Drawer moving time.

callbacks Object
  • optional
  • default: null

Callback objects.

isChangeHistory boolean
  • optional
  • default: false

Make a change in history.

Return:

Promise

Promise object.

private _convertPixelAbs(value: string | number): number source

Return a value converted to the absolute value of the pixel.

Params:

NameTypeAttributeDescription
value string | number

Target value.

Return:

number

Converted to the absolute value of the pixel.

Throw:

Error

Is thrown if direction value is invalid.

private _createDrawer() source

Create drawer.

private _createOverlay() source

Create overlay.

private _cssAnimate(duration: number) source

Make animation with CSS3.

Params:

NameTypeAttributeDescription
duration number

Drawer moving time.

private _destroyDrawer() source

Destroy drawer.

private _destroyOverlay() source

Destroy overlay.

private _getDistance(moveInfo: Object): number source

Return the distance of the drawer.

Params:

NameTypeAttributeDescription
moveInfo Object

Movement information of the drawer.

Return:

number

Distance of the drawer.

Throw:

Error

Is thrown if direction value is invalid.

private _getDrawerHandler(): Object source

Return drawer event handler.

Return:

Object

Drawer event handler.

private _getDrawerPositionFromStyle(): number source

Return the position in the style.

Return:

number

Position in the style.

private _getDrawerPositionFromTouches(touchbasis: Object, touchlast: Object): number source

Return the position of the drawer.

Params:

NameTypeAttributeDescription
touchbasis Object

Basic touch information.

touchlast Object

Last touch information.

Return:

number

Position of the drawer.

private _getDrawerStyle(position: number, duration: number): Object source

Return style for moving the drawer.

Params:

NameTypeAttributeDescription
position number

Moving position.

duration number
  • optional

Drawer moving time.

Return:

Object

Move style for drawer.

private _getInitDrawerStyle(): Object source

Return initial style of drawer.

Return:

Object

Style for drawer.

private _getMinPosition(): number source

Return to the minimum position for the drawer.

Return:

number

Minimum position for the drawer.

Throw:

Error

Is thrown if direction value is invalid.

private _getOverlayOpacityFromPosition(position: number): number source

Return the opacity of the overlay.

Params:

NameTypeAttributeDescription
position number

Moving position.

Return:

number

Position of the drawer.

private _getOverlayOpacityFromStyle(): number source

Return the opacity in the style.

Return:

number

Opacity in the style.

private _getOverlayStyle(opacity: float, duration: number): Object source

Return style for moving the overlay.

Params:

NameTypeAttributeDescription
opacity float

Overlay opacity.

duration number
  • optional

Drawer moving time.

Return:

Object

Move style for overlay.

private _getRange(value: string | number): Object source

Return the swipe range.

Params:

NameTypeAttributeDescription
value string | number

Target swipe area value.

Return:

Object

Drag range.

Throw:

Error

Is thrown if direction value is invalid.

private _getStateFromPosition(): string source

Return the state of the drawer.

Return:

string

State of the drawer.

private _getTouchMoveInfo(touchbasis: Object, touchlast: Object): Object source

Return the information of touch move.

Params:

NameTypeAttributeDescription
touchbasis Object

Basic touch information.

touchlast Object

Last touch information.

Return:

Object

Movement distance of the x, y direction, movement direction.

private _getTouchMoveState(): string source

Return state by touch movement.

Return:

string

State by touch movement.

private _handleCallback(promise: Promise, callbacks: Object): Promise source

Return the information of touch move.

Params:

NameTypeAttributeDescription
promise Promise

Promise instance.

callbacks Object

Callback function with the key to 'done', 'fail', 'always' (each optional).

Return:

Promise

Promise instance.

private _hideDrawer() source

Hide drawer.

private _hideOverlay() source

Hide overlay.

private _isTouchDirectionActive(): boolean source

Return whether or not a valid touch direction.

Return:

boolean

Result of valid touch direction.

private _isTouchPointActive(): boolean source

Return whether or not a valid touch point.

Return:

boolean

Result of valid touch point.

private _jsAnimate(duration: number) source

Make animation with Javascript.

Params:

NameTypeAttributeDescription
duration number

Drawer moving time.

private _normalizeNumber(value: string | number): Object source

Return the numeric normalized information.

Params:

NameTypeAttributeDescription
value string | number

Target value.

Return:

Object

Numeric normalized information.

Throw:

Error

Is thrown if value is invalid.

private _normalizePixel(value: string | number): number source

Return the normalized pixel value.

Params:

NameTypeAttributeDescription
value string | number

Target value.

Return:

number

Normalized pixel value.

Throw:

Error

Is thrown if direction value is invalid.

private _onTouchFinish(ev: Event) source

Touch finish event handler.

Params:

NameTypeAttributeDescription
ev Event

Touch event object.

private _onTouchMove(ev: Event) source

Touch move event handler.

Params:

NameTypeAttributeDescription
ev Event

Touch event object.

private _onTouchStart(ev: Event) source

Touch start event handler.

Params:

NameTypeAttributeDescription
ev Event

Touch event object.

private _resetDrawer(isUnset: boolean) source

Reset drawer.

Params:

NameTypeAttributeDescription
isUnset boolean
  • optional

Unset style.

private _setProps() source

Set properties.

private _showDrawer() source

Show drawer.

private _showOverlay() source

Show overlay.

private _touchHandler(ev: Event): boolean source

Touch event handler.

Params:

NameTypeAttributeDescription
ev Event

Touch event object.

Return:

boolean

Event bubbling.