【发布时间】:2014-06-09 03:38:10
【问题描述】:
我的 Sencha Touch 应用中有一个 Google 地图,我在上面绘制了许多 SVG 元素。
现在我想在每个 SVG 元素上添加触摸并按住(意味着当用户在 SVG 元素上触摸并按住图形超过 1.5 秒时触发),当触发偶数时,我想要弹出与单击的 SVG 元素相关的信息对话框。
我试过了:Ext.util.TaPrepeater(不起作用)
var startTime
Ext.create('Ext.util.TapRepeater', {
el: drawnElements[uniqueTrackID],
listeners: {
touchstart: function () {
startTime = new Date();
},
touchend: function () {
var now = new Date();
if (now - startTime >= 1500)
{
Ext.Msg.alert("haha");
}
}
}
});
还尝试直接在 SVG 上添加事件(也不起作用)
drawnElements[uniqueTrackID].on('touchstart', function () {
startTime = new Date();
});
drawnElements[uniqueTrackID].on('touchend', function () {
var rightNow = new Date();
if (rightNow - startTime >= 1500) {
Ext.Msg.alert("haha");
}
});
并找到非常有限的相关帖子。
【问题讨论】:
标签: javascript extjs svg sencha-touch sencha-touch-2