gojs

package
v0.0.0-...-c0bb568 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyDownEvent  = "keydown"
	KeyUpEvent    = "keyup"
	KeyPressEvent = "keypress"

	MouseDownEvent     = "mousedown"
	MouseUpEvent       = "mouseup"
	MouseClickEvent    = "click"
	MouseDblClickEvent = "dblclick"
	MouseMove          = "mousemove"
)

Variables

This section is empty.

Functions

func AddEventListener

func AddEventListener(eventType string, callback func(Event))

func RequestAnimationFrame

func RequestAnimationFrame(callback AnimationCallback) uint64

Types

type AnimationCallback

type AnimationCallback = func(timestamp int)

type Context2d

type Context2d struct {
	Height float64
	Width  float64
	// contains filtered or unexported fields
}

func (*Context2d) Arc

func (c *Context2d) Arc(x, y, radius, startAngle, endAngle float64, anticlockwise bool)

func (*Context2d) BeginPath

func (c *Context2d) BeginPath()

func (Context2d) ClearRect

func (this Context2d) ClearRect(x, y, width, height float64)

func (*Context2d) ClosePath

func (c *Context2d) ClosePath()

func (*Context2d) Fill

func (c *Context2d) Fill()

func (*Context2d) FillRect

func (c *Context2d) FillRect(x, y, width, height float64)

func (*Context2d) FillText

func (c *Context2d) FillText(text string, x, y float64)

func (*Context2d) LineTo

func (c *Context2d) LineTo(x, y float64)

func (*Context2d) MeasureText

func (c *Context2d) MeasureText(text string) TextMetrics

func (*Context2d) MoveTo

func (c *Context2d) MoveTo(x, y float64)

func (*Context2d) SetFillStyle

func (c *Context2d) SetFillStyle(style string)

func (*Context2d) SetFont

func (c *Context2d) SetFont(font string)

func (*Context2d) SetLineWidth

func (c *Context2d) SetLineWidth(width int)

func (*Context2d) SetStrokeStyle

func (c *Context2d) SetStrokeStyle(style string)

func (*Context2d) Stroke

func (c *Context2d) Stroke()

func (*Context2d) StrokeRect

func (c *Context2d) StrokeRect(x, y, width, height float64)

func (*Context2d) StrokeText

func (c *Context2d) StrokeText(text string, x, y float64)

type Event

type Event interface {
}

type HtmlCanvasElement

type HtmlCanvasElement struct {
	HtmlElement
	// contains filtered or unexported fields
}

func (HtmlCanvasElement) GetContext2d

func (this HtmlCanvasElement) GetContext2d() *Context2d

type HtmlElement

type HtmlElement struct {
	// contains filtered or unexported fields
}

func GetElementById

func GetElementById(id string) (*HtmlElement, error)

func (HtmlElement) AddEventListener

func (e HtmlElement) AddEventListener(eventType string, callback func(Event))

func (HtmlElement) ToCanvas

func (he HtmlElement) ToCanvas() HtmlCanvasElement

type KeyboardEvent

type KeyboardEvent struct {
	EventType string
	AltKey    bool
	CtrlKey   bool
	ShiftKey  bool
	MetaKey   bool
	CharCode  uint8
	Code      string
	Key       string
	KeyCode   int
}

TODO: Add support for gestures

func KeyboardEventFromArgs

func KeyboardEventFromArgs(args []js.Value) KeyboardEvent

type MouseEvent

type MouseEvent struct {
	EventType string
	AltKey    bool
	CtrlKey   bool
	ShiftKey  bool
	MetaKey   bool
	Button    int
	ClientX   int
	ClientY   int
	OffsetX   int
	OffsetY   int
}

func MouseEventFromArgs

func MouseEventFromArgs(args []js.Value) MouseEvent

type TextMetrics

type TextMetrics struct {
	Width                  float64
	ActualBoundingBoxLeft  float64
	ActualBoundingBoxRight float64
	FontBoundingBoxAscent  float64
	FontBoundingBoxDescent float64
	EmHeightAscent         float64
	EmHeightDescent        float64
	HangingBaseline        float64
	AlphabeticBaseline     float64
	IdeographicBaseline    float64
}

Jump to

Keyboard shortcuts

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