clone method

MouseInputData clone(
  1. GDisplayObject target,
  2. GDisplayObject dispatcher,
  3. MouseInputType type
)

Clones a new instance of MouseInputData with the provided target, dispatcher and type, and copies the properties of the original instance into the new one, including uid, buttonDown, rawEvent, captured, buttonsFlags, time, _stagePosition, scrollDelta, localPosition, and mouseOut. Returns the new instance.

Throws an error if target is null.

Implementation

MouseInputData clone(
  GDisplayObject target,
  GDisplayObject dispatcher,
  MouseInputType type,
) {
  var input = MouseInputData(
    target: target,
    dispatcher: dispatcher,
    type: type,
  );
  input.uid = uid;
  input.buttonDown = buttonDown;
  input.rawEvent = rawEvent;
  input.captured = captured;
  input.buttonsFlags = buttonsFlags;
  input.time = time;
  input._stagePosition.setTo(_stagePosition.x, _stagePosition.y);
  input.scrollDelta.setTo(scrollDelta.x, scrollDelta.y);
  input.localPosition.setTo(localPosition.x, localPosition.y);
  input.mouseOut = mouseOut;
  return input;
}