MCPcopy
hub / github.com/tdewolff/canvas / MoveTo

Method MoveTo

path.go:401–408  ·  view source on GitHub ↗

MoveTo moves the path to (x,y) without connecting the path. It starts a new independent subpath. Multiple subpaths can be useful when negating parts of a previous path by overlapping it with a path in the opposite direction. The behaviour for overlapping paths depends on the FillRule.

(x, y float64)

Source from the content-addressed store, hash-verified

399
400// MoveTo moves the path to (x,y) without connecting the path. It starts a new independent subpath. Multiple subpaths can be useful when negating parts of a previous path by overlapping it with a path in the opposite direction. The behaviour for overlapping paths depends on the FillRule.
401func (p *Path) MoveTo(x, y float64) {
402 if 0 < len(p.d) && p.d[len(p.d)-1] == MoveToCmd {
403 p.d[len(p.d)-3] = x
404 p.d[len(p.d)-2] = y
405 return
406 }
407 p.d = append(p.d, MoveToCmd, x, y, MoveToCmd)
408}
409
410// LineTo adds a linear path to (x,y).
411func (p *Path) LineTo(x, y float64) {

Callers 15

PathMethod · 0.95
PathMethod · 0.95
bentleyOttmannFunction · 0.95
JoinMethod · 0.95
LineToMethod · 0.95
QuadToMethod · 0.95
CubeToMethod · 0.95
ArcToMethod · 0.95
SplitAtMethod · 0.95
ParseSVGPathFunction · 0.95
arcToQuadFunction · 0.95
arcToCubeFunction · 0.95

Calls

no outgoing calls

Tested by 2

TestPathEmptyFunction · 0.76
TestPathReplaceFunction · 0.76