-
-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for pascal-cased events
- Loading branch information
Showing
8 changed files
with
175 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// MouseEventHandler<HTMLCanvasElement> | ||
export const EventPropNames = Object.freeze({ | ||
onClick: 'onclick', | ||
onGlobalMouseMove: 'onglobalmousemove', | ||
onGlobalPointerMove: 'onglobalpointermove', | ||
onGlobalTouchMove: 'onglobaltouchmove', | ||
onMouseDown: 'onmousedown', | ||
onMouseEnter: 'onmouseenter', | ||
onMouseLeave: 'onmouseleave', | ||
onMouseMove: 'onmousemove', | ||
onMouseOut: 'onmouseout', | ||
onMouseOver: 'onmouseover', | ||
onMouseUp: 'onmouseup', | ||
onMouseUpOutside: 'onmouseupoutside', | ||
onPointerCancel: 'onpointercancel', | ||
onPointerDown: 'onpointerdown', | ||
onPointerEnter: 'onpointerenter', | ||
onPointerLeave: 'onpointerleave', | ||
onPointerMove: 'onpointermove', | ||
onPointerOut: 'onpointerout', | ||
onPointerOver: 'onpointerover', | ||
onPointerTap: 'onpointertap', | ||
onPointerUp: 'onpointerup', | ||
onPointerUpOutside: 'onpointerupoutside', | ||
onRightClick: 'onrightclick', | ||
onRightDown: 'onrightdown', | ||
onRightUp: 'onrightup', | ||
onRightUpOutside: 'onrightupoutside', | ||
onTap: 'ontap', | ||
onTouchCancel: 'ontouchcancel', | ||
onTouchEnd: 'ontouchend', | ||
onTouchEndOutside: 'ontouchendoutside', | ||
onTouchMove: 'ontouchmove', | ||
onTouchStart: 'ontouchstart', | ||
onWheel: 'onwheel', | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,40 @@ | ||
import { | ||
ContinuousEventPriority, | ||
DefaultEventPriority, | ||
// DiscreteEventPriority, | ||
// ContinuousEventPriority, | ||
DiscreteEventPriority, | ||
} from 'react-reconciler/constants.js'; | ||
import { log } from './log.js'; | ||
|
||
export function getCurrentEventPriority() | ||
{ | ||
log('info', 'lifecycle::getCurrentEventPriority'); | ||
|
||
return DefaultEventPriority; | ||
// if (typeof window === 'undefined') { | ||
// return DefaultEventPriority; | ||
// } | ||
const globalScope = (typeof self !== 'undefined' && self) || (typeof window !== 'undefined' && window); | ||
|
||
// const name = window?.event?.type; | ||
if (!globalScope) | ||
{ | ||
return DefaultEventPriority; | ||
} | ||
|
||
// switch (name) { | ||
// case 'click': | ||
// case 'contextmenu': | ||
// case 'dblclick': | ||
// case 'pointercancel': | ||
// case 'pointerdown': | ||
// case 'pointerup': | ||
// return DiscreteEventPriority; | ||
// case 'pointermove': | ||
// case 'pointerout': | ||
// case 'pointerover': | ||
// case 'pointerenter': | ||
// case 'pointerleave': | ||
// case 'wheel': | ||
// return ContinuousEventPriority; | ||
// default: | ||
// return DefaultEventPriority; | ||
// } | ||
const name = globalScope.event?.type; | ||
|
||
switch (name) | ||
{ | ||
case 'click': | ||
case 'contextmenu': | ||
case 'dblclick': | ||
case 'pointercancel': | ||
case 'pointerdown': | ||
case 'pointerup': | ||
return DiscreteEventPriority; | ||
case 'pointermove': | ||
case 'pointerout': | ||
case 'pointerover': | ||
case 'pointerenter': | ||
case 'pointerleave': | ||
case 'wheel': | ||
return ContinuousEventPriority; | ||
default: | ||
return DefaultEventPriority; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.