cornerstoneTools icon indicating copy to clipboard operation
cornerstoneTools copied to clipboard

Can't override the svgCusor

Open flyhuang opened this issue 5 years ago • 2 comments

Prerequisites

  • [Y] Which version are you using? (Is it latest?)
  • [Y] Are you reporting to the correct repository?
  • [Y] Did you search existing issues? (Were any related?)

Description

Can't override the svgCusor of tool.

Steps to Reproduce the issue

  1. Set showSVGCursors to "true"
cornerstoneTools.init({
  showSVGCursors: true
});
  1. create a custom svg cursor:
var MouseCursor = cornerstoneTools.importInternal("tools/cursors/MouseCursor");

var _wwwcCursor = new MouseCursor(
  '<path fill="#FFFFFF" d="M200,0C89.1,0,0,89.1,0,200c0,110.9,89.1,200,200,200c110.9,0,200-89.1,200-200C400,89.1,310.9,0,200,0L200,0z M200,381.8V18.2c100,0,181.8,81.8,181.8,181.8S300,381.8,200,381.8L200,381.8z"/>',
  { viewBox: { x: 400, y: 400 } }
);
  1. override old svg cursor:

cornerstoneTools.addTool(cornerstoneTools.WwwcTool, { svgCursor: _wwwcCursor });

Expected behavior: (What you expected to happen) Show new svg cursor when active wwwc tool.

Actual behavior: (What actually happened) Throw error: svgCursor.getIconWithPointerSVG is not a function

CodeSandbox With Reproduction of Issue:

flyhuang avatar Oct 10 '19 09:10 flyhuang

it looks like utils deepmerge func miss clone proto func.

flyhuang avatar Oct 10 '19 09:10 flyhuang

Has this issue been fixed? The new cornerstone does not support the code from the sandbox at all. I am now stuck with the questions:

  1. How to override the cursor for an existing tool?
  2. How to set the cursor for a new custom tool?

KaiOtto avatar Feb 09 '24 10:02 KaiOtto