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

add PointerID and PointerType to PointerEvent, as well as DataTransfer.SetData #87

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions dom.go
Original file line number Diff line number Diff line change
Expand Up @@ -3129,3 +3129,7 @@ type DataTransfer struct{ *js.Object }
func (dt *DataTransfer) GetData(format string) string {
return dt.Call("getData", format).String()
}

func (dt *DataTransfer) SetData(format, data string) {
dt.Call("setData", format, data)
}
10 changes: 8 additions & 2 deletions events.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func wrapEvent(o *js.Object) Event {
case js.Global.Get("PageTransitionEvent"):
return &PageTransitionEvent{ev}
case js.Global.Get("PointerEvent"):
return &PointerEvent{&MouseEvent{UIEvent: &UIEvent{ev}}}
return &PointerEvent{MouseEvent: &MouseEvent{UIEvent: &UIEvent{ev}}}
case js.Global.Get("PopStateEvent"):
return &PopStateEvent{ev}
case js.Global.Get("ProgressEvent"):
Expand Down Expand Up @@ -307,7 +307,13 @@ func (ev *MouseEvent) ModifierState(mod string) bool {
type MutationEvent struct{ *BasicEvent }
type OfflineAudioCompletionEvent struct{ *BasicEvent }
type PageTransitionEvent struct{ *BasicEvent }
type PointerEvent struct{ *MouseEvent }

type PointerEvent struct {
*MouseEvent
PointerID int `js:"pointerId"`
PointerType string `js:"pointerType"`
}

type PopStateEvent struct{ *BasicEvent }
type ProgressEvent struct{ *BasicEvent }
type RelatedEvent struct{ *BasicEvent }
Expand Down
4 changes: 4 additions & 0 deletions v2/dom.go
Original file line number Diff line number Diff line change
Expand Up @@ -3363,3 +3363,7 @@ type DataTransfer struct{ js.Value }
func (dt *DataTransfer) GetData(format string) string {
return dt.Call("getData", format).String()
}

func (dt *DataTransfer) SetData(format, data string) {
dt.Call("setData", format, data)
}
5 changes: 5 additions & 0 deletions v2/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,12 @@ func (ev *MouseEvent) ModifierState(mod string) bool {
type MutationEvent struct{ *BasicEvent }
type OfflineAudioCompletionEvent struct{ *BasicEvent }
type PageTransitionEvent struct{ *BasicEvent }

type PointerEvent struct{ *MouseEvent }

func (ev *PointerEvent) PointerID() int { return ev.Get("pointerId").Int() }
func (ev *PointerEvent) PointerType() string { return ev.Get("pointerType").String() }

type PopStateEvent struct{ *BasicEvent }
type ProgressEvent struct{ *BasicEvent }
type RelatedEvent struct{ *BasicEvent }
Expand Down