private
void
_getNextX
(
)
Returns the next X tick value based on the current coord and the target coord.
private
void
_getNextY
(
)
Returns the next Y tick value based on the current coord and the target coord.
private
void
b4MouseDown
(
)
Resets the constraints before moving the thumb.
private
void
endMove
(
)
Fired when the slider movement ends
private
void
fireEvents
(
thumbEvent
)
Fires the change event if the value has been changed. Ignored if we are in
the middle of an animation as the event will fire when the animation is
complete
- Parameters:
-
thumbEvent <boolean>
set to true if this event is fired from an event
that occurred on the thumb. If it is, the state of the
thumb dd object should be correct. Otherwise, the event
originated on the background, so the thumb state needs to
be refreshed before proceeding.
- Returns:
void
private
void
focus
(
)
Try to focus the element when clicked so we can add
accessibility features
SliderThumb
getThumb
(
)
Returns a reference to this slider's thumb
- Returns:
SliderThumb
- this slider's thumb
int
getValue
(
)
Returns the slider's thumb offset from the start position
- Returns:
int
- the current value
int
getXValue
(
)
Returns the slider's thumb X offset from the start position
- Returns:
int
- the current horizontal offset
int
getYValue
(
)
Returns the slider's thumb Y offset from the start position
- Returns:
int
- the current vertical offset
void
handleKeyDown
(
e
)
Executed when a keydown event happens with the control focused.
Updates the slider value and display when the keypress is an
arrow key, home, or end as long as enableKeys is set to true.
- Parameters:
-
e <Event>
the keydown event
- Returns:
void
void
handleKeyPress
(
e
)
Executed when a keypress event happens with the control focused.
Prevents the default behavior for navigation keys. The actual
logic for moving the slider thumb in response to a key event
happens in handleKeyDown.
- Parameters:
-
e <Event>
the keypress event
- Returns:
void
private
void
handleThumbChange
(
)
Internal handler for the slider thumb's onChange event
void
initSlider
(
sType
)
Initializes the slider. Executed in the constructor
- Parameters:
-
sType <string>
the type of slider (horiz, vert, region)
- Returns:
void
void
initThumb
(
t
)
Initializes the slider's thumb. Executed in the constructor.
- Parameters:
-
t <YAHOO.widget.SliderThumb>
the slider thumb
- Returns:
void
void
lock
(
)
Locks the slider, overrides YAHOO.util.DragDrop
private
void
moveOneTick
(
the
)
Move the slider one tick mark towards its final coordinate. Used
for the animation when tick marks are defined
- Parameters:
-
the <int[]>
destination coordinate
- Returns:
void
private
void
moveThumb
(
x
,
y
,
skipAnim
)
Move the associated slider moved to a timeout to try to get around the
mousedown stealing moz does when I move the slider element between the
cursor and the background during the mouseup event
- Parameters:
-
x <int>
the X coordinate of the click
-
y <int>
the Y coordinate of the click
-
skipAnim <boolean>
don't animate if the move happend onDrag
- Returns:
void
void
onAvailable
(
)
Executed when the slider element is available
void
onChange
(
firstOffset
,
secondOffset
)
Event that fires when the value of the slider has changed
- Parameters:
-
firstOffset <int>
the number of pixels the thumb has moved
from its start position. Normal horizontal and vertical sliders will only
have the firstOffset. Regions will have both, the first is the horizontal
offset, the second the vertical.
-
secondOffset <int>
the y offset for region sliders
- Returns:
void
Deprecated use instance.subscribe("change") instead
private
void
onDrag
(
)
Handles the onDrag event for the slider background
private
void
onMouseDown
(
)
Handles the mousedown event for the slider background
void
onSliderEnd
(
)
Event that fires at the end of a slider thumb move
- Returns:
void
Deprecated use instance.subscribe("slideEnd") instead
void
onSlideStart
(
)
Event that fires when the at the beginning of the slider thumb move
- Returns:
void
Deprecated use instance.subscribe("slideStart") instead
boolean
setRegionValue
(
newOffset
,
newOffset2
,
skipAnim
,
force
)
Provides a way to set the value of the region slider in code.
- Parameters:
-
newOffset <int>
the number of pixels the thumb should be
positioned away from the initial start point (x axis for region)
-
newOffset2 <int>
the number of pixels the thumb should be
positioned away from the initial start point (y axis for region)
-
skipAnim <boolean>
set to true to disable the animation
for this move action (but not others).
-
force <boolean>
ignore the locked setting and set value anyway
- Returns:
boolean
- true if the move was performed, false if it failed
void
setStartSliderState
(
)
Initialization that sets up the value offsets once the elements are ready
void
setThumbCenterPoint
(
)
When the thumb is available, we cache the centerpoint of the element so
we can position the element correctly when the background is clicked
boolean
setValue
(
newOffset
,
skipAnim
,
force
)
Provides a way to set the value of the slider in code.
- Parameters:
-
newOffset <int>
the number of pixels the thumb should be
positioned away from the initial start point
-
skipAnim <boolean>
set to true to disable the animation
for this move action (but not others).
-
force <boolean>
ignore the locked setting and set value anyway
- Returns:
boolean
- true if the move was performed, false if it failed
private
void
thumbMouseUp
(
)
Handles mouseup event on the slider background
string
toString
(
)
Slider toString
- Returns:
string
- string representation of the instance
void
unlock
(
)
Unlocks the slider, overrides YAHOO.util.DragDrop
boolean
verifyOffset
(
checkPos
)
Checks the background position element position. If it has moved from the
baseline position, the constraints for the thumb are reset
- Parameters:
-
checkPos <boolean>
check the position instead of using cached value
- Returns:
boolean
- True if the offset is the same as the baseline.
static
Slider
YAHOO.widget.Slider.getHorizSlider
(
sBGElId
,
sHandleElId
,
iLeft
,
iRight
,
iTickSize
)
Factory method for creating a horizontal slider
- Parameters:
-
sBGElId <String>
the id of the slider's background element
-
sHandleElId <String>
the id of the thumb element
-
iLeft <int>
the number of pixels the element can move left
-
iRight <int>
the number of pixels the element can move right
-
iTickSize <int>
optional parameter for specifying that the element
should move a certain number pixels at a time.
- Returns:
Slider
- a horizontal slider control
static
Slider
YAHOO.widget.Slider.getSliderRegion
(
sBGElId
,
sHandleElId
,
iLeft
,
iRight
,
iUp
,
iDown
,
iTickSize
)
Factory method for creating a slider region like the one in the color
picker example
- Parameters:
-
sBGElId <String>
the id of the slider's background element
-
sHandleElId <String>
the id of the thumb element
-
iLeft <int>
the number of pixels the element can move left
-
iRight <int>
the number of pixels the element can move right
-
iUp <int>
the number of pixels the element can move up
-
iDown <int>
the number of pixels the element can move down
-
iTickSize <int>
optional parameter for specifying that the element
should move a certain number pixels at a time.
- Returns:
Slider
- a slider region control
static
Slider
YAHOO.widget.Slider.getVertSlider
(
sBGElId
,
sHandleElId
,
iUp
,
iDown
,
iTickSize
)
Factory method for creating a vertical slider
- Parameters:
-
sBGElId <String>
the id of the slider's background element
-
sHandleElId <String>
the id of the thumb element
-
iUp <int>
the number of pixels the element can move up
-
iDown <int>
the number of pixels the element can move down
-
iTickSize <int>
optional parameter for specifying that the element
should move a certain number pixels at a time.
- Returns:
Slider
- a vertical slider control