https://rawb.codeplex.com/SourceControl/latest#Rawb/Rawb/js/rawb.ui.js
Draggers
Draggers are typically used for resizing or moving elements on the page.
rawb.HDragger(obs, limitFn, consistencyPred, updateThrottle)
Template: anyShorthand for
rawb.Dragger(obs, limitFn, consistencyPred, undefined, undefined, undefined, updateThrottle).
Example HTML:
<div data-bind="event: { mousedown: hd.startDragging }">
</div>
Example JavaScript:
var x = ko.observable(100);
var limitFn = function (x) { return Math.max(0, Math.min(100, x)); };
var consistencyPred = undefined;
var hd = new rawb.HDragger(x, limitFn, consistencyPred);
ko.applyBindings({hd: hd});
VDragger(obs, limitFn, consistencyPred, updateThrottle)
Template: anyShorthand for
rawb.Dragger(undefined, undefined, undefined, obs, limitFn, consistencyPred, updateThrottle).
Example HTML:
<div data-bind="event: { mousedown: vd.startDragging }">
</div>
Example JavaScript:
var x = ko.observable(100);
var limitFn = function (x) { return Math.max(0, Math.min(100, x)); };
var consistencyPred = undefined;
var vd = new rawb.VDragger(x, limitFn, consistencyPred);
ko.applyBindings({vd: vd});
rawb.Dragger(hObs, hLimitFn, hConsistencyPred, vObs, vLimitFn, vConsistencyPred, updateThrottle)
Template: anyDraggers are used to manage mouse dragging in either or both axes.
If
d is a
Dragger, bind
d.startDragging to the
mousedown event of
the element requiring dragging behaviour.
See
rawb.HDragger and
rawb.VDragger.
ParametershObs: numberOptional (default
undefined); must be observable; exposed as an observable.
The observable number affected by horizontal mouse dragging (dragging to
the right by
n pixels increases the value of
hObs by
n).
hLimitFn: function (number) -> numberOptional (default
identity); may not be observable; exposed as non-observable.
The
hLimitFn can be used to bound changes to
hObs by mouse dragging.
hConsistencyPred: function () -> booleanOptional (default
truth); may not be observable; exposed as non-observable.
The
hConsistencyPred can be used to prevent changes to
hObs which would
cause some condition to be violated. That is, if dragging changes
hObs in
such a way that
hConsistencyPred returns false, then
hObs is restored to its
immediately previous value.
vObs: numberOptional (default
undefined); must be observable; exposed as an observable.
The observable number affected by vertical mouse dragging (dragging to
the right by
n pixels increases the value of vObs by
n).
vLimitFn: function (number) -> numberOptional (default
identity); may not be observable; exposed as non-observable.
The
vLimitFn can be used to bound changes to
vObs by mouse dragging.
vConsistencyPred: function () -> booleanOptional (default
truth); may not be observable; exposed as non-observable.
The
vConsistencyPred can be used to prevent changes to
vObs which would
cause some condition to be violated. That is, if dragging changes
vObs in
such a way that
vConsistencyPred returns false, then
vObs is restored to its
immediately previous value.
updateThrottle: numberOptional (default
20); must not be an observable; exposed as non-observable.
The minimum number of milliseconds between successive updates of
hObs or
vObs.
Since changing these on every mouse move is usually undesirable, this throttle
allows some control over the rate of updates.
Methodsdispose():
function ()Disposes Knockout subscriptions created by the
DropDown.
Use this when the
DropDown goes out of scope if you are concerned about memory leaks.