Documentation
¶
Overview ¶
Package canvas implements a 2D vector graphics editor.
Index ¶
- Constants
- Variables
- func AddNewDash(dary []float64) string
- func BBoxReshapeDelta(bb *math32.Box2, delta float32, bbX, bbY BBoxPoints)
- func DashIconsInit()
- func DashMatchArray(lwidth float64, dary []float64) (bool, string)
- func DashMulWidth(lwidth float64, dary []float64) []float64
- func DashString(dary []float64) string
- func IconToMarkerName(icnm any) string
- func InactivateNodeCtrls(sprites *core.Sprites, i int)
- func InactivateNodePoint(sprites *core.Sprites, i int)
- func LayerIsLocked(kn tree.Node) bool
- func LayerIsVisible(kn tree.Node) bool
- func MarkerDeleteCtxtColors(mk *svg.Marker)
- func MarkerIconsInit()
- func MarkerNameToIcon(nm string) icons.Icon
- func MarkerSetColors(mk *svg.Marker, fill, stroke string)
- func MarkerSetProp(sg *svg.SVG, sii svg.Node, prop, name string, mc MarkerColors)
- func MarkerUpdateColorProp(sg *svg.SVG, sii svg.Node, prop string)
- func NewMarker(sg *svg.SVG, name string, id int) *svg.Marker
- func NewMarkerFromXML(name, xml string) *svg.Marker
- func NewSVGElement[T tree.NodeValue](sv *SVG, useTree bool) *T
- func NewSVGElementDrag[T tree.NodeValue](sv *SVG, start, end image.Point) *T
- func NodeIsLayer(kn tree.Node) bool
- func NodeIsMetaData(kn tree.Node) bool
- func NodeParentLayer(n tree.Node) tree.Node
- func OpacityFromColor(img image.Image) float32
- func OpenPaths()
- func OpenSplits()
- func ProportionalBBox(bb, orig math32.Box2) math32.Box2
- func RecycleMarker(sg *svg.SVG, sii svg.Node, name string, id int, mc MarkerColors) *svg.Marker
- func SavePaths()
- func SaveSplits()
- func SetSpriteProperties(sp *core.Sprite, typ, subtyp Sprites, idx int)
- func SnapToIncr(val, off, incr float32) float32
- func SnapToPoint(val, snap float32) (float32, bool)
- func SpriteByName(ctx core.Widget, typ, subtyp Sprites, idx int) (*core.Sprite, bool)
- func SpriteName(typ, subtyp Sprites, idx int) string
- func SquareBBox(bb math32.Box2) math32.Box2
- func ToolDoesBasicSelect(tl Tools) bool
- type Actions
- func (i Actions) Desc() string
- func (i Actions) Int64() int64
- func (i Actions) MarshalText() ([]byte, error)
- func (i *Actions) SetInt64(in int64)
- func (i *Actions) SetString(s string) error
- func (i Actions) String() string
- func (i *Actions) UnmarshalText(text []byte) error
- func (i Actions) Values() []enums.Enum
- type AlignAnchors
- func (i AlignAnchors) Desc() string
- func (i AlignAnchors) Int64() int64
- func (i AlignAnchors) MarshalText() ([]byte, error)
- func (i *AlignAnchors) SetInt64(in int64)
- func (i *AlignAnchors) SetString(s string) error
- func (i AlignAnchors) String() string
- func (i *AlignAnchors) UnmarshalText(text []byte) error
- func (i AlignAnchors) Values() []enums.Enum
- type AlignView
- type Aligns
- func (i Aligns) Desc() string
- func (i Aligns) Int64() int64
- func (i Aligns) MarshalText() ([]byte, error)
- func (i *Aligns) SetInt64(in int64)
- func (i *Aligns) SetString(s string) error
- func (i Aligns) String() string
- func (i *Aligns) UnmarshalText(text []byte) error
- func (i Aligns) Values() []enums.Enum
- type BBoxPoints
- func (i BBoxPoints) Desc() string
- func (ev BBoxPoints) Dim() math32.Dims
- func (i BBoxPoints) Int64() int64
- func (i BBoxPoints) MarshalText() ([]byte, error)
- func (ev BBoxPoints) MoveDelta(bb *math32.Box2, delta float32)
- func (ev BBoxPoints) PointBox(bb math32.Box2) math32.Vector2
- func (i *BBoxPoints) SetInt64(in int64)
- func (i *BBoxPoints) SetString(s string) error
- func (ev BBoxPoints) SetValueBox(bb *math32.Box2, val float32)
- func (i BBoxPoints) String() string
- func (i *BBoxPoints) UnmarshalText(text []byte) error
- func (ev BBoxPoints) ValueBox(bb math32.Box2) float32
- func (i BBoxPoints) Values() []enums.Enum
- type Canvas
- func (cv *Canvas) AddImage(fname core.Filename, width, height float32) error
- func (cv *Canvas) AddLayer()
- func (cv *Canvas) AnySelectedNodes() []svg.Node
- func (cv *Canvas) Autosave() error
- func (cv *Canvas) AutosaveCheck(fnm core.Filename) bool
- func (cv *Canvas) AutosaveDelete()
- func (cv *Canvas) ChangeMade()
- func (cv *Canvas) ClearCurLayer(lay string)
- func (cv *Canvas) CopySelected()
- func (cv *Canvas) CutSelected()
- func (cv *Canvas) DefaultGradient() string
- func (cv *Canvas) DeleteItems(nd ...svg.Node)
- func (cv *Canvas) DeleteSelected()
- func (cv *Canvas) DuplicateSelected()
- func (cv *Canvas) EditRecentPaths()
- func (cv *Canvas) ExportPDF(dpi float32, inkscape bool) error
- func (cv *Canvas) ExportPDFInkscape(dpi float32) error
- func (cv *Canvas) ExportPNG(width, height float32) error
- func (cv *Canvas) FirstLayerIndex() int
- func (cv *Canvas) HelpWiki()
- func (cv *Canvas) Init()
- func (cv *Canvas) InsertBreak()
- func (cv *Canvas) InsertCubicNode()
- func (cv *Canvas) InsertLineNode()
- func (cv *Canvas) IsCurLayer(lay string) bool
- func (cv *Canvas) ItemsAsTrees(nd ...svg.Node) []core.Treer
- func (cv *Canvas) MakeNodeToolbar(p *tree.Plan)
- func (cv *Canvas) MakeSelectToolbar(p *tree.Plan)
- func (cv *Canvas) MakeTextToolbar(p *tree.Plan)
- func (cv *Canvas) MakeToolbar(p *tree.Plan)
- func (cv *Canvas) MakeTools(p *tree.Plan)
- func (cv *Canvas) NewDrawing(sz PhysicalSize) *Canvas
- func (cv *Canvas) NodeDelete()
- func (cv *Canvas) NodeInsert(ntyp Sprites)
- func (cv *Canvas) NodeReplace(ntyp Sprites)
- func (cv *Canvas) NodeReplaceCubic()
- func (cv *Canvas) OpenDrawing(fnm core.Filename) error
- func (cv *Canvas) OpenDrawingCheck(fnm core.Filename) error
- func (cv *Canvas) OpenDrawingFile(fnm core.Filename) error
- func (cv *Canvas) PaintSetter() *PaintSetter
- func (cv *Canvas) PasteAvailFunc(bt *core.Button)
- func (cv *Canvas) PasteClip()
- func (cv *Canvas) PromptPhysicalSize()
- func (cv *Canvas) Redo() string
- func (cv *Canvas) ResizeToContents()
- func (cv *Canvas) SSVG() *svg.SVG
- func (cv *Canvas) SaveDrawing() error
- func (cv *Canvas) SaveDrawingAs(fname core.Filename) error
- func (cv *Canvas) SelectFlipHorizontal()
- func (cv *Canvas) SelectFlipVertical()
- func (cv *Canvas) SelectGroup()
- func (cv *Canvas) SelectLower()
- func (cv *Canvas) SelectLowerBottom()
- func (cv *Canvas) SelectNodeInSVG(kn tree.Node, mode events.SelectModes)
- func (cv *Canvas) SelectNodeInTree(nd tree.Node, mode events.SelectModes)
- func (cv *Canvas) SelectRaise()
- func (cv *Canvas) SelectRaiseTop()
- func (cv *Canvas) SelectRotate(deg float32)
- func (cv *Canvas) SelectRotateLeft()
- func (cv *Canvas) SelectRotateRight()
- func (cv *Canvas) SelectScale(scx, scy float32)
- func (cv *Canvas) SelectSetHeight(ht float32)
- func (cv *Canvas) SelectSetWidth(wd float32)
- func (cv *Canvas) SelectSetXPos(xp float32)
- func (cv *Canvas) SelectSetYPos(yp float32)
- func (cv *Canvas) SelectUnGroup()
- func (cv *Canvas) SelectedAsTrees() []core.Treer
- func (cv *Canvas) SetCurLayer(lay string)
- func (cv *Canvas) SetDashProperties(dary []float64)
- func (cv *Canvas) SetFillColor(fp string, final bool)
- func (cv *Canvas) SetFillProperty(prop, wp string)
- func (cv *Canvas) SetMarkerProperties(start, mid, end string, sc, mc, ec MarkerColors)
- func (cv *Canvas) SetOpacity(sp string, final bool)
- func (cv *Canvas) SetPhysicalSize(sz *PhysicalSize)
- func (t *Canvas) SetSVG(v *SVG) *Canvas
- func (cv *Canvas) SetStatus(msg string)
- func (cv *Canvas) SetStrokeColor(sp string, final bool)
- func (cv *Canvas) SetStrokeProperty(prop, wp string)
- func (cv *Canvas) SetText(txt string)
- func (cv *Canvas) SetTextNode(sii svg.Node, txt string) bool
- func (cv *Canvas) SetTextProperties(tps map[string]any)
- func (cv *Canvas) SetTitle()
- func (cv *Canvas) SetTool(tl Tools)
- func (cv *Canvas) StatusText() *core.Text
- func (cv *Canvas) SyncLayers()
- func (cv *Canvas) SyncLayersFromSVG()
- func (gv *Canvas) Tab(name string) *core.Frame
- func (cv *Canvas) Undo() string
- func (cv *Canvas) UpdateAll()
- func (cv *Canvas) UpdateGradients()
- func (cv *Canvas) UpdateLayers()
- func (cv *Canvas) UpdateMarkerColors(nd svg.Node)
- func (cv *Canvas) UpdateModalToolbar()
- func (cv *Canvas) UpdateSVG()
- func (cv *Canvas) UpdateTabs()
- func (cv *Canvas) UpdateText()
- func (cv *Canvas) UpdateTree()
- type EditState
- func (es *EditState) ActDone()
- func (es *EditState) ActStart(act Actions, data string)
- func (es *EditState) ActUnlock()
- func (es *EditState) ConfigDefaultGradient()
- func (es *EditState) DragCtrlStart(pos image.Point, idx int, ptyp Sprites)
- func (es *EditState) DragNodeStart(pos image.Point)
- func (es *EditState) DragReset()
- func (es *EditState) DragSelStart(pos image.Point)
- func (es *EditState) FirstSelected() svg.Node
- func (es *EditState) FirstSelectedNode() svg.Node
- func (es *EditState) FirstSelectedPath() *svg.Path
- func (es *EditState) HasNodeSelected() bool
- func (es *EditState) HasSelected() bool
- func (es *EditState) InAction() bool
- func (es *EditState) Init(cv *Canvas)
- func (es *EditState) IsSelected(itm svg.Node) bool
- func (es *EditState) NewRecents()
- func (es *EditState) NewSelected()
- func (es *EditState) NodeIsSelected(i int) bool
- func (es *EditState) NodeSelectAction(idx int, mode events.SelectModes)
- func (es *EditState) NodeSelectedList() []int
- func (es *EditState) PosInLastSelect(pos image.Point) bool
- func (es *EditState) ResetSelected()
- func (es *EditState) ResetSelectedNodes()
- func (es *EditState) SanitizeSelected()
- func (es *EditState) Select(itm svg.Node)
- func (es *EditState) SelectAction(n svg.Node, mode events.SelectModes, pos image.Point)
- func (es *EditState) SelectNode(i int)
- func (es *EditState) SelectedList(descendingSort bool) []svg.Node
- func (es *EditState) SelectedListDepth(sv *SVG, descendingSort bool) []svg.Node
- func (es *EditState) SelectedNames() []string
- func (es *EditState) SelectedNamesString() string
- func (es *EditState) SelectedToRecents()
- func (es *EditState) StartRecents(pos image.Point)
- func (es *EditState) Unselect(itm svg.Node)
- func (es *EditState) UnselectNode(i int)
- func (es *EditState) UpdateSelectBBox()
- func (es *EditState) UpdateSelectIsText()
- type Gradient
- type Layer
- type Layers
- type MarkerColors
- func (i MarkerColors) Desc() string
- func (i MarkerColors) Int64() int64
- func (i MarkerColors) MarshalText() ([]byte, error)
- func (i *MarkerColors) SetInt64(in int64)
- func (i *MarkerColors) SetString(s string) error
- func (i MarkerColors) String() string
- func (i *MarkerColors) UnmarshalText(text []byte) error
- func (i MarkerColors) Values() []enums.Enum
- type PaintSetter
- func (pv *PaintSetter) FillProp() string
- func (pv *PaintSetter) GetPaintType(nd svg.Node, clr image.Image, prop string) (PaintTypes, string)
- func (pv *PaintSetter) GradStopsName(nd svg.Node, url string) string
- func (pv *PaintSetter) Init()
- func (pv *PaintSetter) IsFillOn() bool
- func (pv *PaintSetter) IsStrokeOn() bool
- func (pv *PaintSetter) MarkerProperties() (start, mid, end string, sc, mc, ec MarkerColors)
- func (pv *PaintSetter) PaintTypeStack(pt PaintTypes) int
- func (pv *PaintSetter) SelectFillGrad()
- func (pv *PaintSetter) SelectStrokeGrad()
- func (t *PaintSetter) SetCanvas(v *Canvas) *PaintSetter
- func (pv *PaintSetter) SetColorNode(nd svg.Node, prop string, prev, pt PaintTypes, sp string)
- func (pv *PaintSetter) SetFill(prev, pt PaintTypes, fp string)
- func (pv *PaintSetter) SetFillOthers(nd svg.Node)
- func (pv *PaintSetter) SetFillStack(pt PaintTypes)
- func (t *PaintSetter) SetFillStops(v string) *PaintSetter
- func (t *PaintSetter) SetFillType(v PaintTypes) *PaintSetter
- func (t *PaintSetter) SetPaintStyle(v styles.Paint) *PaintSetter
- func (pv *PaintSetter) SetProperties(nd svg.Node)
- func (pv *PaintSetter) SetStroke(prev, pt PaintTypes, sp string)
- func (pv *PaintSetter) SetStrokeOpacity(nd svg.Node)
- func (pv *PaintSetter) SetStrokeOthers(nd svg.Node)
- func (pv *PaintSetter) SetStrokeStack(pt PaintTypes)
- func (t *PaintSetter) SetStrokeStops(v string) *PaintSetter
- func (t *PaintSetter) SetStrokeType(v PaintTypes) *PaintSetter
- func (pv *PaintSetter) StrokeDashProp() []float64
- func (pv *PaintSetter) StrokeProp() string
- func (pv *PaintSetter) UpdateFillOpacity()
- func (pv *PaintSetter) UpdateFromNode(ps *styles.Paint, nd svg.Node)
- func (pv *PaintSetter) UpdateStrokeOpacity()
- type PaintTypes
- func (i PaintTypes) Desc() string
- func (i PaintTypes) Int64() int64
- func (i PaintTypes) MarshalText() ([]byte, error)
- func (i *PaintTypes) SetInt64(in int64)
- func (i *PaintTypes) SetString(s string) error
- func (i PaintTypes) String() string
- func (i *PaintTypes) UnmarshalText(text []byte) error
- func (i PaintTypes) Values() []enums.Enum
- type PathNode
- type PhysicalSize
- type SVG
- func (sv *SVG) Align(aa AlignAnchors, al Aligns)
- func (sv *SVG) AlignCenter(aa AlignAnchors, dim math32.Dims, act string)
- func (sv *SVG) AlignMax(aa AlignAnchors, dim math32.Dims, act string)
- func (sv *SVG) AlignMaxAnchor(aa AlignAnchors, dim math32.Dims, act string)
- func (sv *SVG) AlignMin(aa AlignAnchors, dim math32.Dims, act string)
- func (sv *SVG) AlignMinAnchor(aa AlignAnchors, dim math32.Dims, act string)
- func (sv *SVG) CleanupInkscapeText()
- func (sv *SVG) ConstrainPoint(st, rawpt math32.Vector2) (math32.Vector2, bool)
- func (sv *SVG) DepthMap() map[tree.Node]int
- func (sv *SVG) DistributeProps()
- func (sv *SVG) DragDelta(e events.Event, node bool) (spt, mpt, dv math32.Vector2)
- func (sv *SVG) DragMove(e events.Event)
- func (sv *SVG) DrawAlignMatch(sp *core.Sprite, trgsz image.Point) func(pc *paint.Painter)
- func (sv *SVG) DrawLineAdd(sp *core.Sprite, trgsz image.Point) func(pc *paint.Painter)
- func (sv *SVG) DrawNodeAdd(ntyp Sprites, pos image.Point)
- func (sv *SVG) DrawPoint(e events.Event) image.Point
- func (sv *SVG) DrawRubberBand(sp *core.Sprite, trgsz image.Point) func(pc *paint.Painter)
- func (sv *SVG) DrawSpriteNodeCtrl(es *EditState, sp *core.Sprite, subtyp Sprites, idx int, nodepos image.Point) func(pc *paint.Painter)
- func (sv *SVG) DrawSpriteNodePoint(es *EditState, sp *core.Sprite, bbtyp Sprites, idx int) func(pc *paint.Painter)
- func (sv *SVG) DrawSpriteReshape(sp *core.Sprite, bbtyp Sprites) func(pc *paint.Painter)
- func (sv *SVG) DrawSpriteSelect(sp *core.Sprite, bbtyp Sprites) func(pc *paint.Painter)
- func (sv *SVG) EditNode(n tree.Node)
- func (sv *SVG) EditState() *EditState
- func (sv *SVG) GatherAlignPoints()
- func (sv *SVG) Gradients() []*Gradient
- func (sv *SVG) HandleSpriteSize(scale float32, pos image.Point) (bb image.Rectangle, rdraw math32.Box2)
- func (sv *SVG) InactivateAlignSprites()
- func (sv *SVG) InactivateSprites(typ Sprites)
- func (sv *SVG) Init()
- func (sv *SVG) ManipDone()
- func (sv *SVG) ManipStart(act Actions, data string)
- func (sv *SVG) ManipStartInDrag(act Actions, data string)
- func (sv *SVG) MetaData(mknew bool) (main, grid *svg.MetaData)
- func (sv *SVG) NewParent(useTree bool) tree.Node
- func (sv *SVG) NewPath(start, end image.Point) *svg.Path
- func (sv *SVG) NewText(start, end image.Point) svg.Node
- func (sv *SVG) NodeAdd(ntyp Sprites, p ppath.Path, end, start math32.Vector2) ppath.Path
- func (sv *SVG) NodeAppend(ntyp Sprites)
- func (sv *SVG) NodeDelete(idx int)
- func (sv *SVG) NodeDeleteLast()
- func (sv *SVG) NodeInsert(ntyp Sprites, idx int)
- func (sv *SVG) NodeReplace(ntyp Sprites, idx int)
- func (sv *SVG) OpenFileCleanup()
- func (sv *SVG) PathCtrlMove(pidx int, ctyp Sprites, dxf math32.Matrix2) math32.Vector2
- func (sv *SVG) PathNodeMove(pidx int, pointOnly bool, dv math32.Vector2, dxf math32.Matrix2)
- func (sv *SVG) PathNodes(path *svg.Path) []*PathNode
- func (sv *SVG) ReadMetaData()
- func (sv *SVG) Redo() string
- func (sv *SVG) RemoveEmptyGroups()
- func (sv *SVG) RemoveNodeSprites()
- func (sv *SVG) RemoveSelSprites()
- func (sv *SVG) Render()
- func (sv *SVG) RenderGrid()
- func (sv *SVG) ResizeToContents(gridIncr bool)
- func (sv *SVG) Root() *svg.Root
- func (sv *SVG) SelectContainsPoint(pt image.Point, leavesOnly, excludeSel bool) svg.Node
- func (sv *SVG) SelectWithinBBox(bbox math32.Box2, leavesOnly bool) []svg.Node
- func (sv *SVG) SetBBoxSpritePos(typ Sprites, idx int, bbox math32.Box2)
- func (sv *SVG) SetMetaData()
- func (sv *SVG) SetRubberBand(cur image.Point)
- func (sv *SVG) SetSVGName(el svg.Node)
- func (sv *SVG) SetSpritePos(sp *core.Sprite, x, y int)
- func (sv *SVG) ShowAlignMatches(pts []image.Rectangle, typs []BBoxPoints)
- func (sv *SVG) SizeFinal()
- func (sv *SVG) SnapBBox(rawbb math32.Box2) math32.Box2
- func (sv *SVG) SnapGridPoint(rawpt math32.Vector2) math32.Vector2
- func (sv *SVG) SnapPoint(rawpt math32.Vector2) math32.Vector2
- func (sv *SVG) Sprite(typ, subtyp Sprites, idx int, trgsz image.Point, init func(sp *core.Sprite)) *core.Sprite
- func (sv *SVG) SpriteCtrlDrag(idx int, ctyp Sprites, e events.Event)
- func (sv *SVG) SpriteNodeDrag(idx int, e events.Event)
- func (sv *SVG) SpriteReshapeDrag(sp Sprites, e events.Event)
- func (sv *SVG) SpriteRotateDrag(sp Sprites, e events.Event)
- func (sv *SVG) SpritesLock() *core.Sprites
- func (sv *SVG) SpritesNoLock() *core.Sprites
- func (sv *SVG) TransformAllLeaves(trans math32.Vector2, scale math32.Vector2, rot float32, pt math32.Vector2)
- func (sv *SVG) Undo() string
- func (sv *SVG) UndoSave(action, data string)
- func (sv *SVG) UndoSaveReplace(action, data string)
- func (sv *SVG) UngroupSingletons()
- func (sv *SVG) UpdateGradients(gl []*Gradient)
- func (sv *SVG) UpdateGridPixels()
- func (sv *SVG) UpdateLineAddSprite()
- func (sv *SVG) UpdateNodeSprites()
- func (sv *SVG) UpdateSelSprites()
- func (sv *SVG) UpdateSelect()
- func (sv *SVG) UpdateView()
- type SelectedState
- type SettingsData
- type Sprites
- func (i Sprites) Desc() string
- func (i Sprites) Int64() int64
- func (i Sprites) MarshalText() ([]byte, error)
- func (i *Sprites) SetInt64(in int64)
- func (i *Sprites) SetString(s string) error
- func (i Sprites) String() string
- func (i *Sprites) UnmarshalText(text []byte) error
- func (i Sprites) Values() []enums.Enum
- type StandardSizeValues
- type StandardSizes
- func (i StandardSizes) Desc() string
- func (i StandardSizes) Int64() int64
- func (i StandardSizes) MarshalText() ([]byte, error)
- func (i *StandardSizes) SetInt64(in int64)
- func (i *StandardSizes) SetString(s string) error
- func (i StandardSizes) String() string
- func (i *StandardSizes) UnmarshalText(text []byte) error
- func (i StandardSizes) Values() []enums.Enum
- type TextStyle
- type Tools
- type Tree
- func (tv *Tree) CanvasRoot() *Tree
- func (tv *Tree) Init()
- func (tv *Tree) LayerClearCurrent()
- func (tv *Tree) LayerIsCurrent() bool
- func (tv *Tree) LayerSetCurrent()
- func (tv *Tree) LayerToggleLock()
- func (tv *Tree) LayerToggleVis()
- func (tv *Tree) NewGroup()
- func (tv *Tree) SelectSVG()
- func (t *Tree) SetCanvas(v *Canvas) *Tree
Constants ¶
const ( HandleSpriteDp = 12 HandleSizeMin = 12 HandleBorderMin = 1 )
const ( SpriteLineBorderWidth = 4 SpriteLineWidth = 2 )
Variables ¶
var ( // AllDashesMap contains all of the available Dashes. // it is initialized from StdDashesMap AllDashesMap map[string][]float64 // AllDashNames contains all of the available dash names. // it is initialized from StdDashNames. AllDashNames []string // AllDashItems contains all of the available dash names for chooser. AllDashItems []core.ChooserItem )
var ( // AllMarkersXMLMap contains all of the available Markers as XML // source. It is initialized from StdMarkersMap AllMarkersXMLMap map[string]string // AllMarkersSVGMap contains all of the available Markers // as *svg.Marker elements that have been converted from // the XML source. AllMarkersSVGMap map[string]*svg.Marker // AllMarkerNames contains all of the available marker names. // it is initialized from StdMarkerNames. AllMarkerNames []string // AllMarkerItems contains all of the available marker names for chooser. // All names have marker- prefix in addition to regular marker names. AllMarkerItems []core.ChooserItem )
var ( // RecentPaths is a slice of recent file paths RecentPaths core.FilePaths // SavedPathsFilename is the name of the saved file paths file in Cogent Code data directory SavedPathsFilename = "saved-paths.json" )
var ( // Splits are the proportions for main window splits, saved and loaded Splits = [3]float32{0.15, 0.60, 0.25} // SplitsSettingsFilename is the name of the settings file in App prefs // directory for saving / loading the current splits SplitsSettingsFilename = "splits-settings.json" )
var ActionHelpMap = map[Actions]string{ Move: "<b>Alt</b> = move without snapping, <b>Ctrl</b> = constrain to axis with smallest delta", Reshape: "<b>Alt</b> = rotate, <b>Ctrl</b> = constrain to axis with smallest delta", NodeMove: "<b>Alt</b> = only move node, not control points, <b>Ctrl</b> = constrain to axis with smallest delta", CtrlMove: "<b>Ctrl</b> = constrain to axis with smallest delta", }
ActionHelpMap contains a set of help strings for different actions.
var AlignIcons = map[Aligns]icons.Icon{AlignRightAnchor: cicons.AlignRightAnchor, AlignLeft: cicons.AlignLeft, AlignCenter: cicons.AlignCenter, AlignRight: cicons.AlignRight, AlignLeftAnchor: cicons.AlignLeftAnchor, AlignBaselineHoriz: cicons.AlignBaselineHoriz, AlignBottomAnchor: cicons.AlignBottomAnchor, AlignTop: cicons.AlignTop, AlignMiddle: cicons.AlignMiddle, AlignBottom: cicons.AlignBottom, AlignTopAnchor: cicons.AlignTopAnchor, AlignBaselineVert: cicons.AlignBaselineVert}
var Settings = &SettingsData{ SettingsBase: core.SettingsBase{ Name: "Canvas", File: filepath.Join(core.TheApp.DataDir(), "Cogent Canvas", "settings.toml"), }, }
Settings are the overall Code settings
var StandardDashNames = []string{
"dash-solid",
"dash-1-1",
"dash-1-2",
"dash-1-3",
"dash-1-4",
"dash-1-6",
"dash-1-8",
"dash-1-12",
"dash-1-24",
"dash-1-48",
"dash-empty",
"dash-2-1",
"dash-3-1",
"dash-4-1",
"dash-6-1",
"dash-8-1",
"dash-12-1",
"dash-24-1",
"dash-2-2",
"dash-3-3",
"dash-4-4",
"dash-6-6",
"dash-8-8",
"dash-12-12",
"dash-24-24",
"dash-2-4",
"dash-4-2",
"dash-2-6",
"dash-6-2",
"dash-4-8",
"dash-8-4",
"dash-2-1-012-1",
"dash-4-2-1-2",
"dash-8-2-1-2",
"dash-012-012",
"dash-014-014",
"dash-0110-0110",
}
StandardDashNames are standard dash patterns
var StandardDashesMap = map[string][]float64{ "dash-solid": nil, "dash-1-1": {1, 1}, "dash-1-2": {1, 2}, "dash-1-3": {1, 3}, "dash-1-4": {1, 4}, "dash-1-6": {1, 6}, "dash-1-8": {1, 8}, "dash-1-12": {1, 12}, "dash-1-24": {1, 24}, "dash-1-48": {1, 48}, "dash-empty": {0, 11}, "dash-2-1": {2, 1}, "dash-3-1": {3, 1}, "dash-4-1": {4, 1}, "dash-6-1": {6, 1}, "dash-8-1": {8, 1}, "dash-12-1": {12, 1}, "dash-24-1": {24, 1}, "dash-2-2": {2, 2}, "dash-3-3": {3, 3}, "dash-4-4": {4, 4}, "dash-6-6": {6, 6}, "dash-8-8": {8, 8}, "dash-12-12": {12, 12}, "dash-24-24": {24, 24}, "dash-2-4": {2, 4}, "dash-4-2": {4, 2}, "dash-2-6": {2, 6}, "dash-6-2": {6, 2}, "dash-4-8": {4, 8}, "dash-8-4": {8, 4}, "dash-2-1-012-1": {2, 1, 0.5, 1}, "dash-4-2-1-2": {4, 2, 1, 2}, "dash-8-2-1-2": {8, 2, 1, 2}, "dash-012-012": {0.5, 0.5}, "dash-014-014": {0.25, 0.25}, "dash-0110-0110": {0.1, 0.1}, }
StandardDashesMap are standard dash patterns
var StandardMarkerNames = []string{
"-",
"Arrow1Sstart",
"Arrow1Send",
"Arrow1Mstart",
"Arrow1Mend",
"Arrow1Lstart",
"Arrow1Lend",
"Arrow2Sstart",
"Arrow2Send",
"Arrow2Mstart",
"Arrow2Mend",
"Arrow2Lstart",
"Arrow2Lend",
"Tail",
"DistanceStart",
"DistanceEnd",
"DotS",
"DotM",
"DotL",
"SquareS",
"SquareM",
"SquareL",
"DiamondS",
"DiamondM",
"DiamondL",
"DiamondSstart",
"DiamondSend",
"DiamondMstart",
"DiamondMend",
"DiamondLstart",
"DiamondLend",
"EmptyDiamondS",
"EmptyDiamondM",
"EmptyDiamondL",
"EmptyDiamondSstart",
"EmptyDiamondSend",
"EmptyDiamondMstart",
"EmptyDiamondMend",
"EmptyDiamondLstart",
"EmptyDiamondLend",
"TriangleInS",
"TriangleInM",
"TriangleInL",
"TriangleOutS",
"TriangleOutM",
"TriangleOutL",
"EmptyTriangleInS",
"EmptyTriangleInM",
"EmptyTriangleInL",
"EmptyTriangleOutS",
"EmptyTriangleOutM",
"EmptyTriangleOutL",
"StopS",
"StopM",
"StopL",
"SemiCircleIn",
"SemiCircleOut",
"CurveIn",
"CurveOut",
"CurvyCross",
"Scissors",
"Legs",
"Torso",
"Club",
"RazorWire",
"InfiniteLineStart",
"InfiniteLineEnd",
}
StandardMarkerNames is an ordered list of marker names
var StandardMarkersMap = map[string]string{
"-": "",
"Arrow1Lstart": `<marker style="overflow:visible" id="Arrow1Lstart" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="Arrow1Lstart">
<path transform="scale(0.8) translate(12.5,0)" style="fill-rule:evenodd;fill:context-stroke;stroke:context-stroke;stroke-width:1.0pt" d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "/>
</marker>`,
"Arrow1Lend": `<marker style="overflow:visible;" id="Arrow1Lend" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="Arrow1Lend">
<path transform="scale(0.8) rotate(180) translate(12.5,0)" style="fill-rule:evenodd;fill:context-stroke;stroke:context-stroke;stroke-width:1.0pt;" d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "/>
</marker>`,
"Arrow1Mstart": `<marker style="overflow:visible" id="Arrow1Mstart" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="Arrow1Mstart">
<path transform="scale(0.4) translate(10,0)" style="fill-rule:nonzero;fill:context-stroke;stroke:context-stroke;stroke-width:1.0pt" d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "/>
</marker>`,
"Arrow1Mend": `<marker style="overflow:visible;" id="Arrow1Mend" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="Arrow1Mend">
<path transform="scale(0.4) rotate(180) translate(10,0)" style="fill-rule:nonzero;fill:context-stroke;stroke:context-stroke;stroke-width:1.0pt;" d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "/>
</marker>`,
"Arrow1Sstart": `<marker style="overflow:visible" id="Arrow1Sstart" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="Arrow1Sstart">
<path transform="scale(0.2) translate(6,0)" style="fill-rule:evenodd;fill:context-stroke;stroke:context-stroke;stroke-width:1.0pt" d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "/>
</marker>`,
"Arrow1Send": `<marker style="overflow:visible;" id="Arrow1Send" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="Arrow1Send">
<path transform="scale(0.2) rotate(180) translate(6,0)" style="fill-rule:evenodd;fill:context-stroke;stroke:context-stroke;stroke-width:1.0pt;" d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "/>
</marker>`,
"Arrow2Lstart": `<marker style="overflow:visible" id="Arrow2Lstart" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="Arrow2Lstart">
<path transform="scale(1.1) translate(1,0)" d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z " style="fill-rule:evenodd;fill:context-stroke;stroke-width:0.62500000;stroke-linejoin:round"/>
</marker>`,
"Arrow2Lend": `<marker style="overflow:visible;" id="Arrow2Lend" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="Arrow2Lend">
<path transform="scale(1.1) rotate(180) translate(1,0)" d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z " style="fill-rule:evenodd;fill:context-stroke;stroke-width:0.62500000;stroke-linejoin:round;"/>
</marker>`,
"Arrow2Mstart": `<marker style="overflow:visible" id="Arrow2Mstart" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="Arrow2Mstart">
<path transform="scale(0.6) translate(0,0)" d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z " style="fill-rule:evenodd;fill:context-stroke;stroke-width:0.62500000;stroke-linejoin:round"/>
</marker>`,
"Arrow2Mend": `<marker style="overflow:visible;" id="Arrow2Mend" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="Arrow2Mend">
<path transform="scale(0.6) rotate(180) translate(0,0)" d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z " style="fill-rule:evenodd;fill:context-stroke;stroke-width:0.62500000;stroke-linejoin:round;"/>
</marker>`,
"Arrow2Sstart": `<marker style="overflow:visible" id="Arrow2Sstart" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="Arrow2Sstart">
<path transform="scale(0.3) translate(-2.3,0)" d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z " style="fill-rule:evenodd;fill:context-stroke;stroke-width:0.62500000;stroke-linejoin:round"/>
</marker>`,
"Arrow2Send": `<marker style="overflow:visible;" id="Arrow2Send" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="Arrow2Send">
<path transform="scale(0.3) rotate(180) translate(-2.3,0)" d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z " style="fill-rule:evenodd;fill:context-stroke;stroke-width:0.62500000;stroke-linejoin:round;"/>
</marker>`,
"Tail": `<marker style="overflow:visible" id="Tail" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="Tail">
<g transform="scale(-1.2)">
<path style="fill:none;fill-rule:evenodd;stroke:context-stroke;stroke-width:0.8;stroke-linecap:round" d="M -3.8048674,-3.9585227 L 0.54352094,0"/>
<path style="fill:none;fill-rule:evenodd;stroke:context-stroke;stroke-width:0.8;stroke-linecap:round" d="M -1.2866832,-3.9585227 L 3.0617053,0"/>
<path style="fill:none;fill-rule:evenodd;stroke:context-stroke;stroke-width:0.8;stroke-linecap:round" d="M 1.3053582,-3.9585227 L 5.6537466,0"/>
<path style="fill:none;fill-rule:evenodd;stroke:context-stroke;stroke-width:0.8;stroke-linecap:round" d="M -3.8048674,4.1775838 L 0.54352094,0.21974226"/>
<path style="fill:none;fill-rule:evenodd;stroke:context-stroke;stroke-width:0.8;stroke-linecap:round" d="M -1.2866832,4.1775838 L 3.0617053,0.21974226"/>
<path style="fill:none;fill-rule:evenodd;stroke:context-stroke;stroke-width:0.8;stroke-linecap:round" d="M 1.3053582,4.1775838 L 5.6537466,0.21974226"/>
</g>
</marker>`,
"DistanceStart": `<marker inkscape:stockid="DistanceStart" orient="auto" refY="0.0" refX="0.0" id="DistanceStart" style="overflow:visible">
<g id="g2300">
<path id="path2306" d="M 0,0 L 2,0" style="fill:none;stroke:context-fill;stroke-width:1.15;stroke-linecap:square"/>
<path id="path2302" d="M 0,0 L 13,4 L 9,0 13,-4 L 0,0 z " style="fill:context-stroke;fill-rule:evenodd;stroke:none"/>
<path id="path2304" d="M 0,-4 L 0,40" style="fill:none;stroke:context-stroke;stroke-width:1;stroke-linecap:square"/>
</g>
</marker>`,
"DistanceEnd": `<marker inkscape:stockid="DistanceEnd" orient="auto" refY="0.0" refX="0.0" id="DistanceEnd" style="overflow:visible">
<g id="g2301">
<path id="path2316" d="M 0,0 L -2,0" style="fill:none;stroke:context-fill;stroke-width:1.15;stroke-linecap:square"/>
<path id="path2312" d="M 0,0 L -13,4 L -9,0 -13,-4 L 0,0 z " style="fill:context-stroke;fill-rule:evenodd;stroke:none"/>
<path id="path2314" d="M 0,-4 L 0,40" style="fill:none;stroke:context-stroke;stroke-width:1;stroke-linecap:square"/>
</g>
</marker>`,
"DotL": `<marker style="overflow:visible" id="DotL" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="DotL">
<path transform="scale(0.8) translate(7.4, 1)" style="fill-rule:evenodd;fill:context-stroke;stroke:context-stroke;stroke-width:1.0pt" d="M -2.5,-1.0 C -2.5,1.7600000 -4.7400000,4.0 -7.5,4.0 C -10.260000,4.0 -12.5,1.7600000 -12.5,-1.0 C -12.5,-3.7600000 -10.260000,-6.0 -7.5,-6.0 C -4.7400000,-6.0 -2.5,-3.7600000 -2.5,-1.0 z "/>
</marker>`,
"DotM": `<marker style="overflow:visible" id="DotM" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="DotM">
<path transform="scale(0.4) translate(7.4, 1)" style="fill-rule:evenodd;fill:context-stroke;stroke:context-stroke;stroke-width:1.0pt" d="M -2.5,-1.0 C -2.5,1.7600000 -4.7400000,4.0 -7.5,4.0 C -10.260000,4.0 -12.5,1.7600000 -12.5,-1.0 C -12.5,-3.7600000 -10.260000,-6.0 -7.5,-6.0 C -4.7400000,-6.0 -2.5,-3.7600000 -2.5,-1.0 z "/>
</marker>`,
"DotS": `<marker style="overflow:visible" id="DotS" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="DotS">
<path transform="scale(0.2) translate(7.4, 1)" style="fill-rule:evenodd;fill:context-stroke;stroke:context-stroke;stroke-width:1.0pt" d="M -2.5,-1.0 C -2.5,1.7600000 -4.7400000,4.0 -7.5,4.0 C -10.260000,4.0 -12.5,1.7600000 -12.5,-1.0 C -12.5,-3.7600000 -10.260000,-6.0 -7.5,-6.0 C -4.7400000,-6.0 -2.5,-3.7600000 -2.5,-1.0 z "/>
</marker>`,
"SquareL": `<marker style="overflow:visible" id="SquareL" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="SquareL">
<path transform="scale(0.8)" style="fill-rule:evenodd;fill:context-stroke;stroke:context-stroke;stroke-width:1.0pt" d="M -5.0,-5.0 L -5.0,5.0 L 5.0,5.0 L 5.0,-5.0 L -5.0,-5.0 z "/>
</marker>`,
"SquareM": `<marker style="overflow:visible" id="SquareM" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="SquareM">
<path transform="scale(0.4)" style="fill-rule:evenodd;fill:context-stroke;stroke:context-stroke;stroke-width:1.0pt" d="M -5.0,-5.0 L -5.0,5.0 L 5.0,5.0 L 5.0,-5.0 L -5.0,-5.0 z "/>
</marker>`,
"SquareS": `<marker style="overflow:visible" id="SquareS" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="SquareS">
<path transform="scale(0.2)" style="fill-rule:evenodd;fill:context-stroke;stroke:context-stroke;stroke-width:1.0pt" d="M -5.0,-5.0 L -5.0,5.0 L 5.0,5.0 L 5.0,-5.0 L -5.0,-5.0 z "/>
</marker>`,
"DiamondL": `<marker style="overflow:visible" id="DiamondL" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="DiamondL">
<path transform="scale(0.8)" style="fill-rule:evenodd;fill:context-stroke;stroke:context-stroke;stroke-width:1.0pt" d="M 0,-7.0710768 L -7.0710894,0 L 0,7.0710589 L 7.0710462,0 L 0,-7.0710768 z "/>
</marker>`,
"DiamondM": `<marker style="overflow:visible" id="DiamondM" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="DiamondM">
<path transform="scale(0.4)" style="fill-rule:evenodd;fill:context-stroke;stroke:context-stroke;stroke-width:1.0pt" d="M 0,-7.0710768 L -7.0710894,0 L 0,7.0710589 L 7.0710462,0 L 0,-7.0710768 z "/>
</marker>`,
"DiamondS": `<marker style="overflow:visible" id="DiamondS" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="DiamondS">
<path transform="scale(0.2)" style="fill-rule:evenodd;fill:context-stroke;stroke:context-stroke;stroke-width:1.0pt" d="M 0,-7.0710768 L -7.0710894,0 L 0,7.0710589 L 7.0710462,0 L 0,-7.0710768 z "/>
</marker>`,
"DiamondLstart": `<marker style="overflow:visible" id="DiamondLstart" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="DiamondLstart">
<path transform="scale(0.8) translate(7,0)" style="fill-rule:evenodd;fill:context-stroke;stroke:context-stroke;stroke-width:1.0pt" d="M 0,-7.0710768 L -7.0710894,0 L 0,7.0710589 L 7.0710462,0 L 0,-7.0710768 z "/>
</marker>`,
"DiamondMstart": `<marker style="overflow:visible" id="DiamondMstart" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="DiamondMstart">
<path transform="scale(0.4) translate(6.5,0)" style="fill-rule:evenodd;fill:context-stroke;stroke:context-stroke;stroke-width:1.0pt" d="M 0,-7.0710768 L -7.0710894,0 L 0,7.0710589 L 7.0710462,0 L 0,-7.0710768 z "/>
</marker>`,
"DiamondSstart": `<marker style="overflow:visible" id="DiamondSstart" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="DiamondSstart">
<path transform="scale(0.2) translate(6,0)" style="fill-rule:evenodd;fill:context-stroke;stroke:context-stroke;stroke-width:1.0pt" d="M 0,-7.0710768 L -7.0710894,0 L 0,7.0710589 L 7.0710462,0 L 0,-7.0710768 z "/>
</marker>`,
"DiamondLend": `<marker style="overflow:visible" id="DiamondLend" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="DiamondLend">
<path transform="scale(0.8) translate(-7,0)" style="fill-rule:evenodd;fill:context-stroke;stroke:context-stroke;stroke-width:1.0pt" d="M 0,-7.0710768 L -7.0710894,0 L 0,7.0710589 L 7.0710462,0 L 0,-7.0710768 z "/>
</marker>`,
"DiamondMend": `<marker style="overflow:visible" id="DiamondMend" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="DiamondMend">
<path transform="scale(0.4) translate(-6.5,0)" style="fill-rule:evenodd;fill:context-stroke;stroke:context-stroke;stroke-width:1.0pt" d="M 0,-7.0710768 L -7.0710894,0 L 0,7.0710589 L 7.0710462,0 L 0,-7.0710768 z "/>
</marker>`,
"DiamondSend": `<marker style="overflow:visible" id="DiamondSend" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="DiamondSend">
<path transform="scale(0.2) translate(-6,0)" style="fill-rule:evenodd;fill:context-stroke;stroke:context-stroke;stroke-width:1.0pt" d="M 0,-7.0710768 L -7.0710894,0 L 0,7.0710589 L 7.0710462,0 L 0,-7.0710768 z "/>
</marker>`,
"EmptyDiamondL": `<marker style="overflow:visible" id="EmptyDiamondL" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="EmptyDiamondL">
<path transform="scale(0.8)" style="fill-rule:evenodd;fill:context-fill;stroke:context-stroke;stroke-width:1.0pt" d="M 0,-7.0710768 L -7.0710894,0 L 0,7.0710589 L 7.0710462,0 L 0,-7.0710768 z "/>
</marker>`,
"EmptyDiamondM": `<marker style="overflow:visible" id="EmptyDiamondM" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="EmptyDiamondM">
<path transform="scale(0.4)" style="fill-rule:evenodd;fill:context-fill;stroke:context-stroke;stroke-width:1.0pt" d="M 0,-7.0710768 L -7.0710894,0 L 0,7.0710589 L 7.0710462,0 L 0,-7.0710768 z "/>
</marker>`,
"EmptyDiamondS": `<marker style="overflow:visible" id="EmptyDiamondS" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="EmptyDiamondS">
<path transform="scale(0.2)" style="fill-rule:evenodd;fill:context-fill;stroke:context-stroke;stroke-width:1.0pt" d="M 0,-7.0710768 L -7.0710894,0 L 0,7.0710589 L 7.0710462,0 L 0,-7.0710768 z "/>
</marker>`,
"EmptyDiamondLstart": `<marker style="overflow:visible" id="EmptyDiamondLstart" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="EmptyDiamondLstart">
<path transform="scale(0.8) translate(7,0)" style="fill-rule:evenodd;fill:context-fill;stroke:context-stroke;stroke-width:1.0pt" d="M 0,-7.0710768 L -7.0710894,0 L 0,7.0710589 L 7.0710462,0 L 0,-7.0710768 z "/>
</marker>`,
"EmptyDiamondMstart": `<marker style="overflow:visible" id="EmptyDiamondMstart" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="EmptyDiamondMstart">
<path transform="scale(0.4) translate(6.5,0)" style="fill-rule:evenodd;fill:context-fill;stroke:context-stroke;stroke-width:1.0pt" d="M 0,-7.0710768 L -7.0710894,0 L 0,7.0710589 L 7.0710462,0 L 0,-7.0710768 z "/>
</marker>`,
"EmptyDiamondSstart": `<marker style="overflow:visible" id="EmptyDiamondSstart" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="EmptyDiamondSstart">
<path transform="scale(0.2) translate(6,0)" style="fill-rule:evenodd;fill:context-fill;stroke:context-stroke;stroke-width:1.0pt" d="M 0,-7.0710768 L -7.0710894,0 L 0,7.0710589 L 7.0710462,0 L 0,-7.0710768 z "/>
</marker>`,
"EmptyDiamondLend": `<marker style="overflow:visible" id="EmptyDiamondLend" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="EmptyDiamondLend">
<path transform="scale(0.8) translate(-7,0)" style="fill-rule:evenodd;fill:context-fill;stroke:context-stroke;stroke-width:1.0pt" d="M 0,-7.0710768 L -7.0710894,0 L 0,7.0710589 L 7.0710462,0 L 0,-7.0710768 z "/>
</marker>`,
"EmptyDiamondMend": `<marker style="overflow:visible" id="EmptyDiamondMend" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="EmptyDiamondMend">
<path transform="scale(0.4) translate(-6.5,0)" style="fill-rule:evenodd;fill:context-fill;stroke:context-stroke;stroke-width:1.0pt" d="M 0,-7.0710768 L -7.0710894,0 L 0,7.0710589 L 7.0710462,0 L 0,-7.0710768 z "/>
</marker>`,
"EmptyDiamondSend": `<marker style="overflow:visible" id="EmptyDiamondSend" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="EmptyDiamondSend">
<path transform="scale(0.2) translate(-6,0)" style="fill-rule:evenodd;fill:context-fill;stroke:context-stroke;stroke-width:1.0pt" d="M 0,-7.0710768 L -7.0710894,0 L 0,7.0710589 L 7.0710462,0 L 0,-7.0710768 z "/>
</marker>`,
"TriangleInL": `<marker style="overflow:visible" id="TriangleInL" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="TriangleInL">
<path transform="scale(-0.8)" style="fill-rule:evenodd;fill:context-stroke;stroke:context-stroke;stroke-width:1.0pt" d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "/>
</marker>`,
"TriangleInM": `<marker style="overflow:visible" id="TriangleInM" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="TriangleInM">
<path transform="scale(-0.4)" style="fill-rule:evenodd;fill:context-stroke;stroke:context-stroke;stroke-width:1.0pt" d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "/>
</marker>`,
"TriangleInS": `<marker style="overflow:visible" id="TriangleInS" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="TriangleInS">
<path transform="scale(-0.2)" style="fill-rule:evenodd;fill:context-stroke;stroke:context-stroke;stroke-width:1.0pt" d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "/>
</marker>`,
"TriangleOutL": `<marker style="overflow:visible" id="TriangleOutL" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="TriangleOutL">
<path transform="scale(0.8)" style="fill-rule:evenodd;fill:context-stroke;stroke:context-stroke;stroke-width:1.0pt" d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "/>
</marker>`,
"TriangleOutM": `<marker style="overflow:visible" id="TriangleOutM" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="TriangleOutM">
<path transform="scale(0.4)" style="fill-rule:evenodd;fill:context-stroke;stroke:context-stroke;stroke-width:1.0pt" d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "/>
</marker>`,
"TriangleOutS": `<marker style="overflow:visible" id="TriangleOutS" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="TriangleOutS">
<path transform="scale(0.2)" style="fill-rule:evenodd;fill:context-stroke;stroke:context-stroke;stroke-width:1.0pt" d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "/>
</marker>`,
"EmptyTriangleInL": `<marker style="overflow:visible" id="EmptyTriangleInL" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="EmptyTriangleInL">
<path transform="scale(-0.8) translate(-6,0)" style="fill-rule:evenodd;fill:context-fill;stroke:context-stroke;stroke-width:1.0pt" d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "/>
</marker>`,
"EmptyTriangleInM": `<marker style="overflow:visible" id="EmptyTriangleInM" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="EmptyTriangleInM">
<path transform="scale(-0.4) translate(-4.5,0)" style="fill-rule:evenodd;fill:context-fill;stroke:context-stroke;stroke-width:1.0pt" d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "/>
</marker>`,
"EmptyTriangleInS": `<marker style="overflow:visible" id="EmptyTriangleInS" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="EmptyTriangleInS">
<path transform="scale(-0.2) translate(-3.0,0)" style="fill-rule:evenodd;fill:context-fill;stroke:context-stroke;stroke-width:1.0pt" d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "/>
</marker>`,
"EmptyTriangleOutL": `<marker style="overflow:visible" id="EmptyTriangleOutL" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="EmptyTriangleOutL">
<path transform="scale(0.8) translate(-6,0)" style="fill-rule:evenodd;fill:context-fill;stroke:context-stroke;stroke-width:1.0pt" d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "/>
</marker>`,
"EmptyTriangleOutM": `<marker style="overflow:visible" id="EmptyTriangleOutM" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="EmptyTriangleOutM">
<path transform="scale(0.4) translate(-4.5,0)" style="fill-rule:evenodd;fill:context-fill;stroke:context-stroke;stroke-width:1.0pt" d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "/>
</marker>`,
"EmptyTriangleOutS": `<marker style="overflow:visible" id="EmptyTriangleOutS" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="EmptyTriangleOutS">
<path transform="scale(0.2) translate(-3.0,0)" style="fill-rule:evenodd;fill:context-fill;stroke:context-stroke;stroke-width:1.0pt" d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "/>
</marker>`,
"StopL": `<marker style="overflow:visible" id="StopL" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="StopL">
<path transform="scale(0.8)" style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:context-stroke;stroke-width:1.0pt" d="M 0.0,5.65 L 0.0,-5.65"/>
</marker>`,
"StopM": `<marker style="overflow:visible" id="StopM" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="StopM">
<path transform="scale(0.4)" style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:context-stroke;stroke-width:1.0pt" d="M 0.0,5.65 L 0.0,-5.65"/>
</marker>`,
"StopS": `<marker style="overflow:visible" id="StopS" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="StopS">
<path transform="scale(0.2)" style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:context-stroke;stroke-width:1.0pt" d="M 0.0,5.65 L 0.0,-5.65"/>
</marker>`,
"SemiCircleIn": `<marker style="overflow:visible" id="SemiCircleIn" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="SemiCircleIn">
<path transform="scale(0.6)" style="fill-rule:evenodd;fill:context-stroke;stroke:context-stroke;stroke-width:1.0pt" d="M -0.37450702,-0.045692580 C -0.37450702,2.7143074 1.8654930,4.9543074 4.6254930,4.9543074 L 4.6254930,-5.0456926 C 1.8654930,-5.0456926 -0.37450702,-2.8056926 -0.37450702,-0.045692580 z "/>
</marker>`,
"SemiCircleOut": `<marker style="overflow:visible" id="SemiCircleOut" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="SemiCircleOut">
<path transform="scale(0.6) translate(7.125493,0.763446)" style="fill-rule:evenodd;fill:context-stroke;stroke:context-stroke;stroke-width:1.0pt" d="M -2.5,-0.80913858 C -2.5,1.9508614 -4.7400000,4.1908614 -7.5,4.1908614 L -7.5,-5.8091386 C -4.7400000,-5.8091386 -2.5,-3.5691386 -2.5,-0.80913858 z "/>
</marker>`,
"CurveIn": `<marker style="overflow:visible" id="CurveIn" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="CurveIn">
<path transform="scale(0.6)" style="fill-rule:evenodd;stroke:context-stroke;stroke-width:1.0pt;fill:none" d="M 4.6254930,-5.0456926 C 1.8654930,-5.0456926 -0.37450702,-2.8056926 -0.37450702,-0.045692580 C -0.37450702,2.7143074 1.8654930,4.9543074 4.6254930,4.9543074"/>
</marker>`,
"CurveOut": `<marker style="overflow:visible" id="CurveOut" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="CurveOut">
<path transform="scale(0.6)" style="fill:none;fill-rule:evenodd;stroke:context-stroke;stroke-width:1.0pt" d="M -5.4129913,-5.0456926 C -2.6529913,-5.0456926 -0.41299131,-2.8056926 -0.41299131,-0.045692580 C -0.41299131,2.7143074 -2.6529913,4.9543074 -5.4129913,4.9543074"/>
</marker>`,
"CurvyCross": `<marker style="overflow:visible" id="CurvyCross" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="CurvyCross">
<g transform="scale(0.6)">
<path style="fill:none;fill-rule:evenodd;stroke:context-stroke;stroke-width:1.0pt" d="M 4.6254930,-5.0456926 C 1.8654930,-5.0456926 -0.37450702,-2.8056926 -0.37450702,-0.045692580 C -0.37450702,2.7143074 1.8654930,4.9543074 4.6254930,4.9543074"/>
<path style="fill:none;fill-rule:evenodd;stroke:context-stroke;stroke-width:1.0pt" d="M -5.4129913,-5.0456926 C -2.6529913,-5.0456926 -0.41299131,-2.8056926 -0.41299131,-0.045692580 C -0.41299131,2.7143074 -2.6529913,4.9543074 -5.4129913,4.9543074"/>
</g>
</marker>`,
"Scissors": `<marker style="overflow:visible" id="Scissors" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="Scissors">
<path style="fill:context-stroke;" d="M 9.0898857,-3.6061018 C 8.1198849,-4.7769976 6.3697607,-4.7358294 5.0623558,-4.2327734 L -3.1500488,-1.1548705 C -5.5383421,-2.4615840 -7.8983361,-2.0874077 -7.8983361,-2.7236578 C -7.8983361,-3.2209742 -7.4416699,-3.1119800 -7.5100293,-4.4068519 C -7.5756648,-5.6501286 -8.8736064,-6.5699315 -10.100428,-6.4884954 C -11.327699,-6.4958500 -12.599867,-5.5553341 -12.610769,-4.2584343 C -12.702194,-2.9520479 -11.603560,-1.7387447 -10.304005,-1.6532027 C -8.7816644,-1.4265411 -6.0857470,-2.3487593 -4.8210600,-0.082342643 C -5.7633447,1.6559151 -7.4350844,1.6607341 -8.9465707,1.5737277 C -10.201445,1.5014928 -11.708664,1.8611256 -12.307219,3.0945882 C -12.885586,4.2766744 -12.318421,5.9591904 -10.990470,6.3210002 C -9.6502788,6.8128279 -7.8098011,6.1912892 -7.4910978,4.6502760 C -7.2454393,3.4624530 -8.0864637,2.9043186 -7.7636052,2.4731223 C -7.5199917,2.1477623 -5.9728246,2.3362771 -3.2164999,1.0982979 L 5.6763468,4.2330688 C 6.8000164,4.5467672 8.1730685,4.5362646 9.1684433,3.4313614 L -0.051640930,-0.053722219 L 9.0898857,-3.6061018 z M -9.2179159,-5.5066058 C -7.9233569,-4.7838060 -8.0290767,-2.8230356 -9.3743431,-2.4433169 C -10.590861,-2.0196559 -12.145370,-3.2022863 -11.757521,-4.5207817 C -11.530373,-5.6026336 -10.104134,-6.0014137 -9.2179159,-5.5066058 z M -9.1616516,2.5107591 C -7.8108215,3.0096239 -8.0402087,5.2951947 -9.4138723,5.6023681 C -10.324932,5.9187072 -11.627422,5.4635705 -11.719569,4.3902287 C -11.897178,3.0851737 -10.363484,1.9060805 -9.1616516,2.5107591 z " id="schere"/>
</marker>`,
"Legs": `<marker style="overflow:visible" id="Legs" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="Legs">
<g transform="scale(-0.7)">
<g transform="matrix(0,-1.000000,-1.000000,0,20.70862,21.31391)">
<path style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:context-stroke;stroke-width:1.0000000pt" d="M 21.221250,20.675360 C 14.311099,25.396517 18.766725,27.282204 15.380179,34.118595"/>
<path style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:context-stroke;stroke-width:1.0000000pt" d="M 21.398110,20.548120 C 20.037601,28.895644 24.934182,29.318060 25.903151,34.373078"/>
</g>
<path style="fill:context-stroke;fill-rule:evenodd;stroke-width:1.0000000pt" d="M -14.090070,-6.7318716 L -15.012238,-2.6884886 L -11.049487,-3.9115586 L -14.090070,-6.7318716 z "/>
<path style="fill:context-stroke;fill-rule:evenodd;stroke-width:1.0000000pt" d="M -15.215679,4.5567534 L -13.341552,8.2563664 L -11.074678,4.7835114 L -15.215679,4.5567534 z "/>
</g>
</marker>`,
"Torso": `<marker style="overflow:visible" id="Torso" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="Torso">
<g transform="scale(0.7)">
<path style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:context-stroke;stroke-width:1.2500000" d="M -4.7792281,-3.2395420 C -2.4288541,-2.8736027 0.52103922,-1.3019943 0.25792722,0.38794346 C -0.0051877922,2.0778819 -2.2126741,2.6176539 -4.5630471,2.2517169 C -6.9134221,1.8857769 -8.5210350,0.75201414 -8.2579220,-0.93792336 C -7.9948090,-2.6278615 -7.1296041,-3.6054813 -4.7792281,-3.2395420 z "/>
<path style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:context-stroke;stroke-width:1.0000000pt" d="M 4.4598789,0.088665736 C -2.5564571,-4.3783320 5.2248769,-3.9061806 -0.84829578,-8.7197331"/>
<path style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:context-stroke;stroke-width:1.0000000pt" d="M 4.9298719,0.057520736 C -1.3872731,1.7494689 1.8027579,5.4782079 -4.9448731,7.5462725"/>
<rect style="fill-rule:evenodd;fill:context-stroke;stroke-width:1.0000000pt" width="2.6366582" height="2.7608147" x="-10.391706" y="-1.7408575" transform="matrix(0.527536,-0.849533,0.887668,0.460484,0,0)"/>
<rect style="fill-rule:evenodd;fill:context-stroke;stroke-width:1.0000000pt" width="2.7327356" height="2.8614161" x="4.9587269" y="-7.9629307" transform="matrix(0.671205,-0.741272,0.790802,0.612072,0,0)"/>
<path style="fill:#ff0000;fill-opacity:0.75000000;fill-rule:evenodd;stroke:context-stroke;stroke-width:1.0000000pt" d="M 16.779951 -28.685045 A 0.60731727 0.60731727 0 1 0 15.565317,-28.685045 A 0.60731727 0.60731727 0 1 0 16.779951 -28.685045 z" transform="matrix(0,-1.109517,1.109517,0,25.96648,19.71619)"/>
<path style="fill:#ff0000;fill-opacity:0.75000000;fill-rule:evenodd;stroke:context-stroke;stroke-width:1.0000000pt" d="M 16.779951 -28.685045 A 0.60731727 0.60731727 0 1 0 15.565317,-28.685045 A 0.60731727 0.60731727 0 1 0 16.779951 -28.685045 z" transform="matrix(0,-1.109517,1.109517,0,26.82450,16.99126)"/>
</g>
</marker>`,
"Club": `<marker style="overflow:visible" id="Club" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="Club">
<path transform="scale(0.6)" style="fill-rule:evenodd;fill:context-stroke;stroke:context-stroke;stroke-width:0.74587913pt" d="M -1.5971367,-7.0977635 C -3.4863874,-7.0977635 -5.0235187,-5.5606321 -5.0235187,-3.6713813 C -5.0235187,-3.0147015 -4.7851656,-2.4444556 -4.4641095,-1.9232271 C -4.5028609,-1.8911157 -4.5437814,-1.8647646 -4.5806531,-1.8299921 C -5.2030765,-2.6849849 -6.1700514,-3.2751330 -7.3077730,-3.2751330 C -9.1970245,-3.2751331 -10.734155,-1.7380016 -10.734155,0.15124914 C -10.734155,2.0404999 -9.1970245,3.5776313 -7.3077730,3.5776313 C -6.3143268,3.5776313 -5.4391540,3.1355702 -4.8137404,2.4588126 C -4.9384274,2.8137041 -5.0235187,3.1803000 -5.0235187,3.5776313 C -5.0235187,5.4668819 -3.4863874,7.0040135 -1.5971367,7.0040135 C 0.29211394,7.0040135 1.8292454,5.4668819 1.8292454,3.5776313 C 1.8292454,2.7842354 1.5136868,2.0838028 1.0600576,1.5031550 C 2.4152718,1.7663868 3.7718375,2.2973711 4.7661444,3.8340272 C 4.0279463,3.0958289 3.5540908,1.7534117 3.5540908,-0.058529361 L 2.9247554,-0.10514681 L 3.5074733,-0.12845553 C 3.5074733,-1.9403966 3.9580199,-3.2828138 4.6962183,-4.0210121 C 3.7371277,-2.5387813 2.4390549,-1.9946496 1.1299838,-1.7134486 C 1.5341802,-2.2753578 1.8292454,-2.9268556 1.8292454,-3.6713813 C 1.8292454,-5.5606319 0.29211394,-7.0977635 -1.5971367,-7.0977635 z "/>
</marker>`,
"RazorWire": `<marker style="overflow:visible" orient="auto" refY="0" refX="0" id="RazorWire" inkscape:stockid="RazorWire">
<path d="M 0.022727273,-0.74009011 L 0.022727273,0.69740989 L -7.7585227,3.0099099 L 10.678977,3.0099099 L 3.4914773,0.69740989 L 3.4914773,-0.74009011 L 10.741477,-2.8963401 L -7.7272727,-2.8963401 L 0.022727273,-0.74009011 z " style="fill:#808080;fill-opacity:1;fill-rule:evenodd;stroke:context-stroke;stroke-width:0.1pt" transform="scale(0.8,0.8)"/>
</marker>`,
"InfiniteLineEnd": `<marker orient="auto" refY="0" refX="0" id="InfiniteLineEnd" inkscape:stockid="InfiniteLineEnd" style="overflow:visible">
<g style="fill:context-stroke">
<circle cx="3" cy="0" r="0.8"/>
<circle cx="6.5" cy="0" r="0.8"/>
<circle cx="10" cy="0" r="0.8"/>
</g>
</marker>`,
"InfiniteLineStart": `<marker orient="auto" refY="0" refX="0" id="InfiniteLineStart" inkscape:stockid="InfiniteLineStart" style="overflow:visible">
<g transform="translate(-13,0)" style="fill:context-stroke">
<circle cx="3" cy="0" r="0.8"/>
<circle cx="6.5" cy="0" r="0.8"/>
<circle cx="10" cy="0" r="0.8"/>
</g>
</marker>`,
}
StandardMarkersMap is a map of the standard markers
var StandardSizesMap = map[StandardSizes]*StandardSizeValues{ Img1280x720: {units.UnitPx, 1280, 720}, Img1920x1080: {units.UnitPx, 1920, 1080}, Img3840x2160: {units.UnitPx, 3840, 2160}, Img7680x4320: {units.UnitPx, 7680, 4320}, Img1024x768: {units.UnitPx, 1024, 768}, Img720x480: {units.UnitPx, 720, 480}, Img640x480: {units.UnitPx, 640, 480}, Img320x240: {units.UnitPx, 320, 240}, A4: {units.UnitMm, 210, 297}, USLetter: {units.UnitPt, 612, 792}, USLegal: {units.UnitPt, 612, 1008}, A0: {units.UnitMm, 841, 1189}, A1: {units.UnitMm, 594, 841}, A2: {units.UnitMm, 420, 594}, A3: {units.UnitMm, 297, 420}, A5: {units.UnitMm, 148, 210}, A6: {units.UnitMm, 105, 148}, A7: {units.UnitMm, 74, 105}, A8: {units.UnitMm, 52, 74}, A9: {units.UnitMm, 37, 52}, A10: {units.UnitMm, 26, 37}, }
StandardSizesMap is the map of size values for each standard size
var ToolHelpMap = map[Tools]string{ SelectTool: "Click to select items: keep clicking to go deeper", SelBoxTool: "Drag a box to select elements within", NodeTool: "Click to select a path to edit <b>Alt</b> = only move node, not control points, <b>Ctrl</b> = constrain to axis with smallest delta", RectTool: "Drag to add a new rectangle <b>Ctrl</b> = constrain to axis with smallest delta", EllipseTool: "Drag to add a new ellipse <b>Ctrl</b> = constrain to axis with smallest delta", BezierTool: "Click to add points (don't drag) <b>Alt</b> = add curve nodes, otherwise lines, <b>Enter</b> or click on same spot when done (Alt closes)", }
ToolHelpMap contains a set of help strings for different tools.
Functions ¶
func AddNewDash ¶
AddNewDash adds new dash pattern to available list, creating name based on pattern, which is returned. the given array is copied before storing, just in case.
func BBoxReshapeDelta ¶
func BBoxReshapeDelta(bb *math32.Box2, delta float32, bbX, bbY BBoxPoints)
BBoxReshapeDelta moves given target dimensions by delta amounts
func DashIconsInit ¶
func DashIconsInit()
DashIconsInit ensures that the dashes have been turned into icons for selectors, with same name (dash- prefix). Call this after startup, when configuring a gui element that needs it.
func DashMatchArray ¶
DashMatchArray returns the matching dash pattern for given array and line width. divides array and matches with wide tolerance. returns true if no match and thus new dash pattern was added, else false.
func DashMulWidth ¶
DashMulWidth returns the dash array multiplied by the line width -- what is actually set
func DashString ¶
DashString returns string of dash array values
func IconToMarkerName ¶
IconToMarkerName converts a icons.Icon (as an interface{}) to a marker name suitable for use (removes marker- prefix)
func InactivateNodeCtrls ¶ added in v0.1.2
func InactivateNodePoint ¶ added in v0.1.2
func LayerIsLocked ¶
LayerIsLocked returns true if layer is locked (insensitive = true)
func LayerIsVisible ¶
LayerIsVisible returns true if layer is visible
func MarkerDeleteCtxtColors ¶
MarkerDeleteCtxtColors deletes context-* color names from standard code
func MarkerIconsInit ¶
func MarkerIconsInit()
MarkerIconsInit ensures that the markers have been turned into icons for selectors, with marker- preix. Call this after startup, when configuring a gui element that needs it. It also initializes the AllMarkersSVGMap.
func MarkerNameToIcon ¶
MarkerNameToIcon converts a marker name to a icons.Icon
func MarkerSetColors ¶
MarkerSetColors sets color properties in each element
func MarkerSetProp ¶
MarkerSetProp sets marker property for given node to given marker name (canonical)
func MarkerUpdateColorProp ¶
MarkerUpdateColorProp updates marker color for given marker property
func NewMarker ¶
NewMarker makes a new marker of given name and id in given svg, copying from existing one in AllMarkersSVGMap.
func NewMarkerFromXML ¶
NewMarkerFromXML makes a new marker from given XML source.
func NewSVGElement ¶
NewSVGElement makes a new SVG element of the given type. see [Canvas.NewParent] for the parent where it is made.
func NewSVGElementDrag ¶
NewSVGElementDrag makes a new SVG element of the given type during the drag operation.
func NodeIsLayer ¶
NodeIsLayer returns true if given node is a layer
func NodeIsMetaData ¶
NodeIsMetaData returns true if given node is a MetaData
func NodeParentLayer ¶
NodeParentLayer returns the parent group that is a layer -- nil if none
func OpacityFromColor ¶ added in v0.1.2
OpacityFromColor extracts the opacity as a 0-1 float from given uniform color-as-image.
func OpenPaths ¶ added in v0.1.2
func OpenPaths()
OpenPaths loads the active SavedPaths from settings dir
func OpenSplits ¶ added in v0.1.2
func OpenSplits()
OpenSplits opens last saved splits from settings file.
func RecycleMarker ¶
RecycleMarker ensures that given marker name and id exists in SVG, making a new one, copying from standard markers if not. if mc is MarkerCopyColor then sets marker colors to node colors.
func SavePaths ¶ added in v0.1.2
func SavePaths()
SavePaths saves the active SavedPaths to settings dir
func SaveSplits ¶ added in v0.1.2
func SaveSplits()
SaveSplits saves named splits to a json-formatted file.
func SetSpriteProperties ¶
SetSpriteProperties sets sprite properties
func SnapToIncr ¶
SnapToIncr snaps value to given increment, first subtracting given offset. Tolerance is determined by settings, which is in screen pixels. Returns true if snapped.
func SnapToPoint ¶ added in v0.1.2
SnapToPoint snaps value to given potential snap point, in screen pixel units. Tolerance is determined by settings. Returns true if snapped.
func SpriteByName ¶
SpriteByName returns the given sprite in the context of the given widget, returning nil, false if not yet made.
func SpriteName ¶
SpriteName returns the unique name of the sprite based on main type, subtype (e.g., bbox) if relevant, and index if relevant
func ToolDoesBasicSelect ¶
ToolDoesBasicSelect returns true if tool should do select for clicks
Types ¶
type Actions ¶
type Actions int32 //enums:enum
const ActionsN Actions = 13
ActionsN is the highest valid value for type Actions, plus one.
func ActionsValues ¶
func ActionsValues() []Actions
ActionsValues returns all possible values for the type Actions.
func (Actions) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*Actions) SetString ¶
SetString sets the Actions value from its string representation, and returns an error if the string is invalid.
func (*Actions) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type AlignAnchors ¶
type AlignAnchors int32 //enums:enum
AlignAnchors are ways of anchoring alignment
const ( AlignFirst AlignAnchors = iota AlignLast AlignDrawing AlignSelectBox )
const AlignAnchorsN AlignAnchors = 4
AlignAnchorsN is the highest valid value for type AlignAnchors, plus one.
func AlignAnchorsValues ¶
func AlignAnchorsValues() []AlignAnchors
AlignAnchorsValues returns all possible values for the type AlignAnchors.
func (AlignAnchors) Desc ¶
func (i AlignAnchors) Desc() string
Desc returns the description of the AlignAnchors value.
func (AlignAnchors) Int64 ¶
func (i AlignAnchors) Int64() int64
Int64 returns the AlignAnchors value as an int64.
func (AlignAnchors) MarshalText ¶
func (i AlignAnchors) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface.
func (*AlignAnchors) SetInt64 ¶
func (i *AlignAnchors) SetInt64(in int64)
SetInt64 sets the AlignAnchors value from an int64.
func (*AlignAnchors) SetString ¶
func (i *AlignAnchors) SetString(s string) error
SetString sets the AlignAnchors value from its string representation, and returns an error if the string is invalid.
func (AlignAnchors) String ¶
func (i AlignAnchors) String() string
String returns the string representation of this AlignAnchors value.
func (*AlignAnchors) UnmarshalText ¶
func (i *AlignAnchors) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
func (AlignAnchors) Values ¶
func (i AlignAnchors) Values() []enums.Enum
Values returns all possible values for the type AlignAnchors.
type AlignView ¶
type AlignView struct {
core.Frame
// Anchor is the alignment anchor
Anchor AlignAnchors
// the parent [Canvas]
Canvas *Canvas `copier:"-" json:"-" xml:"-" display:"-"`
}
AlignView provides a range of alignment actions on selected objects.
func NewAlignView ¶
NewAlignView returns a new AlignView with the given optional parent: AlignView provides a range of alignment actions on selected objects.
func (*AlignView) SetAnchor ¶
func (t *AlignView) SetAnchor(v AlignAnchors) *AlignView
SetAnchor sets the [AlignView.Anchor]: Anchor is the alignment anchor
type Aligns ¶
type Aligns int32 //enums:enum -transform kebab
Aligns are ways of aligning items
const ( // align right edges to left edge of anchor item AlignRightAnchor Aligns = iota // align left edges AlignLeft // align horizontal centers AlignCenter // align right edges AlignRight // align left edges to right edge of anchor item AlignLeftAnchor // align left text baseline edges AlignBaselineHoriz // align bottom edges to top edge of anchor item AlignBottomAnchor // align top edges AlignTop // align middle vertical point AlignMiddle // align bottom edges AlignBottom // align top edges to bottom edge of anchor item AlignTopAnchor // align baseline points vertically AlignBaselineVert )
const AlignsN Aligns = 12
AlignsN is the highest valid value for type Aligns, plus one.
func AlignsValues ¶
func AlignsValues() []Aligns
AlignsValues returns all possible values for the type Aligns.
func (Aligns) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*Aligns) SetString ¶
SetString sets the Aligns value from its string representation, and returns an error if the string is invalid.
func (*Aligns) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type BBoxPoints ¶
type BBoxPoints int32 //enums:enum
BBoxPoints are the different control points within a bounding box
const ( BBLeft BBoxPoints = iota BBCenter BBRight BBTop BBMiddle BBBottom )
const BBoxPointsN BBoxPoints = 6
BBoxPointsN is the highest valid value for type BBoxPoints, plus one.
func BBoxPointsValues ¶
func BBoxPointsValues() []BBoxPoints
BBoxPointsValues returns all possible values for the type BBoxPoints.
func ReshapeBBoxPoints ¶
func ReshapeBBoxPoints(reshape Sprites) (bbX, bbY BBoxPoints)
ReshapeBBoxPoints returns the X and Y BBoxPoints for given sprite Reshape control point.
func (BBoxPoints) Desc ¶
func (i BBoxPoints) Desc() string
Desc returns the description of the BBoxPoints value.
func (BBoxPoints) Dim ¶
func (ev BBoxPoints) Dim() math32.Dims
Dim returns the relevant dimension for this point
func (BBoxPoints) Int64 ¶
func (i BBoxPoints) Int64() int64
Int64 returns the BBoxPoints value as an int64.
func (BBoxPoints) MarshalText ¶
func (i BBoxPoints) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface.
func (BBoxPoints) MoveDelta ¶
func (ev BBoxPoints) MoveDelta(bb *math32.Box2, delta float32)
MoveDelta moves overall bbox (Max and Min) by delta (X or Y depending on pt)
func (BBoxPoints) PointBox ¶
func (ev BBoxPoints) PointBox(bb math32.Box2) math32.Vector2
PointBox returns the relevant point for a given bounding box, where relevant dimension is from ValRect and other is midpoint -- for drawing lines.
func (*BBoxPoints) SetInt64 ¶
func (i *BBoxPoints) SetInt64(in int64)
SetInt64 sets the BBoxPoints value from an int64.
func (*BBoxPoints) SetString ¶
func (i *BBoxPoints) SetString(s string) error
SetString sets the BBoxPoints value from its string representation, and returns an error if the string is invalid.
func (BBoxPoints) SetValueBox ¶
func (ev BBoxPoints) SetValueBox(bb *math32.Box2, val float32)
SetValueBox sets the relevant value for a given bounding box as a math32.Box2
func (BBoxPoints) String ¶
func (i BBoxPoints) String() string
String returns the string representation of this BBoxPoints value.
func (*BBoxPoints) UnmarshalText ¶
func (i *BBoxPoints) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
func (BBoxPoints) ValueBox ¶
func (ev BBoxPoints) ValueBox(bb math32.Box2) float32
ValueBox returns the relevant value for a given bounding box as a math32.Box2
func (BBoxPoints) Values ¶
func (i BBoxPoints) Values() []enums.Enum
Values returns all possible values for the type BBoxPoints.
type Canvas ¶
type Canvas struct {
core.Frame
// full path to current drawing filename
Filename core.Filename `extension:".svg" set:"-"`
// current edit state
EditState EditState `set:"-"`
// SVG displays the SVG image and has methods for managing it.
SVG *SVG
// contains filtered or unexported fields
}
Canvas is the main widget of the Cogent Canvas SVG vector graphics program.
func NewCanvas ¶
NewCanvas returns a new Canvas with the given optional parent: Canvas is the main widget of the Cogent Canvas SVG vector graphics program.
func (*Canvas) AnySelectedNodes ¶ added in v0.1.2
AnySelectedNodes returns svg nodes that are selected in the svg tree (first) or selected in the SVG drawing (second), as svg Nodes. This is useful for contextualizing tree actions (e.g., NewGroup).
func (*Canvas) Autosave ¶ added in v0.1.2
Autosave does the autosave -- safe to call in a separate goroutine
func (*Canvas) AutosaveCheck ¶ added in v0.1.2
AutosaveCheck checks if an autosave file exists.
func (*Canvas) AutosaveDelete ¶ added in v0.1.2
func (cv *Canvas) AutosaveDelete()
AutosaveDelete deletes any existing autosave file
func (*Canvas) ChangeMade ¶
func (cv *Canvas) ChangeMade()
ChangeMade should be called after any change is completed on the drawing. Calls autosave.
func (*Canvas) ClearCurLayer ¶
ClearCurLayer clears the current layer for creating items if it was set to the given layer name
func (*Canvas) CopySelected ¶
func (cv *Canvas) CopySelected()
CopySelected copies selected items in SVG view, using Tree methods.
func (*Canvas) CutSelected ¶
func (cv *Canvas) CutSelected()
CutSelected cuts selected items in SVG view, using Tree methods.
func (*Canvas) DefaultGradient ¶
DefaultGradient returns the default gradient to use for setting stops
func (*Canvas) DeleteItems ¶ added in v0.1.2
DeleteItems deletes the given svg.Node item(s) using Tree methods.
func (*Canvas) DeleteSelected ¶
func (cv *Canvas) DeleteSelected()
DeleteSelected deletes selected items in SVG view, using Tree methods
func (*Canvas) DuplicateSelected ¶
func (cv *Canvas) DuplicateSelected()
DuplicateSelected duplicates selected items in SVG view, using Tree methods
func (*Canvas) EditRecentPaths ¶ added in v0.1.2
func (cv *Canvas) EditRecentPaths()
EditRecentPaths opens a dialog editor for editing the recent project paths list
func (*Canvas) ExportPDF ¶
ExportPDF exports drawing to a PDF file (auto-names to same name with .pdf suffix). Uses native PDF rendering or optionally calls inkscape from the command line -- needs to be on the PATH. specify DPI of resulting image for effects rendering. Renders full current page -- do ResizeToContents to render just current contents.
func (*Canvas) ExportPDFInkscape ¶ added in v0.1.3
func (*Canvas) ExportPNG ¶
ExportPNG exports drawing to a PNG image (auto-names to same name with .png suffix). Specify either width or height of resulting image, or nothing for physical size as set. Renders full current page: Do Size/Resize to contents to render just current contents.
func (*Canvas) FirstLayerIndex ¶
FirstLayerIndex returns index of first layer group in svg
func (*Canvas) InsertBreak ¶ added in v0.1.2
func (cv *Canvas) InsertBreak()
InsertBreak inserts a break (move) into current active path: If no selection: at end, otherwise after first selected node.
func (*Canvas) InsertCubicNode ¶ added in v0.1.2
func (cv *Canvas) InsertCubicNode()
InsertCubicNode inserts a cubic node into current active path: If no selection: at end, otherwise after first selected node.
func (*Canvas) InsertLineNode ¶ added in v0.1.2
func (cv *Canvas) InsertLineNode()
InsertLineNode inserts a LineTo node into current active path: If no selection: at end, otherwise after first selected node.
func (*Canvas) IsCurLayer ¶
IsCurLayer returns true if given layer is the current layer for creating items
func (*Canvas) ItemsAsTrees ¶ added in v0.1.2
ItemsAsTrees returns the list of SVG items as Tree nodes.
func (*Canvas) MakeNodeToolbar ¶
func (*Canvas) MakeSelectToolbar ¶
MakeSelectToolbar adds the select toolbar to the given plan.
func (*Canvas) MakeTextToolbar ¶
func (*Canvas) MakeToolbar ¶
func (*Canvas) NewDrawing ¶
func (cv *Canvas) NewDrawing(sz PhysicalSize) *Canvas
NewDrawing creates a new drawing of the given size
func (*Canvas) NodeDelete ¶ added in v0.1.2
func (cv *Canvas) NodeDelete()
NodeDelete deletes the selected node(s) from current active path.
func (*Canvas) NodeInsert ¶ added in v0.1.2
NodeInsert inserts a node of given type into current active path: If no selection: at end, otherwise after first selected node.
func (*Canvas) NodeReplace ¶ added in v0.1.2
NodeReplace replaces current node with new one of given type into current active path.
func (*Canvas) NodeReplaceCubic ¶ added in v0.1.2
func (cv *Canvas) NodeReplaceCubic()
NodeReplaceCubic replaces selected non-cubic nodes with cubic ones into current active path
func (*Canvas) OpenDrawing ¶
OpenDrawing opens a new .svg drawing
func (*Canvas) OpenDrawingCheck ¶ added in v0.1.2
OpenDrawingCheck opens a new .svg drawing, checking for autosave file.
func (*Canvas) OpenDrawingFile ¶
OpenDrawingFile opens a new .svg drawing file -- just the basic opening
func (*Canvas) PaintSetter ¶ added in v0.1.2
func (cv *Canvas) PaintSetter() *PaintSetter
func (*Canvas) PasteAvailFunc ¶
PasteAvailFunc is an ActionUpdateFunc that inactivates action if no paste avail
func (*Canvas) PasteClip ¶
func (cv *Canvas) PasteClip()
PasteClip pastes clipboard, using cur layer etc
func (*Canvas) PromptPhysicalSize ¶ added in v0.1.2
func (cv *Canvas) PromptPhysicalSize()
PromptPhysicalSize prompts for the physical size of the drawing and sets it
func (*Canvas) ResizeToContents ¶
func (cv *Canvas) ResizeToContents()
ResizeToContents resizes the drawing to just fit the current contents, including moving everything to start at upper-left corner, preserving the current grid offset, so grid snapping is preserved.
func (*Canvas) SaveDrawing ¶
SaveDrawing saves .svg drawing to current filename
func (*Canvas) SaveDrawingAs ¶
SaveDrawingAs saves .svg drawing to given filename
func (*Canvas) SelectFlipHorizontal ¶
func (cv *Canvas) SelectFlipHorizontal()
SelectFlipHorizontal flips the selection horizontally
func (*Canvas) SelectFlipVertical ¶
func (cv *Canvas) SelectFlipVertical()
SelectFlipVertical flips the selection vertically
func (*Canvas) SelectLower ¶
func (cv *Canvas) SelectLower()
SelectLower lowers the selection by one level in the layer
func (*Canvas) SelectLowerBottom ¶
func (cv *Canvas) SelectLowerBottom()
SelectLowerBottom lowers the selection to the bottom of the layer
func (*Canvas) SelectNodeInSVG ¶
func (cv *Canvas) SelectNodeInSVG(kn tree.Node, mode events.SelectModes)
SelectNodeInSVG selects given svg node in SVG drawing
func (*Canvas) SelectNodeInTree ¶
func (cv *Canvas) SelectNodeInTree(nd tree.Node, mode events.SelectModes)
SelectNodeInTree selects given node in Tree
func (*Canvas) SelectRaise ¶
func (cv *Canvas) SelectRaise()
SelectRaise raises the selection by one level in the layer
func (*Canvas) SelectRaiseTop ¶
func (cv *Canvas) SelectRaiseTop()
SelectRaiseTop raises the selection to the top of the layer
func (*Canvas) SelectRotate ¶
func (*Canvas) SelectRotateLeft ¶
func (cv *Canvas) SelectRotateLeft()
SelectRotateLeft rotates the selection 90 degrees counter-clockwise
func (*Canvas) SelectRotateRight ¶
func (cv *Canvas) SelectRotateRight()
SelectRotateRight rotates the selection 90 degrees clockwise
func (*Canvas) SelectScale ¶
func (*Canvas) SelectSetHeight ¶
func (*Canvas) SelectSetWidth ¶
func (*Canvas) SelectSetXPos ¶
func (*Canvas) SelectSetYPos ¶
func (*Canvas) SelectUnGroup ¶
func (cv *Canvas) SelectUnGroup()
SelectUnGroup ungroups items from each other
func (*Canvas) SelectedAsTrees ¶
SelectedAsTrees returns the currently selected items from SVG as Tree nodes.
func (*Canvas) SetCurLayer ¶
SetCurLayer sets the current layer for creating items to given one
func (*Canvas) SetDashProperties ¶
SetDashNode sets the stroke-dasharray property of Node. multiplies dash values by the line width in dots.
func (*Canvas) SetFillColor ¶
SetFillColor sets the fill color for selected items, which can be done dynamically (for events.Input events, final = false, followed by a final events.Change event (final = true)
func (*Canvas) SetFillProperty ¶ added in v0.1.2
SetFillProperty sets given property only if fill.color is non-nil.
func (*Canvas) SetMarkerProperties ¶
func (cv *Canvas) SetMarkerProperties(start, mid, end string, sc, mc, ec MarkerColors)
SetMarkerProperties sets the marker properties
func (*Canvas) SetOpacity ¶ added in v0.1.2
SetOpacity sets the global opacity for selected items. which can be done dynamically (for events.Input events, final = false, followed by a final events.Change event (final = true)
func (*Canvas) SetPhysicalSize ¶ added in v0.1.2
func (cv *Canvas) SetPhysicalSize(sz *PhysicalSize)
SetPhysicalSize sets physical size of drawing
func (*Canvas) SetSVG ¶ added in v0.1.2
SetSVG sets the [Canvas.SVG]: SVG displays the SVG image and has methods for managing it.
func (*Canvas) SetStatus ¶
SetStatus updates the status bar text with the given message, along with other status info
func (*Canvas) SetStrokeColor ¶
SetStrokeColor sets the stroke color for selected items. which can be done dynamically (for events.Input events, final = false, followed by a final events.Change event (final = true)
func (*Canvas) SetStrokeProperty ¶ added in v0.1.2
SetStrokeProperty sets given property only if stroke.color is non-nil.
func (*Canvas) SetTextNode ¶
SetTextNode sets the text of given Text node
func (*Canvas) SetTextProperties ¶
SetTextProperties sets the text properties of selected Text nodes.
func (*Canvas) StatusText ¶
StatusText returns the status bar text widget
func (*Canvas) SyncLayers ¶
func (cv *Canvas) SyncLayers()
Synchronizes layer list with current SVG structure: use the tree editor to rearrange layers, and then hit this button to update the layer list here.
func (*Canvas) SyncLayersFromSVG ¶ added in v0.1.2
func (cv *Canvas) SyncLayersFromSVG()
func (*Canvas) UpdateGradients ¶
func (cv *Canvas) UpdateGradients()
UpdateGradients updates gradients from EditState
func (*Canvas) UpdateLayers ¶ added in v0.1.2
func (cv *Canvas) UpdateLayers()
func (*Canvas) UpdateMarkerColors ¶
UpdateMarkerColors updates the marker colors, when setting fill or stroke
func (*Canvas) UpdateModalToolbar ¶ added in v0.1.2
func (cv *Canvas) UpdateModalToolbar()
UpdateSelectIsText updates the SelectIsText status
func (*Canvas) UpdateTabs ¶
func (cv *Canvas) UpdateTabs()
func (*Canvas) UpdateText ¶ added in v0.1.2
func (cv *Canvas) UpdateText()
func (*Canvas) UpdateTree ¶
func (cv *Canvas) UpdateTree()
type EditState ¶
type EditState struct {
// current tool in use
Tool Tools
// current action being performed, for undo labeling
Action Actions
// action data set at start of action
ActData string
// list of layers
Layers Layers
// current layer -- where new objects are inserted
CurLayer string
// current shared gradients, referenced by obj-specific gradients
Gradients []*Gradient
// current text styling info
Text TextStyle
// the undo manager
Undos undo.Stack
// contents have changed
Changed bool `display:"inactive"`
// action mutex, protecting start / end of actions
ActMu sync.Mutex `copier:"-" json:"-" xml:"-" display:"-"`
// selected item(s)
Selected map[svg.Node]*SelectedState `copier:"-" json:"-" xml:"-" display:"-"`
// selection just happened on press, and no drag happened in between
SelectNoDrag bool
// MouseDownSel is selected object from the mouse down event,
// which is carried over to the mouse up event to adjudicate between drag and select.
MouseDownSel svg.Node
// true if a new text item was made while dragging
NewTextMade bool
// point where dragging started
DragStartPos image.Point
// current dragging position
DragPos image.Point
// current dragging position, which is snapped if SnapNodes is on.
DragSnapPos math32.Vector2
// whether to constrain the current point if ctrl key is down.
ConstrainPoint bool
// current selection bounding box
SelectBBox math32.Box2
// number of current selectbox sprites
NSelectSprites int
// last select action position -- continued clicks in same area lead to deeper selection
LastSelectPos image.Point
// recently selected item(s) -- within the same selection position
RecentlySelected map[svg.Node]*SelectedState `copier:"-" json:"-" xml:"-" display:"-"`
// SelectIsText is true if the current selection is a single text item
SelectIsText bool
// bbox at start of dragging
DragStartBBox math32.Box2
// current bbox during dragging -- non-snapped version
DragBBox math32.Box2
// current effective bbox during dragging -- snapped version
DragSnapBBox math32.Box2
// potential points of alignment for dragging
AlignPoints [BBoxPointsN][]math32.Vector2
// number of current node sprites in use
NNodeSprites int
// currently manipulating path object
ActivePath *svg.Path
// current path node points
PathNodes []*PathNode
// original, pre-manipulation copy of current path node points
PathNodesOrig []*PathNode
// selected path nodes
NodeSelect map[int]struct{}
// current hover targets
NodeHover, CtrlHover int
CtrlHoverType Sprites
// Current control being dragged
CtrlDragIndex int
CtrlDrag Sprites
// Current position while drawing
DrawPos image.Point
// Current position while drawing, snapped
DrawSnapPos image.Point
// Starting position for drawing: first point in line
DrawStartPos image.Point
// the parent [Canvas]
Canvas *Canvas `copier:"-" json:"-" xml:"-" display:"-"`
}
EditState has all the current edit state information
func (*EditState) ActDone ¶
func (es *EditState) ActDone()
ActDone finishes an action, resetting action
func (*EditState) ActUnlock ¶
func (es *EditState) ActUnlock()
ActUnlock unlocks the action mutex -- after done doing all action starting steps
func (*EditState) ConfigDefaultGradient ¶
func (es *EditState) ConfigDefaultGradient()
ConfigDefaultGradient configures a new default gradient
func (*EditState) DragCtrlStart ¶ added in v0.1.2
DragCtrlStart captures the current state at start of control point dragging. position is starting position.
func (*EditState) DragNodeStart ¶
DragNodeStart captures the current state at start of node dragging. position is starting position.
func (*EditState) DragReset ¶
func (es *EditState) DragReset()
DragReset resets drag state information
func (*EditState) DragSelStart ¶
DragSelStart captures the current state at start of dragging manipulation with selected items. position is starting position.
func (*EditState) FirstSelected ¶ added in v0.1.2
FirstSelected returns the first selected node of any type.
func (*EditState) FirstSelectedNode ¶
FirstSelectedNode returns the first selected node, that is not a Group (recurses into groups)
func (*EditState) FirstSelectedPath ¶
FirstSelectedPath returns the first selected Path, that is not a Group (recurses into groups)
func (*EditState) HasNodeSelected ¶ added in v0.1.2
func (*EditState) HasSelected ¶
HasSelected returns true if there are selected items
func (*EditState) IsSelected ¶
IsSelected returns the selected status of given slice index
func (*EditState) NewRecents ¶
func (es *EditState) NewRecents()
func (*EditState) NewSelected ¶
func (es *EditState) NewSelected()
NewSelected makes a new Selected list
func (*EditState) NodeIsSelected ¶ added in v0.1.2
func (*EditState) NodeSelectAction ¶ added in v0.1.2
func (es *EditState) NodeSelectAction(idx int, mode events.SelectModes)
NodeSelectAction is called when a select action has been received (e.g., a mouse click) -- translates into selection updates -- gets selection mode from mouse event (ExtendContinuous, ExtendOne)
func (*EditState) NodeSelectedList ¶ added in v0.1.2
NodeSelectedList returns list of selected nodes in ascending index order.
func (*EditState) PosInLastSelect ¶
PosInLastSelect returns true if position is within tolerance of last selection point
func (*EditState) ResetSelected ¶
func (es *EditState) ResetSelected()
ResetSelected resets the selection list, including recents
func (*EditState) ResetSelectedNodes ¶ added in v0.1.2
func (es *EditState) ResetSelectedNodes()
func (*EditState) SanitizeSelected ¶
func (es *EditState) SanitizeSelected()
SanitizeSelected ensures that the current selected list makes sense. E.g., it prevents having a group and a child both in the selected list (removes the parent group).
func (*EditState) Select ¶
Select selects given item (if not already selected) -- updates select status of index text
func (*EditState) SelectAction ¶
SelectAction is called when a select action has been received (e.g., a mouse click) -- translates into selection updates -- gets selection mode from mouse event (ExtendContinuous, ExtendOne)
func (*EditState) SelectNode ¶ added in v0.1.2
func (*EditState) SelectedList ¶
SelectedList returns list of selected items, sorted either ascending or descending according to order of selection
func (*EditState) SelectedListDepth ¶
SelectedListDepth returns list of selected items, sorted either ascending or descending according to depth: ascending = deepest first, descending = highest first
func (*EditState) SelectedNames ¶
SelectedNames returns names of selected items, in order selected
func (*EditState) SelectedNamesString ¶
SelectedNamesString returns names of selected items as a space-separated single string. If over 256 chars long, then truncated.
func (*EditState) SelectedToRecents ¶
func (es *EditState) SelectedToRecents()
func (*EditState) StartRecents ¶
StartRecents starts a new list of recently selected items
func (*EditState) UnselectNode ¶ added in v0.1.2
func (*EditState) UpdateSelectBBox ¶
func (es *EditState) UpdateSelectBBox()
UpdateSelectBBox updates the current selection bbox surrounding all selected items
func (*EditState) UpdateSelectIsText ¶ added in v0.1.2
func (es *EditState) UpdateSelectIsText()
UpdateSelectIsText updates the SelectIsText state.
type Gradient ¶
type Gradient struct {
// Icon of gradient, auto generated to display each gradient.
Icon icons.Icon `edit:"-" table:"no-header" icon-width:"4"`
// ID is the name of gradient.
ID string `edit:"-" width:"6"`
// Name is the full name of gradient as SVG element.
Name string `display:"-"`
// Stops are the gradient stops.
Stops []gradient.Stop `new-window:"+"`
}
Gradient represents a single gradient that defines stops (referenced in StopName of other gradients).
func (*Gradient) ConfigDefaultStops ¶ added in v0.1.2
func (gr *Gradient) ConfigDefaultStops()
ConfigDefaultStops configures a new default gradient stops.
func (*Gradient) UpdateFromGrad ¶ added in v0.1.2
Updates our gradient from svg gradient
func (*Gradient) UpdateToGrad ¶ added in v0.1.2
UpdateToGrad updates svg gradient from our gradient.
type Layer ¶
Layer represents one layer group
type Layers ¶
type Layers []*Layer
Layers is the list of all layers
func (*Layers) LayerIndexByName ¶
func (*Layers) SyncLayersFromSVG ¶ added in v0.1.2
func (*Layers) SyncLayersToSVG ¶ added in v0.1.2
SyncLayersToSVG updates properties of layers based on our settings.
func (*Layers) UniqueNames ¶ added in v0.1.2
func (ly *Layers) UniqueNames()
UniqueNames ensures that our layers have unique names.
type MarkerColors ¶
type MarkerColors int32 //enums:enum -trim-prefix Marker
MarkerColors are the drawing tools
const ( // use the default color of marker (typically black) MarkerDef MarkerColors = iota // copy color of object using marker (create separate marker object per element) MarkerCopy // marker has its own separate custom color MarkerCust )
const MarkerColorsN MarkerColors = 3
MarkerColorsN is the highest valid value for type MarkerColors, plus one.
func MarkerColorsValues ¶
func MarkerColorsValues() []MarkerColors
MarkerColorsValues returns all possible values for the type MarkerColors.
func MarkerFromNodeProp ¶
MarkerFromNodeProp returns the marker name (canonicalized -- no id) and id and color type
func (MarkerColors) Desc ¶
func (i MarkerColors) Desc() string
Desc returns the description of the MarkerColors value.
func (MarkerColors) Int64 ¶
func (i MarkerColors) Int64() int64
Int64 returns the MarkerColors value as an int64.
func (MarkerColors) MarshalText ¶
func (i MarkerColors) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface.
func (*MarkerColors) SetInt64 ¶
func (i *MarkerColors) SetInt64(in int64)
SetInt64 sets the MarkerColors value from an int64.
func (*MarkerColors) SetString ¶
func (i *MarkerColors) SetString(s string) error
SetString sets the MarkerColors value from its string representation, and returns an error if the string is invalid.
func (MarkerColors) String ¶
func (i MarkerColors) String() string
String returns the string representation of this MarkerColors value.
func (*MarkerColors) UnmarshalText ¶
func (i *MarkerColors) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
func (MarkerColors) Values ¶
func (i MarkerColors) Values() []enums.Enum
Values returns all possible values for the type MarkerColors.
type PaintSetter ¶ added in v0.1.2
type PaintSetter struct {
core.Frame
// Active styles
PaintStyle styles.Paint
// paint type for stroke
StrokeType PaintTypes
// name of gradient with stops
StrokeStops string
// paint type for fill
FillType PaintTypes
// name of gradient with stops
FillStops string
// the parent [Canvas]
Canvas *Canvas `copier:"-" json:"-" xml:"-" display:"-"`
// contains filtered or unexported fields
}
PaintSetter provides setting of basic Stroke and Fill painting parameters for selected items
func NewPaintSetter ¶ added in v0.1.2
func NewPaintSetter(parent ...tree.Node) *PaintSetter
NewPaintSetter returns a new PaintSetter with the given optional parent: PaintSetter provides setting of basic Stroke and Fill painting parameters for selected items
func (*PaintSetter) FillProp ¶ added in v0.1.2
func (pv *PaintSetter) FillProp() string
FillProp returns the fill property string according to current settings
func (*PaintSetter) GetPaintType ¶ added in v0.1.2
func (pv *PaintSetter) GetPaintType(nd svg.Node, clr image.Image, prop string) (PaintTypes, string)
GetPaintType decodes the paint type from paint and properties also returns the name of the gradient if using one.
func (*PaintSetter) GradStopsName ¶ added in v0.1.2
func (pv *PaintSetter) GradStopsName(nd svg.Node, url string) string
GradStopsName returns the stopsname for gradient from url
func (*PaintSetter) Init ¶ added in v0.1.2
func (pv *PaintSetter) Init()
func (*PaintSetter) IsFillOn ¶ added in v0.1.2
func (pv *PaintSetter) IsFillOn() bool
IsFillOn returns true if Fill is active
func (*PaintSetter) IsStrokeOn ¶ added in v0.1.2
func (pv *PaintSetter) IsStrokeOn() bool
IsStrokeOn returns true if stroke is active
func (*PaintSetter) MarkerProperties ¶ added in v0.1.2
func (pv *PaintSetter) MarkerProperties() (start, mid, end string, sc, mc, ec MarkerColors)
MarkerProp returns the marker property string according to current settings along with color type to set.
func (*PaintSetter) PaintTypeStack ¶ added in v0.1.2
func (pv *PaintSetter) PaintTypeStack(pt PaintTypes) int
func (*PaintSetter) SelectFillGrad ¶ added in v0.1.2
func (pv *PaintSetter) SelectFillGrad()
func (*PaintSetter) SelectStrokeGrad ¶ added in v0.1.2
func (pv *PaintSetter) SelectStrokeGrad()
func (*PaintSetter) SetCanvas ¶ added in v0.1.2
func (t *PaintSetter) SetCanvas(v *Canvas) *PaintSetter
SetCanvas sets the [PaintSetter.Canvas]: the parent Canvas
func (*PaintSetter) SetColorNode ¶ added in v0.1.2
func (pv *PaintSetter) SetColorNode(nd svg.Node, prop string, prev, pt PaintTypes, sp string)
SetColorNode sets the color properties of Node based on previous and current PaintType
func (*PaintSetter) SetFill ¶ added in v0.1.2
func (pv *PaintSetter) SetFill(prev, pt PaintTypes, fp string)
SetFill sets the fill properties of selected items based on previous and current PaintType
func (*PaintSetter) SetFillOthers ¶ added in v0.1.2
func (pv *PaintSetter) SetFillOthers(nd svg.Node)
func (*PaintSetter) SetFillStack ¶ added in v0.1.2
func (pv *PaintSetter) SetFillStack(pt PaintTypes)
func (*PaintSetter) SetFillStops ¶ added in v0.1.2
func (t *PaintSetter) SetFillStops(v string) *PaintSetter
SetFillStops sets the [PaintSetter.FillStops]: name of gradient with stops
func (*PaintSetter) SetFillType ¶ added in v0.1.2
func (t *PaintSetter) SetFillType(v PaintTypes) *PaintSetter
SetFillType sets the [PaintSetter.FillType]: paint type for fill
func (*PaintSetter) SetPaintStyle ¶ added in v0.1.2
func (t *PaintSetter) SetPaintStyle(v styles.Paint) *PaintSetter
SetPaintStyle sets the [PaintSetter.PaintStyle]: Active styles
func (*PaintSetter) SetProperties ¶ added in v0.1.2
func (pv *PaintSetter) SetProperties(nd svg.Node)
SetProperties sets the properties for given node according to current settings
func (*PaintSetter) SetStroke ¶ added in v0.1.2
func (pv *PaintSetter) SetStroke(prev, pt PaintTypes, sp string)
SetStroke sets the stroke properties of selected items based on previous and current PaintType
func (*PaintSetter) SetStrokeOpacity ¶ added in v0.1.2
func (pv *PaintSetter) SetStrokeOpacity(nd svg.Node)
SetStrokeOpacity sets stroke opacity
func (*PaintSetter) SetStrokeOthers ¶ added in v0.1.2
func (pv *PaintSetter) SetStrokeOthers(nd svg.Node)
SetStrokeOthers sets opacity and stroke width properties
func (*PaintSetter) SetStrokeStack ¶ added in v0.1.2
func (pv *PaintSetter) SetStrokeStack(pt PaintTypes)
func (*PaintSetter) SetStrokeStops ¶ added in v0.1.2
func (t *PaintSetter) SetStrokeStops(v string) *PaintSetter
SetStrokeStops sets the [PaintSetter.StrokeStops]: name of gradient with stops
func (*PaintSetter) SetStrokeType ¶ added in v0.1.2
func (t *PaintSetter) SetStrokeType(v PaintTypes) *PaintSetter
SetStrokeType sets the [PaintSetter.StrokeType]: paint type for stroke
func (*PaintSetter) StrokeDashProp ¶ added in v0.1.2
func (pv *PaintSetter) StrokeDashProp() []float64
StrokeDashProp returns stroke-dasharray property as an array (nil = none) these values need to be multiplied by line widths for each item.
func (*PaintSetter) StrokeProp ¶ added in v0.1.2
func (pv *PaintSetter) StrokeProp() string
StrokeProp returns the stroke property string according to current settings
func (*PaintSetter) UpdateFillOpacity ¶ added in v0.1.2
func (pv *PaintSetter) UpdateFillOpacity()
func (*PaintSetter) UpdateFromNode ¶ added in v0.1.2
func (pv *PaintSetter) UpdateFromNode(ps *styles.Paint, nd svg.Node)
UpdateFromNode updates the current settings based on the values in the given Paint Style and properties from node (node can be nil)
func (*PaintSetter) UpdateStrokeOpacity ¶ added in v0.1.2
func (pv *PaintSetter) UpdateStrokeOpacity()
type PaintTypes ¶
type PaintTypes int32 //enums:enum -trim-prefix Paint
const ( PaintOff PaintTypes = iota PaintSolid PaintLinear PaintRadial PaintInherit )
const PaintTypesN PaintTypes = 5
PaintTypesN is the highest valid value for type PaintTypes, plus one.
func PaintTypesValues ¶
func PaintTypesValues() []PaintTypes
PaintTypesValues returns all possible values for the type PaintTypes.
func (PaintTypes) Desc ¶
func (i PaintTypes) Desc() string
Desc returns the description of the PaintTypes value.
func (PaintTypes) Int64 ¶
func (i PaintTypes) Int64() int64
Int64 returns the PaintTypes value as an int64.
func (PaintTypes) MarshalText ¶
func (i PaintTypes) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface.
func (*PaintTypes) SetInt64 ¶
func (i *PaintTypes) SetInt64(in int64)
SetInt64 sets the PaintTypes value from an int64.
func (*PaintTypes) SetString ¶
func (i *PaintTypes) SetString(s string) error
SetString sets the PaintTypes value from its string representation, and returns an error if the string is invalid.
func (PaintTypes) String ¶
func (i PaintTypes) String() string
String returns the string representation of this PaintTypes value.
func (*PaintTypes) UnmarshalText ¶
func (i *PaintTypes) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
func (PaintTypes) Values ¶
func (i PaintTypes) Values() []enums.Enum
Values returns all possible values for the type PaintTypes.
type PathNode ¶
type PathNode struct {
// path command using sprite encoding
Cmd Sprites
// CmdPath command using ppath float32 encoding
CmdPath float32
// index of start of command in path
Index int
// logical index of point within current command (0 = first point, etc)
PtIndex int
// original data points:
Start, End, Cp1, Cp2 math32.Vector2
// transformed to scene coordinates:
TStart, TEnd, TCp1, TCp2 math32.Vector2
}
PathNode is info about each node in a path that is being edited
type PhysicalSize ¶ added in v0.1.2
type PhysicalSize struct {
// select a standard size -- this will set units and size
StandardSize StandardSizes `default:"Img1280x720"`
// for standard size, use first number as width, second as height
Portrait bool `default:"false"`
// default units to use, e.g., in line widths etc
Units units.Units `default:"px"`
// drawing size, in Units
Size math32.Vector2
// grid spacing, in units of ViewBox size
Grid float32 `default:"32"`
}
PhysicalSize specifies the physical size of the drawing, when making a new one
func (*PhysicalSize) Defaults ¶ added in v0.1.2
func (ps *PhysicalSize) Defaults()
func (*PhysicalSize) SetFromSVG ¶ added in v0.1.2
func (ps *PhysicalSize) SetFromSVG(sv *SVG)
SetFromSVG sets from svg
func (*PhysicalSize) SetStandardSize ¶ added in v0.1.2
func (ps *PhysicalSize) SetStandardSize(std StandardSizes) error
SetStandardSize sets drawing to a standard size
func (*PhysicalSize) SetToSVG ¶ added in v0.1.2
func (ps *PhysicalSize) SetToSVG(sv *SVG)
SetToSVG sets svg from us
func (*PhysicalSize) SetToStandardSize ¶ added in v0.1.2
func (ps *PhysicalSize) SetToStandardSize() error
SetToStandardSize sets drawing to the current standard size value
func (*PhysicalSize) Update ¶ added in v0.1.2
func (ps *PhysicalSize) Update()
type SVG ¶
type SVG struct {
core.Frame
// SVG is the SVG drawing to display in this widget
SVG *svg.SVG `set:"-"`
// the parent [Canvas]
Canvas *Canvas `copier:"-" json:"-" xml:"-" display:"-" set:"-"`
// Grid spacing, in native ViewBox units.
Grid float32 ` set:"-"`
// GridPixels is the current pixel (dot) grid spacing, with scaling.
// Will be a multiple of underlying Grid if < SnapZone.
GridPixels math32.Vector2 `edit:"-" set:"-"`
// GridOffset is the current pixel offset in mouse coordinates.
GridOffset math32.Vector2 `edit:"-" set:"-"`
}
SVG is the element for viewing and interacting with the SVG.
func NewSVG ¶
NewSVG returns a new SVG with the given optional parent: SVG is the element for viewing and interacting with the SVG.
func (*SVG) Align ¶ added in v0.1.2
func (sv *SVG) Align(aa AlignAnchors, al Aligns)
func (*SVG) AlignCenter ¶ added in v0.1.2
func (sv *SVG) AlignCenter(aa AlignAnchors, dim math32.Dims, act string)
func (*SVG) AlignMax ¶ added in v0.1.2
func (sv *SVG) AlignMax(aa AlignAnchors, dim math32.Dims, act string)
func (*SVG) AlignMaxAnchor ¶ added in v0.1.2
func (sv *SVG) AlignMaxAnchor(aa AlignAnchors, dim math32.Dims, act string)
func (*SVG) AlignMin ¶ added in v0.1.2
func (sv *SVG) AlignMin(aa AlignAnchors, dim math32.Dims, act string)
AlignMin aligns to min coordinate (Left, Top) in bbox
func (*SVG) AlignMinAnchor ¶ added in v0.1.2
func (sv *SVG) AlignMinAnchor(aa AlignAnchors, dim math32.Dims, act string)
func (*SVG) CleanupInkscapeText ¶ added in v0.1.2
func (sv *SVG) CleanupInkscapeText()
CleanupInkscapeText fixes the inkscape text properties which are excessive and bad.
func (*SVG) ConstrainPoint ¶
ConstrainPoint constrains movement of point relative to starting point to either X, Y or diagonal. returns constrained point, and whether the constraint is along the diagonal, which can then trigger reshaping the object to be along the diagonal as well. also adds constraint to AlignMatches.
func (*SVG) DepthMap ¶
DepthMap returns a map of all nodes and their associated depth count counting up from 0 as the deepest, first drawn node.
func (*SVG) DistributeProps ¶ added in v0.1.2
func (sv *SVG) DistributeProps()
DistributeProps distributes properties into leaf nodes from groups. Putting properties on groups is not good for editing.
func (*SVG) DrawAlignMatch ¶ added in v0.1.2
DrawAlignMatch renders an alignment line
func (*SVG) DrawLineAdd ¶ added in v0.1.2
DrawLineAdd where new line would go.
func (*SVG) DrawPoint ¶ added in v0.1.2
DrawPoint updates the DrawPos and DrawSnapPos from event position. Returns the DrawSnapPos, which is the point to use for drawing.
func (*SVG) DrawRubberBand ¶ added in v0.1.2
DrawRubberBand renders the rubber-band box.
func (*SVG) DrawSpriteNodeCtrl ¶ added in v0.1.2
func (sv *SVG) DrawSpriteNodeCtrl(es *EditState, sp *core.Sprite, subtyp Sprites, idx int, nodepos image.Point) func(pc *paint.Painter)
DrawSpriteNodeCtrl renders a NodeControl sprite handle
func (*SVG) DrawSpriteNodePoint ¶ added in v0.1.2
func (sv *SVG) DrawSpriteNodePoint(es *EditState, sp *core.Sprite, bbtyp Sprites, idx int) func(pc *paint.Painter)
DrawSpriteNodePoint renders a NodePoint sprite handle
func (*SVG) DrawSpriteReshape ¶ added in v0.1.2
DrawSpriteReshape returns sprite Draw function for reshape points
func (*SVG) DrawSpriteSelect ¶ added in v0.1.2
DrawSpriteSelect renders a Select sprite handle -- smaller
func (*SVG) GatherAlignPoints ¶
func (sv *SVG) GatherAlignPoints()
GatherAlignPoints gets all the potential points of alignment for objects not in selection group
func (*SVG) Gradients ¶
Gradients returns the currently defined gradients with stops that are shared among obj-specific ones
func (*SVG) HandleSpriteSize ¶ added in v0.1.2
func (sv *SVG) HandleSpriteSize(scale float32, pos image.Point) (bb image.Rectangle, rdraw math32.Box2)
HandleSpriteSize returns the bounding box and rect draw coords for handle-type sprites.
func (*SVG) InactivateAlignSprites ¶ added in v0.1.2
func (sv *SVG) InactivateAlignSprites()
InactivateAlignSprites inactivates align sprites, doing lock, unlock
func (*SVG) InactivateSprites ¶ added in v0.1.2
InactivateSprites inactivates sprites of given type; must be locked.
func (*SVG) ManipDone ¶
func (sv *SVG) ManipDone()
ManipDone happens when a manipulation has finished: resets action, does render
func (*SVG) ManipStart ¶
ManipStart is called at the start of a manipulation, saving the state prior to the action
func (*SVG) ManipStartInDrag ¶ added in v0.1.2
ManipStartInDrag is called at the start of a dragging action to ensure that the action has started if it hasn't already, and to reset the align sprites. sprites must already be locked.
func (*SVG) MetaData ¶
MetaData returns the overall metadata and grid if present. if mknew is true, it will create new ones if not found.
func (*SVG) NewParent ¶ added in v0.1.2
NewParent returns a parent for creating a new SVG element. It uses the current selected group in SVG, or node selected in tree if useTree is true, or active layer if it is set. If nothing else, it returns the SVG Root node.
func (*SVG) NodeAppend ¶ added in v0.1.2
func (*SVG) NodeDelete ¶ added in v0.1.2
NodeDelete deletes node from active path at given index. if doing multiple deletes in a loop, go in reverse.
func (*SVG) NodeDeleteLast ¶ added in v0.1.2
func (sv *SVG) NodeDeleteLast()
NodeDeleteLast deletes the last node from ActivePath if n > 1.
func (*SVG) NodeInsert ¶ added in v0.1.2
func (*SVG) NodeReplace ¶ added in v0.1.2
func (*SVG) OpenFileCleanup ¶ added in v0.1.2
func (sv *SVG) OpenFileCleanup()
OpenFileCleanup cleans up various aspects of SVG files for editing.
func (*SVG) PathCtrlMove ¶ added in v0.1.2
PathCtrlMove moves given node control point index by given delta transform. returns scene position of given point.
func (*SVG) PathNodeMove ¶ added in v0.1.2
PathNodeMove moves given node index by given delta transform. pointOnly = true moves just the end point, otherwise all move.
func (*SVG) RemoveEmptyGroups ¶ added in v0.1.2
func (sv *SVG) RemoveEmptyGroups()
RemoveEmptyGroups removes groups that have no children.
func (*SVG) RemoveNodeSprites ¶
func (sv *SVG) RemoveNodeSprites()
func (*SVG) RemoveSelSprites ¶
func (sv *SVG) RemoveSelSprites()
func (*SVG) RenderGrid ¶ added in v0.1.2
func (sv *SVG) RenderGrid()
RenderGrid renders the background grid
func (*SVG) ResizeToContents ¶
ResizeToContents resizes the drawing to just fit the current contents, including moving everything to start at upper-left corner, optionally preserving the current grid sizing, so grid snapping is preserved, which is recommended.
func (*SVG) SelectContainsPoint ¶
SelectContainsPoint finds the first node that contains the given point in scene coordinates; nil if none. If leavesOnly is set then only nodes that have no nodes (leaves, terminal nodes) will be considered. If excludeSel, any leaf nodes that are within the current edit selection are excluded,
func (*SVG) SelectWithinBBox ¶
SelectWithinBBox returns a list of all nodes whose BBox is fully contained within the given BBox. SVG version excludes layer groups.
func (*SVG) SetBBoxSpritePos ¶
SetBBoxSpritePos sets positions of given type of sprites.
func (*SVG) SetRubberBand ¶
SetRubberBand updates the rubber band position.
func (*SVG) SetSVGName ¶
SetSVGName sets the name of the element to standard type + id name
func (*SVG) SetSpritePos ¶ added in v0.1.2
SetSpritePos sets sprite position, taking into account relative offsets
func (*SVG) ShowAlignMatches ¶
func (sv *SVG) ShowAlignMatches(pts []image.Rectangle, typs []BBoxPoints)
ShowAlignMatches draws the align matches as given between BBox Min - Max. typs are corresponding bounding box sources. sprites must already be locked.
func (*SVG) SnapBBox ¶
SnapBBox does snapping on given raw bbox according to settings, aligning movement of bbox edges / centers relative to other bboxes.. returns snapped bbox.
func (*SVG) SnapGridPoint ¶ added in v0.1.2
func (*SVG) SnapPoint ¶
SnapPoint does grid and align snapping on one raw point, given that point, in window coordinates. returns the snapped point.
func (*SVG) Sprite ¶ added in v0.1.2
func (sv *SVG) Sprite(typ, subtyp Sprites, idx int, trgsz image.Point, init func(sp *core.Sprite)) *core.Sprite
Sprite returns the given sprite in the context of the given widget, making it if not yet made. trgsz is the target size (e.g., for rubber band boxes). Init function is called on new sprites.
func (*SVG) SpriteCtrlDrag ¶ added in v0.1.2
SpriteCtrlDrag processes a mouse node drag event on a path control sprite
func (*SVG) SpriteNodeDrag ¶ added in v0.1.2
SpriteNodeDrag processes a mouse node drag event on a path node sprite
func (*SVG) SpriteReshapeDrag ¶
SpriteReshapeDrag processes a mouse reshape drag event on a selection sprite
func (*SVG) SpriteRotateDrag ¶
SpriteRotateDrag processes a mouse rotate drag event on a selection sprite
func (*SVG) SpritesLock ¶ added in v0.1.2
SpritesLock returns the core.Sprites under mutex lock.
func (*SVG) SpritesNoLock ¶ added in v0.1.2
SpritesNoLock returns the core.Sprites without locking.
func (*SVG) TransformAllLeaves ¶
func (sv *SVG) TransformAllLeaves(trans math32.Vector2, scale math32.Vector2, rot float32, pt math32.Vector2)
TransformAllLeaves transforms all the leaf items in the drawing (not groups) uses ApplyDeltaTransform manipulation.
func (*SVG) UndoSaveReplace ¶
UndoSaveReplace save current state to replace current
func (*SVG) UngroupSingletons ¶ added in v0.1.2
func (sv *SVG) UngroupSingletons()
UngroupSingletons moves leaf nodes that are all by self in a group out of the group.
func (*SVG) UpdateGradients ¶
UpdateGradients update SVG gradients from given gradient list.
func (*SVG) UpdateGridPixels ¶ added in v0.1.2
func (sv *SVG) UpdateGridPixels()
UpdateGridPixels updates the GirdEff value based on current scale
func (*SVG) UpdateLineAddSprite ¶ added in v0.1.2
func (sv *SVG) UpdateLineAddSprite()
func (*SVG) UpdateNodeSprites ¶
func (sv *SVG) UpdateNodeSprites()
func (*SVG) UpdateSelSprites ¶
func (sv *SVG) UpdateSelSprites()
func (*SVG) UpdateSelect ¶
func (sv *SVG) UpdateSelect()
UpdateSelect should be called whenever selection changes
type SelectedState ¶
type SelectedState struct {
// order item was selected
Order int
// Initial state of the node: copy of node struct.
InitState svg.Node
}
SelectedState is state for selected nodes
type SettingsData ¶
type SettingsData struct {
core.SettingsBase
// default physical size, when app is started without opening a file
Size PhysicalSize `display:"add-fields"`
// turns on the grid display
ShowGrid bool `default:"true"`
// snap to grid intervals.
SnapGrid bool `default:"true"`
// snap to align with other elements.
SnapAlign bool `default:"true"`
// snap individual path nodes using snap settings, while drawing and editing nodes.
SnapNodes bool `default:"true"`
// zone of attraction around a potential snapping point (grid, align) where
// snapping happens. Small values here allow a reasonable balance of snapping
// and non-snapping, while larger values produce more visible and strong snapping
// constraints.
SnapZone int `min:"1" default:"3"`
// enables saving of metadata about the image (in inkscape-compatible format)
MetaData bool
}
SettingsData is the overall Vector settings
func (*SettingsData) Defaults ¶
func (se *SettingsData) Defaults()
func (*SettingsData) Open ¶
func (se *SettingsData) Open() error
func (*SettingsData) Save ¶
func (se *SettingsData) Save() error
func (*SettingsData) Update ¶
func (se *SettingsData) Update()
type Sprites ¶
type Sprites int32 //enums:enum -transform kebab -trim-prefix Sp
Sprites are the type of sprite
const ( // SpNone is used for subtypes SpNone Sprites = iota // SpReshapeBBox is a reshape bbox -- the overall active selection BBox // for active manipulation SpReshapeBBox // SpSelBBox is a selection bounding box -- display only SpSelBBox // SpNodePoint is a main coordinate point for path node SpNodePoint // SpNodeCtrl is a control coordinate point for path node SpNodeCtrl // SpRubberBand is the draggable selection box SpRubberBand // SpAlignMatch is an alignment match (n of these), SpAlignMatch // SpLineAdd is preview of new line to add SpLineAdd // Sprite bounding boxes are set as a "bbox" property on sprites SpUpL SpUpC SpUpR SpDnL SpDnC SpDnR SpLfM SpRtM // Node points SpMoveTo SpLineTo SpCubeTo SpQuadTo SpArcTo SpClose SpStart SpEnd SpQuad1 SpCube1 SpCube2 )
const SpritesN Sprites = 27
SpritesN is the highest valid value for type Sprites, plus one.
func SpriteProperties ¶
SpriteProperties reads the sprite properties -- returns SpNone if not one of our sprites.
func SpritesValues ¶
func SpritesValues() []Sprites
SpritesValues returns all possible values for the type Sprites.
func (Sprites) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*Sprites) SetString ¶
SetString sets the Sprites value from its string representation, and returns an error if the string is invalid.
func (*Sprites) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type StandardSizeValues ¶
StandardSizeValues are values for standard sizes
type StandardSizes ¶
type StandardSizes int32 //enums:enum
StandardSizes are standard physical drawing sizes
const ( // CustomSize = nonstandard CustomSize StandardSizes = iota // Image 1280x720 Px = 720p Img1280x720 // Image 1920x1080 Px = 1080p HD Img1920x1080 // Image 3840x2160 Px = 4K Img3840x2160 // Image 7680x4320 Px = 8K Img7680x4320 // Image 1024x768 Px = XGA Img1024x768 // Image 720x480 Px = DVD Img720x480 // Image 640x480 Px = VGA Img640x480 // Image 320x240 Px = old CRT Img320x240 // A4 = 210 x 297 mm A4 // USLetter = 8.5 x 11 in = 612 x 792 pt USLetter // USLegal = 8.5 x 14 in = 612 x 1008 pt USLegal // A0 = 841 x 1189 mm A0 // A1 = 594 x 841 mm A1 // A2 = 420 x 594 mm A2 // A3 = 297 x 420 mm A3 // A5 = 148 x 210 mm A5 // A6 = 105 x 148 mm A6 // A7 = 74 x 105 A7 // A8 = 52 x 74 mm A8 // A9 = 37 x 52 A9 // A10 = 26 x 37 A10 )
const StandardSizesN StandardSizes = 22
StandardSizesN is the highest valid value for type StandardSizes, plus one.
func MatchStandardSize ¶
func MatchStandardSize(wd, ht float32, un units.Units) StandardSizes
func StandardSizesValues ¶
func StandardSizesValues() []StandardSizes
StandardSizesValues returns all possible values for the type StandardSizes.
func (StandardSizes) Desc ¶
func (i StandardSizes) Desc() string
Desc returns the description of the StandardSizes value.
func (StandardSizes) Int64 ¶
func (i StandardSizes) Int64() int64
Int64 returns the StandardSizes value as an int64.
func (StandardSizes) MarshalText ¶
func (i StandardSizes) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface.
func (*StandardSizes) SetInt64 ¶
func (i *StandardSizes) SetInt64(in int64)
SetInt64 sets the StandardSizes value from an int64.
func (*StandardSizes) SetString ¶
func (i *StandardSizes) SetString(s string) error
SetString sets the StandardSizes value from its string representation, and returns an error if the string is invalid.
func (StandardSizes) String ¶
func (i StandardSizes) String() string
String returns the string representation of this StandardSizes value.
func (*StandardSizes) UnmarshalText ¶
func (i *StandardSizes) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
func (StandardSizes) Values ¶
func (i StandardSizes) Values() []enums.Enum
Values returns all possible values for the type StandardSizes.
type TextStyle ¶
type TextStyle struct {
// current text to edit
String string `label:"Text"`
// Color is the fill color to render the text in.
Color color.RGBA `new-window:"+"`
// Stroke is the stroke color to render the text in: this is typically
// not set for standard text rendering, but can be used to render an outline
// around the text glyphs.
Stroke color.RGBA `new-window:"+"`
// Opacity is the overall opacity multiplier on the text, between 0-1.
Opacity float32 `min:"0" max:"1", step:"0.1"`
// Font styling properties.
Font styles.Font `display:"add-fields"`
// Text styling properties.
Text styles.Text `display:"add-fields"`
// the parent [Canvas]
Canvas *Canvas `copier:"-" json:"-" xml:"-" display:"-"`
}
TextStyle is text styling info -- using Form to do text editor
func (*TextStyle) SetFromNode ¶
SetFromNode sets text style info from given svg.Text node
func (*TextStyle) SetTextProperties ¶ added in v0.1.2
func (ts *TextStyle) SetTextProperties()
SetTextProperties sets the text properties of selected Text nodes.
func (*TextStyle) TextProperties ¶
TextProperties returns non-default text properties to set
type Tools ¶
type Tools int //enums:enum
Tools are the drawing tools
const ToolsN Tools = 7
ToolsN is the highest valid value for type Tools, plus one.
func ToolsValues ¶
func ToolsValues() []Tools
ToolsValues returns all possible values for the type Tools.
func (Tools) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*Tools) SetString ¶
SetString sets the Tools value from its string representation, and returns an error if the string is invalid.
func (*Tools) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type Tree ¶
type Tree struct {
core.Tree
// the parent [Canvas]
Canvas *Canvas `copier:"-" json:"-" xml:"-" display:"-"`
}
Tree is a core.Tree that interacts properly with Canvas.
func NewTree ¶
NewTree returns a new Tree with the given optional parent: Tree is a core.Tree that interacts properly with Canvas.
func (*Tree) CanvasRoot ¶ added in v0.1.2
FileRoot returns the Root node as a Tree.
func (*Tree) LayerClearCurrent ¶
func (tv *Tree) LayerClearCurrent()
LayerClearCurrent clears this layer as the current layer if it was set as such.
func (*Tree) LayerIsCurrent ¶
LayerIsCurrent returns true if layer is the current active one for creating.
func (*Tree) LayerSetCurrent ¶
func (tv *Tree) LayerSetCurrent()
LayerSetCurrent sets this layer as the current layer name
func (*Tree) LayerToggleLock ¶
func (tv *Tree) LayerToggleLock()
LayerToggleLock toggles whether layer is locked or not
func (*Tree) LayerToggleVis ¶
func (tv *Tree) LayerToggleVis()
LayerToggleVis toggles visibility of the layer