예제 #1
0
func (c *Context) StrokeText(text string, x r2.X, maxWidth ...float64) {
	if len(maxWidth) > 0 {
		c.Call("strokeText", text, x.X(), x.Y(), maxWidth)
	} else {
		c.Call("strokeText", text, x.X(), x.Y())
	}
}
예제 #2
0
func (m *myElog) findNearby(tol float64, p r2.X) (es []*elog.Event) {
	px := p.X() - m.margin.X()
	dx := px / m.max.X()
	pt := m.tb.Min + m.tb.Dt*dx
	vw := &m.view
	for ei := range vw.Events {
		e := &vw.Events[ei]
		dt := math.Abs(m.view.Time(e).Sub(m.tb.Start).Seconds() - pt)
		if dt < .05*m.tb.Dt {
			es = append(es, e)
		}
	}
	return
}
예제 #3
0
func (c *Context) ClearRect(x, s r2.X)  { c.Call("clearRect", x.X(), x.Y(), s.X(), s.Y()) }
예제 #4
0
func (c *Context) ArcTo(x1, x2 r2.X, r float64) { c.Call("arcTo", x1.X(), x1.Y(), x2.X(), x2.Y(), r) }
예제 #5
0
func (c *Context) FillRect(x, s r2.X)   { c.Call("fillRect", x.X(), x.Y(), s.X(), s.Y()) }
예제 #6
0
func (c *Context) StrokeRect(x, s r2.X) { c.Call("strokeRect", x.X(), x.Y(), s.X(), s.Y()) }
예제 #7
0
// Resets transform to DX 0 and identity matrix then applies given transform.
func (c *Context) SetTransform(m00, m01, m10, m11 float64, dx r2.X) {
	c.Call("setTransform", m00, m01, m10, m11, dx.X(), dx.Y())
}
예제 #8
0
func (c *Context) IsPointInPath(x r2.X) { c.Call("isPointInPath", x.X(), x.Y()) }
예제 #9
0
// Transforms
func (c *Context) Scale(x r2.X)      { c.Call("scale", x.X(), x.Y()) }
예제 #10
0
func (c *Context) Translate(x r2.X)  { c.Call("translate", x.X(), x.Y()) }
예제 #11
0
func (c *Context) Ellipse(x, r r2.X, θ0, θ1, rotation r2.Angle, ccw ...bool) {
	c.Call("ellipse", x.X(), x.Y(), r.X(), r.Y(), rotation.Radians(), θ0.Radians(), θ1.Radians(), ccw)
}
예제 #12
0
func (c *Context) MoveTo(x r2.X)  { c.Call("moveTo", x.X(), x.Y()) }
예제 #13
0
func (c *Context) Arc(x r2.X, r float64, θ0, θ1 r2.Angle, ccw ...bool) {
	c.Call("arc", x.X(), x.Y(), r, θ0.Radians(), θ1.Radians(), ccw)
}
예제 #14
0
func (c *Context) BezierCurveTo(c1, c2, x1 r2.X) {
	c.Call("bezierCurveTo", c1.X(), c1.Y(), c2.X(), c2.Y(), x1.X(), x1.Y())
}
예제 #15
0
func (c *Context) QuadraticCurveTo(c1, x1 r2.X) {
	c.Call("quadraticCurveTo", c1.X(), c1.Y(), x1.X(), x1.Y())
}
예제 #16
0
func (c *Context) Rect(x, s r2.X) { c.Call("rect", x.X(), x.Y(), s.X(), s.Y()) }
예제 #17
0
func (c *Context) LineTo(x r2.X)  { c.Call("lineTo", x.X(), x.Y()) }