content

package
v0.0.0-...-ba5fac2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2015 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MOUSE_BUTTON_LEFT = 1 << iota
	MOUSE_BUTTON_MIDDLE
	MOUSE_BUTTON_RIGHT
)

Reset iota.

View Source
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.
)
View Source
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 NewFrame

func NewFrame() *Frame

func (*Frame) AddElement

func (f *Frame) AddElement(p image.Point)

AddElement extends the document slice and fills in the new element with a quad.

func (*Frame) Draw

func (frame *Frame) Draw(x, y, vw, vh float32, program *gl.Program) (fw, fh float32)

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

func (f *Frame) FindElementAtPoint(p image.Point) (*dom.QuadElement, int)

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 (f *Frame) InMouseDownMode(pt image.Point)

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

func (f *Frame) Mousedown(pt image.Point, button, buttons uint32) uint32

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) Mousemove

func (f *Frame) Mousemove(pt image.Point, buttons uint32) uint32

func (*Frame) Mouseup

func (f *Frame) Mouseup(pt image.Point, button, buttons uint32) uint32

func (*Frame) Pan

func (f *Frame) Pan(dx, dy float32)

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.

func (*Frame) Resize

func (f *Frame) Resize(w, h float32)

Resize tells the frame what its size should be.

func (*Frame) StartMouseDownMode

func (f *Frame) StartMouseDownMode(pt image.Point, qe *dom.QuadElement, v int)

func (*Frame) Wheel

func (f *Frame) Wheel(pt image.Point, buttons uint32, dx, dy, dz float32) uint32

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL