TK.Resize

new Resize(optionsopt)

TK.Resize allows resizing of elements. It does that by continuously resizing an element while the user drags a handle.

Parameters:
Name Type Attributes Default Description
options Object <optional>
{ }

An object containing initial options.

Properties:
Name Type Attributes Default Description
options.node HTMLElement

The element to resize.

options.handle HTMLElement <optional>

A DOM node used as handle. If none set the element is used.

active Boolean <optional>
true

Set to false to disable resizing.

options.min Object <optional>
{x: -1, y: -1}

Object containing x and y determining minimum size. A value of -1 means no minimum.

options.max Object <optional>
{x: -1, y: -1}

Object containing x and y determining maximum size. A value of -1 means no maximum.

Source:

Extends

Methods inherited from TK.Base

add_event(event, func, prevent, stop)

Register an event handler.

add_events(events, func)

Add multiple event handlers at once, either as dedicated event handlers or a list of event descriptors with a single handler function.

delegate_events(element) → {HTMLElement}

Delegates all occuring DOM events of a specific DOM node to the widget. This way the widget fires e.g. a click event if someone clicks on the given DOM node.

destroy()

Destroys all event handlers and the options object.

fire_event(event, …args)

Fires an event.

fire_events(events)

Fires several events.

get(key)

Get the value of an option.

has_event_listeners(event) → {boolean}

Test if the event descriptor has some handler functions in the queue.

remove_event(event, fun)

Removes the given function from the event queue. If it is a native DOM event, it removes the DOM event listener as well.

remove_events(events, func)

Remove multiple event handlers at once, either as dedicated event handlers or a list of event descriptors with a single handler function.

set(key, value)

Sets an option. Fires both the events set with arguments key and value; and the event 'set_'+key with arguments value and key.

set_options(optionsopt)

Merges a new options object into the existing one, including deep copies of objects. If an option key begins with the string "on" it is considered as event handler. In this case the value should be the handler function for the event with the corresponding name without the first "on" characters.

userset(key, value)

Sets an option by user interaction. Emits the userset event. The userset event can be cancelled (if an event handler returns false), in which case the option is not set. Returns true if the option was set, false otherwise. If the option was set, it will emit a useraction event.

Events

resizestart

Is fired when resizing starts.

Parameters:
Name Type Description
event DOMEvent

The native DOM event.

Source:

resizestop

Is fired when resizing stops.

Parameters:
Name Type Description
event DOMEvent

The native DOM event.

Source:

resizing

Is fired when resizing is in progress.

Parameters:
Name Type Description
event DOMEvent

The native DOM event.

width int

The new width of the element.

height int

The new height of the element.

Source:

Events inherited from TK.Base

delegated

Is fired when an element is delegated.

initialized

Is fired when an instance is initialized.

set

Is fired when an option is set.

set_[option]

Is fired when an option is set.