Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drag and drop support off of actors #134

Closed
eonarheim opened this issue Jan 25, 2014 · 2 comments
Closed

Drag and drop support off of actors #134

eonarheim opened this issue Jan 25, 2014 · 2 comments
Labels
feature Label applied to new feature requests

Comments

@eonarheim
Copy link
Member

eonarheim commented Jan 25, 2014

Context

The ability to drag and drop Actors would be very useful for games with mouse or touch controls.

Proposal

Implement drag and drop on Actors.

@eonarheim eonarheim modified the milestones: 0.3 Release, 0.2 Release Apr 8, 2014
@jedeen jedeen modified the milestones: 0.4 Release, 0.3 Release Apr 29, 2014
@jedeen jedeen modified the milestones: 0.4 Release, 0.5 Release Sep 30, 2014
@kamranayub
Copy link
Member

You can do this by enabling pointer events on actor and just using a flag on pointerdown. Should we close this?

var pointerDown = false;

actor.enableCapturePointer = true;
actor.capturePointer.enableMoveEvents = true;

actor.on("pointerdown", () => { pointerDown = true; });
actor.on("pointerup", () => { pointerDown = false; });
actor.on("pointermove", (pe: ex.Input.PointerEvent) => {
  if (!this.pointerDown) return;
  this.x = pe.x;
  this.y = pe.y;
});

@eonarheim
Copy link
Member Author

@kamranayub Should we create an alias for the pattern you described?

Something to this effect

actor.draggable();
// or
actor.enableDragAndDrop();

@jedeen jedeen added the feature Label applied to new feature requests label Apr 30, 2015
@jedeen jedeen modified the milestones: 0.6 Release, 0.7 Release May 10, 2015
@jedeen jedeen added the on-deck label Jul 12, 2015
@jedeen jedeen modified the milestones: 0.7 Release, vNext Jul 12, 2015
@jedeen jedeen modified the milestones: 0.10.0 Release, vNext Aug 26, 2016
@jedeen jedeen added the good first issue good for people new to open source and Excalibur label Aug 26, 2016
@jedeen jedeen modified the milestones: 0.10.0 Release, 0.9.0 Release Aug 28, 2016
@jedeen jedeen modified the milestones: 0.9.0 Release, 0.10.0 Release Nov 29, 2016
@jedeen jedeen modified the milestones: 0.10.0 Release, 0.9.0 Release Nov 29, 2016
@jedeen jedeen removed the on-deck label Jan 25, 2017
@jedeen jedeen added on-deck and removed on-deck labels Mar 31, 2017
@jedeen jedeen modified the milestones: 0.10.0 Release, vNext Apr 3, 2017
@jedeen jedeen modified the milestones: vNext, 0.14.0 Release Sep 19, 2017
@jedeen jedeen removed the on-deck label Oct 8, 2017
@jedeen jedeen self-assigned this Oct 8, 2017
@jedeen jedeen modified the milestones: 0.14.0 Release, 0.15.0 Release Dec 1, 2017
@jedeen jedeen modified the milestones: 0.15.0 Release, 0.16.0 Release Feb 13, 2018
pathurs added a commit to pathurs/Excalibur that referenced this issue Feb 24, 2018
Adds several events for dragging of actors, this will allow developers to
implemented their own style of 'drag and drop', such as 'pulling'
or 'stretching'

New Events:
 - Enter 'enter'
 - Leave 'leave'
 - Pointer Enter 'pointerenter'
 - Pointer Leave 'pointerleave'
 - Pointer Drag Start 'pointerdragstart'
 - Pointer Drag End 'pointerdragend'
 - Pointer Drag Move 'pointerdragmove'
 - Pointer Drag Enter 'pointerdragenter'
 - Pointer Drag Leave 'pointerdragleave'

New Classes:
 - PointerDragEvent extends PointerEvent
 - GlobalCoordinates (contains Vectors for world, page, screen)

New ICapturePointerConfig Property:
 - captureDragEvents (whether to emit drag events to the actor)

Additional:
 - PointerEvent now contains original pointer object.
 - Deprecated some coordinate properties in favour of GlobalCoordinates
 property or a derivative.

Resolves: excaliburjs#134
@jedeen jedeen removed their assignment Mar 2, 2018
eonarheim pushed a commit that referenced this issue Mar 13, 2018
* Drag and drop support off of actors

Adds several events for dragging of actors, this will allow developers to
implemented their own style of 'drag and drop', such as 'pulling'
or 'stretching'

New Events:
 - Enter 'enter'
 - Leave 'leave'
 - Pointer Enter 'pointerenter'
 - Pointer Leave 'pointerleave'
 - Pointer Drag Start 'pointerdragstart'
 - Pointer Drag End 'pointerdragend'
 - Pointer Drag Move 'pointerdragmove'
 - Pointer Drag Enter 'pointerdragenter'
 - Pointer Drag Leave 'pointerdragleave'

New Classes:
 - PointerDragEvent extends PointerEvent
 - GlobalCoordinates (contains Vectors for world, page, screen)

New ICapturePointerConfig Property:
 - captureDragEvents (whether to emit drag events to the actor)

Additional:
 - PointerEvent now contains original pointer object.
 - Deprecated some coordinate properties in favour of GlobalCoordinates
 property or a derivative.

Resolves: #134

* Add changes to CHANGELOG.md

* Using proper obsolete declarations
Replace Deprecated comments with JSDOC @obsolete
Use the @obsolete decorator

* Use the type union PointerEventName for:
_capturePointerEvents, _captureMoveEvents and _captureDragEvents
@jedeen jedeen removed the good first issue good for people new to open source and Excalibur label Mar 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Label applied to new feature requests
Projects
None yet
Development

No branches or pull requests

3 participants