An alternative to h2d.Interactive that works with nb.Scene instances.
0.1.0
.Static variables
Constructor
new(w:Float = 0, h:Float = 0, ?parent:Object)
Creates an nb.Interactive instance.
If w or h <= 0, a hitbox won't be made.
Parameters:
w | Width of the interactive's hitbox. |
|---|---|
h | Height of the interactive's hitbox. |
parent | The interactive's parent object. |
Variables
read onlyfocused:Bool = false
Whether this interactive is currently focused.
It can be prevented from being automatically set with autoFocus.
read onlyisHighestZ:Bool = false
If true, this interactive is currently the topmost interactive targeted by mouse events.
read onlyisOnSubscene:Bool = false
Whether this interactive's parent is a nb.SubScene. Permits the event to go to the subscene.
propagate:Bool = false
Whether this interactive should let the interactives below it to trigger their events.
read onlyshapes:Shapes = null
The nb.shape.Shapes defining this interactive's hitboxes. You can add shapes to it directly.
Methods
defaultInit():Void
Enables the interactive's default behavior by setting onHighestZ and onNotHighestZ.
initDefaultDrag():Void
Shortcut function to set the functions onDragStart, onDrag and onDragEnd
for dragging.
It assumes a simple context, you might have to set these functions yourself for dragging.
loadShape(shape:Shape):Void
Removes current hitboxes and sets up a hitbox from the given nb.shape.Shape.
loadShapes(shapes:Array<Shape>):Void
Removes current hitboxes and sets up hitboxes from the given nb.shape.Shapes.
dynamiconDragEnd(e:Event):Void
Called whenever this interactive detects the end of a dragging opeartion.
dynamiconDragStart(e:Event):Void
Called whenever this interactive detects the start of a dragging opeartion.
dynamiconHighestZ(e:Event):Void
Called whenever this interactive becomes the topmost interactive triggered by a mouse event.
dynamiconNotHighestZ(e:Event):Void
Called whenever this interactive isn't anymore the topmost interactive triggered by a mouse event.
dynamiconTextInput(e:Event):Void
Called whenever a key gets pressed for text input for this interactive.