ユーザーが病変の中心をクリックして選択できるように、renderer2D を作成しました。ユーザーがクリックした場所を表示したい。現在、私の考えは、レンダラーをフリーズして(スライスが同じになり、ズームも)、キャンバスを使用して円を描くことです。
これが私のコードです:
centerpick2D = new X.renderer2D();
centerpick2D.container = 'pick_center_segment';
centerpick2D.orientation = 'Z';
centerpick2D.init();
centerpick2D.add(volumeT1DCM);
centerpick2D.render();
centerpick2D.interactor.onMouseDown = function(){
tumorCenter=centerpick2D.xy2ijk(centerpick2D.interactor.mousePosition[0],centerpick2D.interactor.mousePosition[1]);
centerpick2D.interactor.config.MOUSEWHEEL_ENABLED = false;
centerpick2D.interactor.config.MOUSECLICKS_ENABLED = false;
$('canvas').attr('id', 'xtkCanvas');
var myCanvas = document.getElementById("xtkCanvas");
var ctx=myCanvas.getContext("2d");
ctx.fillStyle="#FF0000";
ctx.beginPath();
ctx.arc(centerpick2D.interactor.mousePosition[0],centerpick2D.interactor.mousePosition[1],20,0,Math.PI*2,true);
ctx.closePath();
ctx.fill();
};
2 つの問題があります。
MOUSEWHEEL_ENABLED=false および MOUSECLICKS_ENABLED = false は機能しません。機能する centerpick2D.init() を追加しようとしましたが、前のキャンバスの上に2番目のキャンバスを追加しました。
私のサークルはどこにも表示されません。
どんな助けでも大歓迎です。:-D