Pinch event on iFrame Extjs 5

寵の児 提交于 2019-12-10 11:55:31

问题


I want to detect pinch event on an IFrame (Extjs 5 Component). What's wrong with this code??

Ext.create('Ext.ux.IFrame', {
        autoScroll: true,
        src: 'resources/docs/doc1.html',
        cls: 'iframeStyle',
        listeners: {
            pinch: function (event) {
                alert('event.scale= ' + event.scale);
            }
        }
    })

回答1:


Out of the box, Ext.ux.Iframe does not have "pinch" as an event. Only the events listed on the API can be added using the "listeners" syntax. http://docs.sencha.com/extjs/5.0/5.0.1-apidocs/#!/api/Ext.ux.IFrame

You'd want something along the lines of:

Ext.create('Ext.ux.IFrame', {
    autoScroll: true,
    src: 'resources/docs/doc1.html',
    cls: 'iframeStyle',
    listeners: {
        afterrender: function(container) {
            container.addManagedListener(container.el, "touchstart", function (event) {
                alert('event.scale= ' + event.scale);
            });
        }
    }
})

The code is untested but addManagedListener is what you'll want!



来源:https://stackoverflow.com/questions/27522395/pinch-event-on-iframe-extjs-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!