2015-07-01 180 views
0

我創建了一個dojo圖形組,並將鼠標事件連接到它上,但mouseclick事件觸發了所有其他鼠標事件,點擊時我沒有移動鼠標。多個鼠標事件在點擊鼠標時觸發

一個鼠標點擊解僱既有 '鼠標移開', '的mouseenter',最後 '鼠標按下'。

任何人有任何想法?

var group = surface.createGroup(); 
group.on("mousedown", function(e) { handle mouse click here }); 
group.on("mouseout", function(e) { handle mouse out here }); 
group.on("mouseenter", function(e) { handle mouse enter here }); 

更新:我正在重新創建鼠標輸入圖形,並導致各種各樣的問題。

+1

應該有一個鼠標*了*過,因爲根據定義,「點擊」是一個鼠標向下的事件,然後在同一個元素上鼠標向上。 (關於鼠標輸入,是不是發生這種情況,因爲您必須將鼠標移到問題中的元素上才能點擊它?這會讓您從鼠標最初結束的任何其他元素中釋放鼠標事件...) – nnnnnn

+0

我根本沒有移動(至少我試着不點擊時移動,仍然觸發所有這些事件)。你知道我在哪裏可以找到javascript鼠標事件處理的詳細描述。謝謝 –

回答

0

嘗試使用dojo/mousehttp://livedocs.dojotoolkit.org/dojo/mouse):

var group = surface.createGroup(); 
group.on("mousedown", function(e) { handle mouse click here }); 
group.on(mouse.leave, function(e) { handle mouse out here }); 
group.on(mouse.enter, function(e) { handle mouse enter here }); 

我想click應該比mousedown爲你寫的「處理鼠標點擊這裏」