graphx icon indicating copy to clipboard operation
graphx copied to clipboard

MouseCusor for GShape

Open imiskolee opened this issue 4 years ago • 1 comments

Hi:

as well as we know, We can set different mouse cursor for a child widget on flutter use MouseRegion, and I am not sure how to apply set mouse cursor on Shape region.

a solution is : #1. a Stage level mouse move event handler, and use hittest for check which child already hit, then change mouse cursor ? #2. configure mouse curosr for a shape.

imiskolee avatar Sep 21 '21 08:09 imiskolee

Sorry for the super late reply. As GraphX was originally made to emulate ActionScript API, the only automatic cursor change available from any DisplayObject is basic and click:

var someShape = GShape();
someShape.useCursor = true ;

You can always change the mouse (SystemMouseCursors) yourself though, you have 2 (manual) options in GraphX:

through the stage: stage?.pointer?.cursor = SystemMouseCursors.resizeDown;

globally (the old AS3 way): GMouse.cursor = SystemMouseCursors.copy;

So, if you need custom mouse while hovering a GShape you can do this:

theShape.onMouseOver.add((_) {
  GMouse.cursor=SystemMouseCursors.alias;
  theShape.onMouseOut.addOnce((_) => GMouse.basic());
});

Hope it helps.

roipeker avatar Feb 16 '22 02:02 roipeker