Commit 4040d360 authored by Nick Poulden's avatar Nick Poulden
Browse files

Touch comments

parent 2d4c21c3
Loading
Loading
Loading
Loading
+14 −7
Original line number Diff line number Diff line
@@ -139,7 +139,7 @@ Ext.define('Docs.controller.Examples', {
        container.removeCls(['portrait', 'landscape']);
        container.addCls(this.orientation);

        this.updateIframeDimensions(iframe);
        iframe.setStyle(this.iFrameDimensions());
    },

    changeDevice: function(device) {
@@ -160,20 +160,27 @@ Ext.define('Docs.controller.Examples', {
        container.removeCls(['iphone', 'ipad']);
        container.addCls(this.device);

        this.updateIframeDimensions(iframe);
        var example = this.getExample(this.activeUrl);
        example.orientation = this.orientation;
        example.device = this.device;
        Ext.apply(example, this.iFrameDimensions());

        this.getPage().clear();
        this.activateExampleCard();
        this.getPage().load(example);
    },

    updateIframeDimensions: function(iframe) {
    iFrameDimensions: function() {
        if (this.device == 'ipad') {
            iframe.setStyle({
            return {
                width: this.orientation == 'landscape' ? '1024px' : '768px',
                height: this.orientation == 'landscape' ? '768px' : '1024px',
            });
            };
        } else {
            iframe.setStyle({
            return {
                width: this.orientation == 'landscape' ? '480px' : '320px',
                height: this.orientation == 'landscape' ? '320px' : '480px',
            });
            };
        }
    }
});
+10 −2
Original line number Diff line number Diff line
@@ -42,9 +42,17 @@ Ext.define('Docs.view.examples.Container', {
     * @param {Object} example Example object
     */
    load: function(example) {

        example = Ext.applyIf(example, {
            device: 'ipad',
            orientation: 'landscape',
            width: '1024px',
            height: '768px'
        });

        this.tpl = this.tpl || new Ext.XTemplate(
            '<div class="touchExample ipad landscape">',
                '<iframe style="width: 1024px; height: 768px; border: 0;" src="touch/examples/{url}"></iframe>',
            '<div class="touchExample {device} {orientation}">',
                '<iframe style="width: {width}; height: {height}; border: 0;" src="touch/examples/{url}"></iframe>',
            '</div>'
        );