Implement touch event types/procs in DOM module.
This commit is contained in:
parent
e0bb65e45c
commit
172a9c8e97
1 changed files with 30 additions and 0 deletions
|
|
@ -130,6 +130,16 @@ type
|
|||
readOnly*: bool
|
||||
options*: seq[OptionElement]
|
||||
|
||||
# https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement
|
||||
HtmlElement* = ref object of Element
|
||||
contentEditable*: string
|
||||
isContentEditable*: bool
|
||||
dir*: string
|
||||
offsetHeight*: int
|
||||
offsetWidth*: int
|
||||
offsetLeft*: int
|
||||
offsetTop*: int
|
||||
|
||||
LinkElement* = ref LinkObj
|
||||
LinkObj {.importc.} = object of ElementObj
|
||||
target*: cstring
|
||||
|
|
@ -270,6 +280,8 @@ type
|
|||
wordSpacing*: cstring
|
||||
zIndex*: int
|
||||
|
||||
# TODO: A lot of the fields in Event belong to a more specific type of event.
|
||||
# TODO: Should we clean this up?
|
||||
Event* = ref EventObj
|
||||
EventObj {.importc.} = object of RootObj
|
||||
target*: Node
|
||||
|
|
@ -310,6 +322,20 @@ type
|
|||
SUBMIT*: int
|
||||
UNLOAD*: int
|
||||
|
||||
TouchList* {.importc.} = ref object of RootObj
|
||||
length*: int
|
||||
|
||||
TouchEvent* {.importc.} = ref object of Event
|
||||
changedTouches*, targetTouches*, touches*: TouchList
|
||||
|
||||
Touch* {.importc.} = ref object of RootObj
|
||||
identifier*: int
|
||||
screenX*, screenY*, clientX*, clientY*, pageX*, pageY*: int
|
||||
target*: Element
|
||||
radiusX*, radiusY*: int
|
||||
rotationAngle*: int
|
||||
force*: float
|
||||
|
||||
Location* = ref LocationObj
|
||||
LocationObj {.importc.} = object of RootObj
|
||||
hash*: cstring
|
||||
|
|
@ -488,6 +514,10 @@ proc setAttribute*(s: Style, attr, value: cstring, caseSensitive=false)
|
|||
# Event "methods"
|
||||
proc preventDefault*(ev: Event)
|
||||
|
||||
# TouchEvent "methods"
|
||||
proc identifiedTouch*(list: TouchList): Touch
|
||||
proc item*(list: TouchList, i: int): Touch
|
||||
|
||||
{.pop.}
|
||||
|
||||
var
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue