⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 slider.js

📁 javascript 很酷的类库
💻 JS
📖 第 1 页 / 共 3 页
字号:
/*
 * Isomorphic SmartClient
 * Version 6.5 (2008-04-30)
 * Copyright(c) 1998-2007 Isomorphic Software, Inc. All rights reserved.
 * "SmartClient" is a trademark of Isomorphic Software, Inc.
 *
 * licensing@smartclient.com
 *
 * http://smartclient.com/license
 */
 /*---------->    isc.Slider.js    <----------*///	The Slider class was developed as an instructional/documentation example of//	creating a new widget class, covering a broad range of ISC client-side//	framework concepts and conventions.// Questions: jeff@isomorphic.com//----------  Description  ----------\\//> @class Slider//	The Slider class implements a GUI slider widget allowing the user to select a numeric //  value from within a range by dragging a visual indicicator up and down a track.//	<p>//  The slider will generate events as the user interacts with it and changes its value.//  If slider.sliderTarget is specified, moving the slider thumb generates a custom//	event named 'sliderMove', sent to the sliderTarget.//  If a <code>sliderMove</code> handler stringMethod is defined on the target, it will be //  fired when the slider is moved. The second parameter (available via the variable name//  <code>eventInfo</code> if the handler is a string) is a pointer back to the slider.//  <p>//  The slider will also fire a <code>valueChanged()</code> method whenever its value is //  changed.  This can be observed or overridden on the Slider instance to perform some action.// //  @treeLocation Client Reference/Control//  @visibility external//  @example slider//<//----------  Create the class  ----------\\isc.ClassFactory.defineClass("Slider", isc.Canvas);//----------  Define static properties  ----------\\isc.Slider.addClassProperties({    // isc.Slider.VERTICAL_SRC_PREFIX    prepended to image filenames for a vertical slider	VERTICAL_SRC_PREFIX:"v",	    // isc.Slider.HORIZONTAL_SRC_PREFIX  prepended to image filenames for a horizontal slider	HORIZONTAL_SRC_PREFIX:"h",	    // isc.Slider.DOWN                   down state for the slider thumb	DOWN:"down",				    // isc.Slider.UP                     up (enabled) state for the slider thumb	UP:"",						    // isc.Slider.EVENTNAME              name of event sent to sliderTarget when thumb moved	EVENTNAME:"sliderMove"		});//----------  Define instance properties  ----------\\isc.Slider.addProperties({    //>	@attr	slider.title		(String : "Set Value" : [IRW])    // Optional display title for the slider.    //      @see attr:showTitle    //      @visibility external    //<	title:"Set Value",						    //>	@attr	slider.length		(integer : 200 : [IRW])    // Used to set slider height if vertical, slider width if horizontal.    // Applied to the slider track, not necessarily the entire widget.    // Overridden by an explicit width/height specification for the widget.    //      @visibility external    //<	length:200,					    //>	@attr	slider.vertical		(boolean : true : [IRW])    // Indicates whether this is a vertical or horizontal slider.    //      @visibility external    //      @example slider    //<	vertical:true,					    //>	@attr	slider.thumbThickWidth		(integer : 23 : [IRW])    // The dimension of the thumb perpendicular to the slider track.    //      @visibility external    //<	thumbThickWidth:23,			    //>	@attr	slider.thumbThinWidth		(integer : 17 : [IRW])    // The dimension of the thumb parallel to the slider track.    //      @visibility external    //<	thumbThinWidth:17,			    //>	@attr	slider.trackWidth		(integer : 7 : [IRW])    // The thickness of the track. This is the width, for a vertical slider, or the height, for    // a horizontal slider.    //      @visibility external    //<	trackWidth:7,				    // skinImgDir       subdirectory for slider skin images	skinImgDir:"images/Slider/",	    //>	@attr	slider.thumbSrc		(String : "thumb.gif" : [IRW])    // The base filename for the slider thumb images.    // The filenames for the thumb icons are assembled from this base filename and the state of the    // thumb, as follows:<br>    // Assume the thumbSrc is set to <code>{baseName}.{extension}</code><br>    // The full set of images to be displayed is:<br>    // For horizontal sliders:    // <ul>    // <li><code>h{baseName}.{extension}</code>: default enabled appearance.    // <li><code>h{baseName}_down.{extension}</code>:  appearance when the slider is enabled and the    //     thumb is clicked.    // <li><code>h{baseName}_off.{extension}</code>:  appearance when the slider is disabled.    // </ul>    // For vertical sliders:    // <ul>    // <li><code>v{baseName}.{extension}</code>: default enabled appearance.    // <li><code>v{baseName}_down.{extension}</code>:  appearance when the slider is enabled and the    //     thumb is clicked.    // <li><code>v{baseName}_off.{extension}</code>:  appearance when the slider is disabled.    // </ul>    //      @visibility external    //<	thumbSrc:"thumb.gif",		    //>	@attr	slider.trackSrc		(String : "track.gif" : [IRW])    // The base filename for the slider track images.    // The filenames for the track icons are assembled from this base filename and the state of the    // slider, as follows:<br>    // Assume the trackSrc is set to <code>{baseName}.{extension}</code><br>    // The full set of images to be displayed is:<br>    // For horizontal sliders:    // <ul>    // <li><code>h{baseName}_start.{extension}</code>: start (left edge) of the track for a slider    //     that is enabled.    // <li><code>h{baseName}_stretch.{extension}</code>:  the track for an enabled slider; this may    //     be centered, tiled, or stretched.    // <li><code>h{baseName}_end.{extension}</code>:  end (right edge) of the track for a slider    //     that is enabled.    // <li><code>h{baseName}_off_start.{extension}</code>: start (left edge) of the track for a slider    //     that is disabled.    // <li><code>h{baseName}_off_stretch.{extension}</code>:  the track for a disabled slider; this    //     may be centered, tiled, or stretched.    // <li><code>h{baseName}_off_end.{extension}</code>:  end (right edge) of the track for a slider    //     that is disabled.    // </ul>    // For vertical sliders:    // <ul>    // <li><code>v{baseName}_start.{extension}</code>: start (bottom edge) of the track for a slider    //     that is enabled.    // <li><code>v{baseName}_stretch.{extension}</code>:  the track for an enabled slider; this may    //     be centered, tiled, or stretched.    // <li><code>v{baseName}_end.{extension}</code>:  end (top edge) of the track for a slider    //     that is enabled.    // <li><code>v{baseName}_off_start.{extension}</code>: start (bottom edge) of the track for a slider    //     that is disabled.    // <li><code>v{baseName}_off_stretch.{extension}</code>:  the track for a disabled slider; this    //     may be centered, tiled, or stretched.    // <li><code>v{baseName}_off_end.{extension}</code>:  end (top edge) of the track for a slider    //     that is disabled.    // </ul>    //      @see attr:trackImageType    //      @visibility external    //<	trackSrc:"track.gif",										    //>	@attr	slider.trackCapSize		(integer : 6 : [IRW])    // The height of vertical slider start and end images, or width of horizontal slider start and    // end images.    //      @visibility external    //<	trackCapSize:6,    //>	@attr	slider.trackImageType		(ImageStyle : "stretch" : [IRW])    // The imageType setting for the slider track.    //      @see type:ImageStyle    //      @see attr:stretchImg.imageType    //      @visibility external    //<	trackImageType:isc.Img.STRETCH,    //>	@attr	slider.showTitle		(boolean : true : [IRW])    // Indicates whether the slider's title should be displayed. The default position for this label	// is to the left of a horizontal slider, or above a vertical slider.    //      @see attr:title    //      @visibility external    //<	showTitle:true,												    //>	@attr	slider.showRange		(boolean : true : [IRW])    // Indicates whether labels for the min and max values of the slider should be displayed. The    // default positions for these labels are below the start/end of a horizontal slider, or to the    // right of the start/end of a vertical slider.    //      @see attr:minValueLabel    //      @see attr:maxValueLabel    //      @visibility external    //<	showRange:true,												    //>	@attr	slider.showValue		(boolean : true : [IRW])    // Indicates whether a label for the value of the slider should be displayed. The    // default position for this label is to the right of a horizontal slider, or below a vertical    // slider.    //      @see attr:value    //      @visibility external    //<	showValue:true,   								    //>	@attr	slider.labelWidth		(integer : 50 : [IRW])    // The width of the labels used to display the minimum, maximum and current values of the    // slider.    //      @visibility external    //<	labelWidth:50,    //>	@attr	slider.labelHeight		(integer : 20 : [IRW])    // The height of the labels used to display the minimum, maximum and current values of the    // slider.    //      @visibility external    //<	labelHeight:20,        //>	@attr	slider.labelSpacing		(integer : 5 : [IRW])    // The space around the labels used to display the minimum, maximum and current values of the    // slider.    //      @visibility external    //<	labelSpacing:5,	titleStyle:"sliderTitle",	rangeStyle:"sliderRange",	valueStyle:"sliderValue",	//XXX need to create and use these CSS styles	//XXX need mechanism for overriding default layouts		    //>	@attr	slider.value		(float : 1 : [IRW])    // The slider value. This value should lie between the minValue and maxValue and increases as    // the thumb is moved up (for a vertical slider) or right (for a horizontal slider) unless    // flipValues is set to true.    //      @see attr:minValue    //      @see attr:maxValue    //      @see attr:flipValues    //      @see attr:showValue    //      @visibility external    //<	value:1,						    //>	@attr	slider.minValue		(float : 1 : [IRW])    // The minimum slider value. The slider value is equal to minValue when the thumb is at the    // bottom or left of the slider (unless flipValues is true, in which case the minimum value	// is at the top/right of the slider)    //      @see attr:slider.flipValues    //      @visibility external    //      @example slider    //<	minValue:1,					    //>	@attr	slider.minValueLabel		(String : null : [IRW])    // The text displayed in the label for the minimum value of the slider. If left as null, then    // slider.minValue will be displayed.    //      @see attr:showRange    //      @see attr:minValue    //      @visibility external    //<	    //>	@attr	slider.maxValue		(float : 100 : [IRW])    // The maximum slider value. The slider value is equal to maxValue when the thumb is at the    // top or right of the slider (unless flipValues is true, in which case the maximum value	// is at the bottom/left of the slider)    //      @see attr:slider.flipValues    //      @visibility external    //      @example slider    //<	maxValue:100,				    //>	@attr	slider.maxValueLabel		(String : null : [IRW])    // The text displayed in the label for the maximum value of the slider. If left as null, then    // slider.maxValue will be displayed.    //      @see attr:showRange    //      @see attr:maxValue    //      @visibility external    //<	    //>	@attr	slider.numValues		(integer : null : [IRW])    // The number of discrete values represented by slider. If specified, the range of valid    // values (between <code>minValue</code> and <code>maxValue</code>) will be divided into    // this many steps. As the thumb is moved along the track it will only select these values    // and appear to jump between the steps.    //      @visibility external    //      @example slider    //<	    //>	@attr	slider.roundValues		(boolean : true : [IRW])    // Specifies whether the slider value should be rounded to the nearest integer.    //      @visibility external    //<	roundValues:true,    //>	@attr	slider.flipValues		(boolean : false : [IRW])    // Specifies whether the value range of the slider should be flipped so that values increase as    // the thumb is moved down (for a vertical slider) or to the left (for a horizontal slider).    //      @visibility external    //<	flipValues:false,						    //>	@attr	slider.sliderTarget		(Canvas : null : [IRW])    // The target widget for the <code>sliderMove</code> event generated when the slider thumb     // is moved.    //      @visibility external    //<    //>	@attr	slider.canFocus		(boolean : true : [IRW])    // Indicates whether keyboard manipulation of the slider is allowed.    //      @visibility external    //<    canFocus:true,       //>	@attr	slider.stepPercent		(float : 5 : [IRW])    // The percentage of the total slider that constitutes one discrete step. The slider will move    // one step when the appropriate arrow key is pressed.    //      @visibility external    //<    stepPercent:5,        //>	@attr	slider.animateThumb		(boolean : true : [IRW])    // Should the thumb be animated to its new position when the value is changed programmatically,    // or by clicking in the slider track.    //      @visibility animation    //      @group animation    //<    //animateThumb:false,    //>	@attr	slider.animateThumbTime		(integer : 250 : [IRW])    // Duration of thumb animation, in milliseconds.    //      @visibility animation    //      @group animation    //<    animateThumbTime:250,        //>	@attr	slider.animateThumbInit		(boolean : false : [IRW])    // If thumb animation is enabled, should the thumb be animated to its initial value?    //      @visibility animation    //      @group animation    //<    //animateThumbInit:false,        // undocumented for now; possibly make this internal    animateThumbAcceleration:"slowStartandEnd",            valueChangedOnDrag:true,   // default false may be more appropriate, but has backcompat problems    valueChangedOnRelease:true, // can set this to false to exactly match the pre-5.5 behavior	valueChangedOnClick:true // actually on mouseUp, but that is too confusable with thumb release});

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -