LoginSignup
0
0

More than 5 years have passed since last update.

特定のオブジェクトをマウスイベント対象から外す(SVG内外の両対応)

Posted at

SVG内要素の場合

バブルチャートのバブル内のテキストとか、svg内の要素に対して有効。
https://developer.mozilla.org/ja/docs/Web/CSS/pointer-events

text {
    pointer-events: none;
}

SVG外の要素の場合

JavaScriptを利用してこんな感じで。

function disableMouseEvent(element){
    element.onmousedown = function(){return false;};
    element.onmouseup = function(){return false;};
    element.onmouseover = function(){return false;};
    element.ondrag = function(){return false;};
    element.ondragstart = function(){return false;};
    element.ondragend = function(){return false;};
}

disableMouseEvent( d3.selectAll(".bubbleText") );
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0