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

📄 layout.js

📁 javascript 很酷的类库
💻 JS
📖 第 1 页 / 共 5 页
字号:
    resizeBarSize:7,                   //>Animation    // ---------------------------------------------------------------------------------------    //> @attr layout.animateMembers (boolean : null : IRW)    // If true when members are added / removed, they should be animated as they are shown    // or hidden in position    // @group animation    // @visibility animation    // @example animateLayout    //<    //> @attr layout.animateMemberEffect (string : "slide" : IRW)    // Animation effect for hiding and showing members when animateMembers is true.    // @group animation    // @visibility internal    //<        animateMemberEffect:"slide",        //> @attr layout.animateMemberTime (number : null : IRWA)    // If specified this is the duration of show/hide animations when members are being shown    // or hidden due to being added / removed from this layout.    // @group animation    // @visibility animation    //<        //> @attr layout.suppressMemberAnimations (boolean : null : IRWA)    // If true, when a member starts to perform an animated resize, instantly finish the     // animation rather than reflowing the Layout on each step of the animation.    // @group animation    //<        //<Animation        // Drag and Drop    // ---------------------------------------------------------------------------------------    //> @attr layout.canDropComponents (boolean : true : IRA)    // Layouts provide a default implementation of a drag and drop interaction.  If you set    // +link{Canvas.canAcceptDrop,canAcceptDrop}:true and <code>canDropComponents:true</code>    // on a Layout, when a droppable Canvas (+link{canvas.canDrop,canDrop:true} is dragged over    // the layout will show a dropLine (a simple insertion line) at the drop location.      // <P>    // When the drop occurs, the dragTarget (obtained using    // +link{EventHandler.getDragTarget()}) is added as a member of this layout at the location    // shown by the dropLine (calculated by +link{Layout.getDropPosition()}).  This default    // behavior allows either members or external components that have    // +link{Canvas.canDragReposition} (or +link{Canvas.canDrag}) and +link{Canvas.canDrop} set    // to <code>true</code> to be added to or reordered within the Layout.    // <P>    // You can control the thickness of the dropLine via +link{Layout.dropLineThickness} and    // you can customize the style using css styling in the skin file (look for .layoutDropLine in    // skin_styles.css for your skin).      // <P>      // If you want to dynamically create a component to be added to the Layout in response to a    // drop event you can do so as follows:     // <pre>    // isc.VLayout.create({    //   ...various layout properties...    //   canDropComponents: true,    //   drop : function () {    //     // create the new component     //     var newMember = isc.Canvas.create();     //     // add to the layout at the current drop position     //     // (the dropLine will be showing here)    //     this.addMember(newMember, this.getDropPosition());      //     // hide the dropLine that was automatically shown     //     // by builtin SmartClient methods    //     this.hideDropLine();    //   }    // });    // </pre>    // If you want to completely suppress the builtin drag and drop logic, but still receive drag    // and drop events for your own custom implementation, set +link{Canvas.canAcceptDrop} to    // <code>true</code> and <code>canDropComponents</code> to <code>false</code> on your Layout.    //     // @group dragdrop    // @visibility external    //<    canDropComponents: true,    //> @attr layout.dropLineThickness (number : 2 : IRA)    //    // Thickness, in pixels of the dropLine shown during drag and drop when    // +link{Layout.canDropComponents} is set to <code>true</code>.  See the discussion in    // +link{Layout} for more info.    //     // @see Layout    // @group dragdrop    // @visibility external    // @example dragMove    //<     dropLineThickness : 2,     //> @attr layout.showDragPlaceHolder (boolean : null : IRW)     // If set to true, when a member is dragged out of layout, a visible placeholder canvas     // will be displayed in place of the dragged widget for the duration of the drag and drop    // interaction.    // @group dragdrop    // @visibility external    // @example dragMove    //<    //> @attr layout.placeHolderProperties (canvas properties: null : IR)     // If +link{layout.showDragPlaceHolder, this.showDragPlaceHolder} is true, this     // properties object can be used to customize the appearance of the placeholder displayed    // when the user drags a widget out of this layout.    // @group dragdrop    // @visibility external    // @example dragMove    //<    membersAreChildren:true    //> @attr layout.stackZIndex (string: null : IR)    // For use in conjunction with +link{memberOverlap}, controls the z-stacking order of    // members.    // <P>    // If "lastOnTop", members stack from the first member at bottom to the last member at    // top. If "firstOnTop", members stack from the last member at bottom to the first member    // at top.    //     // @visibility external    //<});//> @groupDef layoutMember// Properties that can be set on members of a layout to control how the layout is done// @visibility external//<//> @attr canvas.layoutAlign (Alignment or VerticalAlignment : null : IR)// When this Canvas is included as a member in a Layout, layoutAlign controls alignment on the// breadth axis of the layout.  Default is "left" for a VLayout, "top" for an HLayout.// @group layoutMember// @visibility external//<//> @attr canvas.showResizeBar (boolean : false : IR)// When this Canvas is included as a member in a Layout, whether a resizeBar should be shown// after this member in the layout, to allow it to be resized.// <p>// By default the resize bar acts on the Canvas that it is declared on.  If you want the resize// bar to instead act on the next member of the Layout (e.g. to collapse down or to the right),// set +link{canvas.resizeBarTarget} as well.//// @group layoutMember// @see canvas.resizeBarTarget// @visibility external// @example layoutNesting//<//> @attr canvas.resizeBarTarget (String : null : IR)// When this Canvas is included as a member in a Layout, and +link{showResizeBar} is set to// <code>true</code> so that a resizeBar is created, <code>resizeBarTarget:"next"</code> can be// set to indicate that the resizeBar should resize the next member of the layout rather than// this one.  For resizeBars that support hiding their target member when clicked on, // <code>resizeBarTarget:"next"</code> also means that the next member will be the one hidden.// <P>// This is typically used to create a 3-way split pane, where left and right-hand sections can// be resized or hidden to allow a center section to expand.// <P>// <b>NOTE:</b> as with any Layout, to ensure all available space is used, one or more members// must maintain a flexible size (eg 75%, or *).  In a two pane Layout with a normal resize// bar, to fill all space after a user resizes, the member on the <b>right</b> should have// flexible size.  With resizeBarTarget:"next", the member on the <b>left</b> should have// flexible size.//// @group layoutMember// @see canvas.showResizeBar// @visibility external//<//> @attr canvas.extraSpace (positiveInteger : 0 : IR)// When this Canvas is included as a member in a Layout, extra blank space that should be left// after this member in a Layout.// @see class:LayoutSpacer for more control// @group layoutMember// @visibility external//<isc.Canvas.addMethods({    //> @method canvas.setShowResizeBar()    // When this Canvas is included as a member in a Layout, dynamically updates whether a     // resizeBar should be shown after this member in the layout, to allow it to be resized.    // @param show (boolean) setting for this.showResizeBar    // @group layoutMember    // @visibility external    //<    setShowResizeBar : function (show) {        this.showResizeBar = show;        var layout = this.parentElement;        if (layout == null || !isc.isA.Layout(layout)) return;        layout.reflow(this);    }});// Length/Breadth sizing functions// --------------------------------------------------------------------------------------------// NOTE:// To generalize layouts to either dimension we use the following terms://// - length: size along the axis on which the layout stacks the members (the "length axis")// - breadth: size on the other axis (the "breadth axis")isc.Layout.addMethods({getMemberLength : function (member) {     return this.vertical ? member.getVisibleHeight() : member.getVisibleWidth() },//> @method layout.getMemberOffset() [A]// An optional method that, if it exists, allows the manipulation of the calculated// offset for members of this layout.  Returns the offset for the specified// member.// @param member (Canvas) Component to be positioned// @param defaultOffset (Number) Value of the currently calculated member offset. This//      may be returned verbatim or manupulated in this method.// @param alignment (String) alignment of the enclosing layout// @group layoutMember// @visibility external//<getMemberBreadth : function (member) {    return this.vertical ? member.getVisibleWidth() : member.getVisibleHeight() },setMemberBreadth : function (member, breadth) {     if (this.logIsDebugEnabled(this._$layout)) this._reportResize(member, breadth);    this.vertical ? member.setWidth(breadth) : member.setHeight(breadth); },// NOTE: these return the space available to lay out components, not the specified sizegetLength : function () {    if (this.vertical) return this.getInnerHeight();    var width = this.getInnerWidth();    if (this.leaveScrollbarGap && !this.vscrollOn) width -= this.getScrollbarSize();     return width;},getBreadth : function () {    if (!this.vertical) return this.getInnerHeight();    var width = this.getInnerWidth();    if (this.leaveScrollbarGap && !this.vscrollOn) width -= this.getScrollbarSize();     return width;},getLengthPolicy : function () {    return this.vertical ? this.vPolicy : this.hPolicy;},getBreadthPolicy : function () {    return this.vertical ? this.hPolicy : this.vPolicy;},memberHasInherentLength : function (member) {    if (!(this.vertical ? member.hasInherentHeight() : member.hasInherentWidth())) {        return false;    }    // if a percent size or "*" is set on a member that supposedly has inherent length, take    // this as a sign that the member should actually be sized normally.  Note that if we allow    // a percent-size member to size itself, a stack of such members would not perfectly fill    // space, because they can't coordinate on rounding to the nearest pixel!    var explicitLength = this._explicitLength(member);    if (isc.isA.String(explicitLength) &&         (explicitLength.endsWith(this._$percent) || explicitLength == this._$star))     {        return false;    }    return true;},memberHasInherentBreadth : function (member) {    return (this.vertical ? member.hasInherentWidth() : member.hasInherentHeight());},_overflowsLength : function (member) {    return ((this.vertical && member.canOverflowHeight()) ||             (!this.vertical && member.canOverflowWidth()));},// NOTE: specified width/height will be defined if width/height were set on construction._explicitLength : function (member) {    return this.vertical ? member._userHeight : member._userWidth;},_explicitBreadth : function (member) {    return this.vertical ? member._userWidth : member._userHeight;},_memberPercentLength : function (member) {    return this.vertical ? member._percent_height : member._percent_width;},scrollingOnLength : function () { return this.vertical ? this.vscrollOn : this.hscrollOn },getMemberGap : function (member) {    return (member.extraSpace  || 0)  - (this.memberOverlap || 0)         + (member._internalExtraSpace || 0);},// Creation/Drawing// --------------------------------------------------------------------------------------------//>	@method	Layout.initWidget()//		sets up the layout for various management duties (various observations of member canvases, //		initialization of sizes, array, etc.)//<initWidget : function () {    if (isc._traceMarkers) arguments.__this = this;    // initialize "vertical" for "orientation", or vice versa    var Layout = isc.Layout;

⌨️ 快捷键说明

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