You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/controls/controls.js
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,7 @@ var Crafty = require('../core/core.js');
3
3
/**@
4
4
* #Draggable
5
5
* @category Controls
6
+
* @kind Component
6
7
* Enable drag and drop of the entity. Listens to events from `MouseDrag` and moves entity accordingly.
7
8
*
8
9
* @see MouseDrag
@@ -130,6 +131,7 @@ Crafty.c("Draggable", {
130
131
/**@
131
132
* #Controllable
132
133
* @category Controls
134
+
* @kind Component
133
135
*
134
136
* Used to bind methods to generalized input events.
135
137
*
@@ -256,6 +258,7 @@ Crafty.c("Controllable", {
256
258
/**@
257
259
* #Multiway
258
260
* @category Controls
261
+
* @kind Component
259
262
*
260
263
* Used to bind keys to directions and have the entity move accordingly.
261
264
*
@@ -380,6 +383,7 @@ Crafty.c("Multiway", {
380
383
/**@
381
384
* #Jumper
382
385
* @category Controls
386
+
* @kind Component
383
387
* @trigger CheckJumping - When entity is about to jump. This event is triggered with the object the entity is about to jump from (if it exists). Third parties can respond to this event and enable the entity to jump.
Copy file name to clipboardExpand all lines: src/controls/inputs.js
+30Lines changed: 30 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,7 @@ Crafty.extend({
10
10
/**@
11
11
* #Crafty.lastEvent
12
12
* @category Input
13
+
* @kind Property
13
14
* Check which mouse event occured most recently (useful for determining mouse position in every frame).
14
15
*
15
16
* The native [`MouseEvent`](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent) is augmented with additional properties.
@@ -34,6 +35,7 @@ Crafty.extend({
34
35
/**@
35
36
* #Crafty.keydown
36
37
* @category Input
38
+
* @kind Property
37
39
* Check which keys (referred by `Crafty.keys` key codes) are currently down.
38
40
*
39
41
* @example
@@ -48,6 +50,7 @@ Crafty.extend({
48
50
/**@
49
51
* #Crafty.selected
50
52
* @category Input
53
+
* @kind Property
51
54
* @trigger CraftyFocus - is triggered when Crafty's stage gets selected
52
55
* @trigger CraftyBlur - is triggered when Crafty's stage is no longer selected
53
56
*
@@ -78,6 +81,7 @@ Crafty.extend({
78
81
/**@
79
82
* #Crafty.multitouch
80
83
* @category Input
84
+
* @kind Method
81
85
* @sign public this .multitouch(Boolean bool)
82
86
* @param bool - Turns multitouch on and off. The initial state is off (false).
83
87
*
@@ -132,6 +136,8 @@ Crafty.extend({
132
136
/**@
133
137
* #Crafty.mouseDispatch
134
138
* @category Input
139
+
* @private
140
+
* @kind Method
135
141
*
136
142
* Internal method which dispatches mouse events received by Crafty.
137
143
*
@@ -230,6 +236,8 @@ Crafty.extend({
230
236
/**@
231
237
* #Crafty.touchDispatch
232
238
* @category Input
239
+
* @kind Method
240
+
* @private
233
241
*
234
242
* Internal method which dispatches touch events received by Crafty (crafty.stage.elem).
235
243
* The touch events get dispatched to the closest entity to the source of the event (if available).
@@ -416,6 +424,8 @@ Crafty.extend({
416
424
/**@
417
425
* #Crafty.findPointerEventTargetByComponent
418
426
* @category Input
427
+
* @kind Method
428
+
* @private
419
429
*
420
430
* @sign public this .findPointerEventTargetByComponent(String comp, Event e[, Object target])
421
431
* Finds closest entity with certain component at a given event.
@@ -502,6 +512,8 @@ Crafty.extend({
502
512
/**@
503
513
* #Crafty.mouseWheelDispatch
504
514
* @category Input
515
+
* @kind Method
516
+
* @private
505
517
*
506
518
* Internal method which dispatches mouse wheel events received by Crafty.
507
519
* @trigger MouseWheelScroll - is triggered when mouse is scrolled on stage - { direction: +1 | -1} - Scroll direction (up | down)
@@ -579,6 +591,8 @@ Crafty.extend({
579
591
/**@
580
592
* #Crafty.keyboardDispatch
581
593
* @category Input
594
+
* @kind Method
595
+
* @private
582
596
*
583
597
* Internal method which dispatches keyboard events received by Crafty.
584
598
* @trigger KeyDown - is triggered for each entity when the DOM 'keydown' event is triggered. - { key: `Crafty.keys` keyCode (Number), originalEvent: original KeyboardEvent } - Crafty's KeyboardEvent
@@ -706,6 +720,7 @@ Crafty._preBind("CraftyStop", function () {
706
720
/**@
707
721
* #Mouse
708
722
* @category Input
723
+
* @kind Component
709
724
*
710
725
* Provides the entity with mouse related events.
711
726
*
@@ -771,6 +786,7 @@ Crafty.c("Mouse", {
771
786
/**@
772
787
* #Touch
773
788
* @category Input
789
+
* @kind Component
774
790
* Provides the entity with touch related events
775
791
* @trigger TouchStart - when entity is touched - TouchPoint
776
792
* @trigger TouchMove - when finger is moved over entity - TouchPoint
@@ -817,6 +833,8 @@ Crafty.c("Touch", {
817
833
/**@
818
834
* #AreaMap
819
835
* @category Input
836
+
* @kind Component
837
+
*
820
838
* Component used by Mouse and Touch.
821
839
* Can be added to other entities for use with the Crafty.findClosestEntityByComponent method.
822
840
*
@@ -848,6 +866,7 @@ Crafty.c("AreaMap", {
848
866
/**@
849
867
* #.areaMap
850
868
* @comp AreaMap
869
+
* @kind Method
851
870
*
852
871
* @trigger NewAreaMap - when a new areaMap is assigned - Crafty.polygon
853
872
*
@@ -904,6 +923,8 @@ Crafty.c("AreaMap", {
904
923
/**@
905
924
* #Button
906
925
* @category Input
926
+
* @kind Component
927
+
*
907
928
* Provides the entity with touch or mouse functionality, depending on whether this is a pc
908
929
* or mobile device, and also on multitouch configuration.
909
930
*
@@ -921,6 +942,8 @@ Crafty.c("Button", {
921
942
/**@
922
943
* #MouseDrag
923
944
* @category Input
945
+
* @kind Component
946
+
*
924
947
* Provides the entity with drag and drop mouse events.
925
948
* @trigger Dragging - is triggered each frame the entity is being dragged - MouseEvent
926
949
* @trigger StartDrag - is triggered when dragging begins - MouseEvent
@@ -962,6 +985,8 @@ Crafty.c("MouseDrag", {
962
985
/**@
963
986
* #.startDrag
964
987
* @comp MouseDrag
988
+
* @kind Method
989
+
*
965
990
* @sign public this .startDrag(void)
966
991
*
967
992
* Make the entity produce drag events, essentially making the entity follow the mouse positions.
@@ -983,6 +1008,8 @@ Crafty.c("MouseDrag", {
983
1008
/**@
984
1009
* #.stopDrag
985
1010
* @comp MouseDrag
1011
+
* @kind Method
1012
+
*
986
1013
* @sign public this .stopDrag(void)
987
1014
*
988
1015
* Stop the entity from producing drag events, essentially reproducing the drop.
@@ -1005,6 +1032,7 @@ Crafty.c("MouseDrag", {
1005
1032
/**@
1006
1033
* #Keyboard
1007
1034
* @category Input
1035
+
* @kind Component
1008
1036
*
1009
1037
* Provides entity with keyboard events.
1010
1038
* @trigger KeyDown - is triggered for each entity when the DOM 'keydown' event is triggered. - { key: `Crafty.keys` keyCode (Number), originalEvent: original KeyboardEvent } - Crafty's KeyboardEvent
@@ -1038,6 +1066,8 @@ Crafty.c("Keyboard", {
1038
1066
/**@
1039
1067
* #.isDown
1040
1068
* @comp Keyboard
1069
+
* @kind Method
1070
+
*
1041
1071
* @sign public Boolean isDown(String keyName)
1042
1072
* @param keyName - Name of the key to check. See `Crafty.keys`.
0 commit comments