Documentation ¶
Index ¶
- Constants
- type EventHandler
- type Frame
- func (f *Frame) AddElement(p image.Point)
- func (frame *Frame) Draw(x, y, vw, vh float32, program *gl.Program) (fw, fh float32)
- func (f *Frame) EndMouseDownMode()
- func (f *Frame) FindElementAtPoint(p image.Point) (*dom.QuadElement, int)
- func (f *Frame) InMouseDownMode(pt image.Point)
- func (f *Frame) MouseOver(qe *dom.QuadElement, v int)
- func (f *Frame) Mousedown(pt image.Point, button, buttons uint32) uint32
- func (f *Frame) Mousemove(pt image.Point, buttons uint32) uint32
- func (f *Frame) Mouseup(pt image.Point, button, buttons uint32) uint32
- func (f *Frame) Pan(dx, dy float32)
- func (f *Frame) Resize(w, h float32)
- func (f *Frame) StartMouseDownMode(pt image.Point, qe *dom.QuadElement, v int)
- func (f *Frame) Wheel(pt image.Point, buttons uint32, dx, dy, dz float32) uint32
Constants ¶
const ( MOUSE_BUTTON_LEFT = 1 << iota MOUSE_BUTTON_MIDDLE MOUSE_BUTTON_RIGHT )
Reset iota.
const ( EVD_NON = iota // There is no handler. EVD_PREVDEF // A handler exists and it wishes the default action for the event to be suppressed. EVD_DEF // A handler exists and it wants the default action. )
const (
MOUSE_BUTTON_NONE = 0
)
| These together to record which button is up or down. In particular: the buttons value will be some or of the following.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventHandler ¶
type EventHandler interface { // Corresponds to JS registered with onmousedown Mousedown(pt image.Point, button, buttons uint32) uint32 // Corresponds to JS registered with onmouseup Mouseup(pt image.Point, button, buttons uint32) uint32 // Corresponds to JS registered with onmousemove Mousemove(pt image.Point, buttons uint32) uint32 // Corresponds to JS registered with onmousewheel Wheel(pt image.Point, buttons uint32, dx, dy, dz float32) uint32 }
Anything Frame-like entity capable of receiving events needs to implement this interface.
type Frame ¶
type Frame struct {
// contains filtered or unexported fields
}
Frame is the Gojira equivalent of a RenderFrame in Chrome? The basic skeleton of shipping the display list and RenderFrame sizes between processes will probably entail re-writing this. Note(vollick): Frames always have documents. Documents are currently "special" in blink in that they don't have a renderer. Let's just leave the document related code in Frame. If anything, "document" could just be an interface Frame implements.
func (*Frame) AddElement ¶
AddElement extends the document slice and fills in the new element with a quad.
func (*Frame) Draw ¶
TODO(rjk): Tell the Frame to clip its drawing to a given viewport. x, y is the position of the Frame's origin in the containing port. w, h is the width and height of the port in the port's coordinates. Returns the enclosing boundary of the Frame. TODO(rjkroege): boundaries should admit objects outside [0, w), [0. h)? TODO(rjkroege): Provide and wire in types for stuff, boxes, etc.
func (*Frame) EndMouseDownMode ¶
func (f *Frame) EndMouseDownMode()
func (*Frame) FindElementAtPoint ¶
Find the control point, if any, under Point p. Return nil, 0 if there is no control point for an element under p. The returned int is the index of the vertex. TODO(rjkroege): The model could be a tree eventually. :-)
func (*Frame) InMouseDownMode ¶
func (*Frame) MouseOver ¶
func (f *Frame) MouseOver(qe *dom.QuadElement, v int)
Adjusts visual style for elements that are under the mouse pointer.
func (*Frame) Mousedown ¶
These are "event listeners": functionality that really ought to belong in the JavaScript code of the browser. As of yet, this code is busily running here though written in Go. Writing these handlers will help define the interfaces that we need to schlep events from browser to the v8 thread.
General scheme: in a future with JavaScript, the content side (i.e. main thread) for these handlers would receive the event bundle and call into v8 On the browser side, the messaging proxy would handle this.
func (*Frame) Pan ¶
Pan sets a translation on the Frame to permit the Frame to move around within its viewport. Translates the viewport w.r.t. the Frame origin by p.