1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    41
    Answers
    7
    Vote Rating
    0
    dshookowsky is an unknown quantity at this point

      0  

    Default Unanswered: Sencha Touch Splitter / resizable containers

    Unanswered: Sencha Touch Splitter / resizable containers


    I'm trying to set up a view that has two containers that total 100% of the available vertical space, but also have a splitter that allows the user to slide between all of one to all of the other and everything in between, I've tried starting with the following code, but I've run into the following problems:

    1) While it kind-of works, the drag bar is no longer in between the top and the bottom.
    2) I haven't yet found out how to set the constraint of the drag to the contents of the Main container between the docked toolbars at the header and footer.  The best I've had is a +/- 25% movement, but that makes things odd once you're at the top or bottom.

    Any drag/drop ninjas out there?

    Edit: By the way, I believe the drag handle has to be separate from the top and bottom containers because they need to be able to scroll vertically.

    Code:
    Ext.define('TouchApp.view.Main', {
        extend: 'Ext.Container',
        xtype: 'main',
        config: {
            tabBarPosition: 'bottom',
            layout: {
                type: 'vbox'
            },
            items: [
                {
                    xtype: 'titlebar',
                    title: 'top',
                    docked: 'top'
                },
                {
                    xtype: 'container',
                    cls: 'top',
                    style: 'background: red',
                    height: '50%',                
                    scrollable: true
                },
                {
                    xtype: 'container',
                    cls: 'dragBar',
                    style: 'background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#cccccc), color-stop(50%,#ebebeb), color-stop(100%,#cccccc));',
                    height: 20
                },
                {
                    xtype: 'container',
                    cls: 'bottom',
                    style: 'background: blue',
                    flex: 1,
                    scrollable: true
                },
                {
                    xtype: 'titlebar',
                    title: 'bottom',
                    docked: 'bottom'
                }
            ]
        },
        initialize:    function () {
            var me = this,
                dragBar = me.down('container[cls="dragBar"]'),
                constraint;
                    
            me.callParent();
            
            constraint = {
                min: { x: 0, y: -screen.height * .25 },
                max: { x: 0, y: screen.height * .25 }
            }
            
            dragBar.setDraggable({
                direction: 'vertical',
                constraint: constraint,
                listeners: {
                    dragstart: function () {
                    },
                    dragend: function (component, e, offsetX, offsetY, eOpts) {
                        var top = me.down('container[cls="top"]');
                        
                        top.element.setHeight(top.element.getHeight() + offsetY);
                    }
                },
                scope: me
            });        
        }
    });
    Last edited by dshookowsky; 22 May 2013 at 3:41 PM. Reason: clarifiacation

  2. #2
    Sencha User
    Join Date
    Mar 2012
    Posts
    41
    Answers
    7
    Vote Rating
    0
    dshookowsky is an unknown quantity at this point

      0  

    Default


    I don't know exactly why, but this seems to do what I want:

    Code:
    Ext.define('TouchApp.view.Main', {
        extend: 'Ext.Container',
        xtype: 'main',
        config: {
            tabBarPosition: 'bottom',
    		layout: {
    			type: 'vbox'
    		},
            items: [
    			{
    				xtype: 'titlebar',
    				title: 'top',
    				docked: 'top'
    			},
    			{
    				xtype: 'container',
    				cls: 'top',
    				style: 'background: red',
    				height: '50%',				
    				scrollable: true
    			},
    			{
    				xtype: 'container',
    				cls: 'dragBar',
    				style: 'background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#cccccc), color-stop(50%,#ebebeb), color-stop(100%,#cccccc));',
    				height: 20
    			},
    			{
    				xtype: 'container',
    				cls: 'bottom',
    				style: 'background: blue',
    				flex: 1,
    				scrollable: true
    			},
    			{
    				xtype: 'titlebar',
    				title: 'bottom',
    				docked: 'bottom'
    			}
            ]
        },
    	initialize:	function () {
    		var me = this,
    			dragBar = me.down('container[cls="dragBar"]'),
    			constraint;
    				
    		me.callParent();
    		
    		constraint = {
    			min: { x: 0, y: -screen.height * .25 },
    			max: { x: 0, y: screen.height * .25 }
    		}
    		
    		dragBar.setDraggable({
    			direction: 'vertical',
    			constraint: constraint,
    			listeners: {
    				dragstart: function () {
    				},
    				dragend: function (component, e, offsetX, offsetY, eOpts) {				
    					console.log('offset-Y: ' + offsetY + '; e.deltaY: ' + e.deltaY);
    					var top = me.down('container[cls="top"]'),
    						dragBar = me.down('container[cls="dragBar"]');
    					
    					
    					top.element.setHeight(top.element.getHeight() + e.deltaY);
    					dragBar.element.setTop(-offsetY);
    					
    				}
    			},
    			scope: me
    		});		
    	}
    });

  3. #3
    Sencha User
    Join Date
    Mar 2012
    Posts
    41
    Answers
    7
    Vote Rating
    0
    dshookowsky is an unknown quantity at this point

      0  

    Default


    So my question remains: In this example, how can I keep the drag bar within the confines of the main window between the header and footer?

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi