我試圖使用D3拖動用帆布這樣一個:D3拖動0.3.0 - 「無法讀取空的屬性‘按鈕’」
select(canvas)
.call(
drag()
.container(canvas)
.subject(partial(getNodeAtMouse, simulation, canvas))
.on('start', someFunction))
不過,我得到以下錯誤,當其實,我試圖拖動:
Cannot read property 'button' of null
從下面的行D3拖動(D3原始源代碼)
function defaultFilter() {
return !d3Selection.event.button;
}
如果我刪除功能(通過指定我自己過濾器),我收到以下錯誤:
Cannot read property 'sourceEvent' of null
在D3中選擇(D3原始源代碼)
function sourceEvent() {
var current = exports.event, source;
while (source = current.sourceEvent) current = source;
return current;
}
這讓我覺得有D3拖動的期望之間有一些錯誤D3選擇。有任何想法嗎?