主頁 > 知識(shí)庫 > 使用jTopo給Html5 Canva中繪制的元素添加鼠標(biāo)事件

使用jTopo給Html5 Canva中繪制的元素添加鼠標(biāo)事件

熱門標(biāo)簽:阿里云 百度競價(jià)點(diǎn)擊價(jià)格的計(jì)算公式 美圖手機(jī) 硅谷的囚徒呼叫中心 智能手機(jī) 檢查注冊(cè)表項(xiàng) 使用U盤裝系統(tǒng) 網(wǎng)站建設(shè)
使用Html5的時(shí)候,在Canvas上繪制的東西是不能相應(yīng)鼠標(biāo)事件的,但是使用jTopo添加事件非常簡單,效果如下: 

 

代碼示例:

復(fù)制代碼
代碼如下:

var node = new JTopo.Node("Hello");
node.setLocation(409, 269);
node.mousedown(function(event){
if(event.button == 2){
node.text = '按下右鍵';
}else if(event.button == 1){
node.text = '按下中鍵';
}else if(event.button == 0){
node.text = '按下左鍵';
}
});
node.mouseup(function(event){
if(event.button == 2){
node.text = '松開右鍵';
}else if(event.button == 1){
node.text = '松開中鍵';
}else if(event.button == 0){
node.text = '松開左鍵';
}
});
node.click(function(event){
console.log("單擊");
});
node.dbclick(function(event){
console.log("雙擊");
});
node.mousedrag(function(event){
console.log("拖拽");
});
node.mouseover(function(event){
console.log("mouseover");
});
node.mousemove(function(event){
console.log("mousemove");
});
node.mouseout(function(event){
console.log("mouseout");
});

標(biāo)簽:賀州 懷化 湖北 黃山 湘潭 煙臺(tái) 通遼 山南

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《使用jTopo給Html5 Canva中繪制的元素添加鼠標(biāo)事件》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266