grid

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2023 License: BSD-3-Clause Imports: 41 Imported by: 0

Documentation

Overview

Package grid provides the main code for the Grid SVG vector drawing program

Index

Constants

View Source
const (
	Version     = "v0.5.5"
	GitCommit   = "523ae34"          // the commit JUST BEFORE the release
	VersionDate = "2023-08-27 22:59" // UTC
)

Variables

View Source
var (
	HandleSpriteScale = float32(18)
	HandleSizeMin     = 4
	HandleBorderMin   = 2
)
View Source
var (
	LineSpriteScale = float32(8)
	LineSizeMin     = 3
	LineBorderMin   = 1
)
View Source
var ActionHelpMap = map[string]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> = constraint to axis with smallest delta",
}

ActionHelpMap contains a set of help strings for different actions which are the names given e.g., in the ActStart, SaveUndo etc.

View Source
var AlignViewProps = ki.Props{
	"EnumType:Flag":    gi.KiT_VpFlags,
	"background-color": &gi.Prefs.Colors.Background,
	"color":            &gi.Prefs.Colors.Font,
	"max-width":        -1,
	"max-height":       -1,
}
View Source
var AllDashIconNames []gi.IconName

AllDashIconNames contains all of the available dash names as IconNames -- for chooser.

View Source
var AllDashNames []string

AllDashNames contains all of the available dash names. it is initialized from StdDashNames.

View Source
var AllDashesMap map[string][]float64

AllDashesMap contains all of the available Dashes. it is initialized from StdDashesMap

View Source
var AllMarkerIconNames []gi.IconName

AllMarkerIconNames contains all of the available marker names as IconNames -- for chooser. All names have marker- prefix in addition to regular marker names.

View Source
var AllMarkerNames []string

AllMarkerNames contains all of the available marker names. it is initialized from StdMarkerNames.

View Source
var AllMarkersSVGMap map[string]*svg.Marker

AllMarkersSVGMap contains all of the available Markers as *svg.Marker elements that have been converted from the XML source.

View Source
var AllMarkersXMLMap map[string]string

AllMarkersXMLMap contains all of the available Markers as XML source. It is initialized from StdMarkersMap

View Source
var AvailSplitNames []string

AvailSplitNames are the names of the current AvailSplits -- used for some choosers

View Source
var AvailSplitsChanged = false

AvailSplitsChanged is used to update toolbars via following menu, toolbar props update methods -- not accurate if editing any other map but works for now..

View Source
var ColorPrefsProps = ki.Props{
	"ToolBar": ki.PropSlice{
		{"OpenJSON", ki.Props{
			"label": "Open...",
			"icon":  "file-open",
			"desc":  "open set of colors from a json-formatted file",
			"Args": ki.PropSlice{
				{"Color File Name", ki.Props{
					"ext": ".json",
				}},
			},
		}},
		{"SaveJSON", ki.Props{
			"label": "Save As...",
			"desc":  "Saves colors to JSON formatted file.",
			"icon":  "file-save",
			"Args": ki.PropSlice{
				{"Color File Name", ki.Props{
					"ext": ".json",
				}},
			},
		}},
		{"SetToPrefs", ki.Props{
			"desc": "Sets this color scheme as the current active color scheme in Prefs.",
			"icon": "reset",
		}},
	},
}

ColorPrefsProps defines the ToolBar

View Source
var DashIconsInited = false

DashIconsInited records whether the dashes have been initialized into Icons for use in selectors: see DashIconsInit()

View Source
var GridViewEditRecents = "<i>Edit Recents...</i>"

GridViewEditRecents defines a string that is added as an item to the recents menu

View Source
var GridViewProps = ki.Props{
	"EnumType:Flag":    gi.KiT_NodeFlags,
	"background-color": &gi.Prefs.Colors.Background,
	"color":            &gi.Prefs.Colors.Font,
	"max-width":        -1,
	"max-height":       -1,
	"#title": ki.Props{
		"max-width":        -1,
		"horizontal-align": gist.AlignCenter,
		"vertical-align":   gist.AlignTop,
	},
	"MainMenu": ki.PropSlice{
		{"AppMenu", ki.BlankProp{}},
		{"File", ki.PropSlice{
			{"OpenRecent", ki.Props{
				"submenu": &SavedPaths,
				"Args": ki.PropSlice{
					{"File Name", ki.Props{}},
				},
			}},
			{"OpenDrawing", ki.Props{
				"shortcut": gi.KeyFunMenuOpen,
				"label":    "Open SVG...",
				"desc":     "open an SVG drawing",
				"Args": ki.PropSlice{
					{"File Name", ki.Props{
						"ext": ".svg",
					}},
				},
			}},
			{"NewDrawing", ki.Props{
				"shortcut": gi.KeyFunMenuNew,
				"label":    "New",
				"desc":     "Create a new drawing of given physical size (size units are used for ViewBox).",
				"Args": ki.PropSlice{
					{"Physical Size", ki.Props{
						"default": Prefs.Size,
					}},
				},
			}},
			{"SaveDrawing", ki.Props{
				"shortcut": gi.KeyFunMenuSave,
				"label":    "Save Drawing",
			}},
			{"SaveDrawingAs", ki.Props{
				"shortcut": gi.KeyFunMenuSaveAs,
				"label":    "Save As...",
				"desc":     "Save drawing to given svg file name",
				"Args": ki.PropSlice{
					{"File Name", ki.Props{
						"ext": ".svg",
					}},
				},
			}},
			{"sep-file", ki.BlankProp{}},
			{"PromptPhysSize", ki.Props{
				"label": "Set Size",
				"desc":  "sets the physical size (size units are used for ViewBox)",
			}},
			{"ResizeToContents", ki.Props{
				"label": "Resize To Contents",
				"desc":  "resizes the drawing to fit the current contents, moving everything to upper-left corner while preserving grid alignment",
			}},
			{"sep-exp", ki.BlankProp{}},
			{"ExportPNG", ki.Props{
				"desc": "Export drawing as a PNG image file (uses cairosvg -- must install!) -- specify either width or height in pixels as non-zero, or both 0 to use physical size.  Renders full page -- do Resize To Contents to only render contents.",
				"Args": ki.PropSlice{
					{"Width", ki.Props{
						"default": 1280,
					}},
					{"Height", ki.Props{
						"default": 0,
					}},
				},
			}},
			{"ExportPDF", ki.Props{
				"desc": "Export drawing as a PDF file (uses cairosvg -- must install!), at given specified DPI (only relevant for rendered effects).  Renders full page -- do Resize To Contents to only render contents.",
				"Args": ki.PropSlice{
					{"DPI", ki.Props{
						"default": 300,
					}},
				},
			}},
			{"sep-imp", ki.BlankProp{}},
			{"AddImage", ki.Props{
				"label": "Add Image...",
				"desc":  "Add a new Image node with given image file for this image node, rescaling to given size -- use 0, 0 to use native image size.",
				"Args": ki.PropSlice{
					{"File Name", ki.Props{
						"default-field": "Filename",
						"ext":           ".png,.jpg,.jpeg",
					}},
					{"Width", ki.Props{}},
					{"Height", ki.Props{}},
				},
			}},
			{"sep-af", ki.BlankProp{}},
			{"Close Window", ki.BlankProp{}},
		}},
		{"Edit", ki.PropSlice{
			{"Duplicate", ki.Props{
				"keyfun": gi.KeyFunDuplicate,
			}},
			{"Copy", ki.Props{
				"keyfun": gi.KeyFunCopy,
			}},
			{"Cut", ki.Props{
				"keyfun": gi.KeyFunCut,
			}},
			{"Paste", ki.Props{
				"keyfun": gi.KeyFunPaste,
			}},
			{"sep-undo", ki.BlankProp{}},
			{"Undo", ki.Props{
				"keyfun": gi.KeyFunUndo,
			}},
			{"Redo", ki.Props{
				"keyfun": gi.KeyFunRedo,
			}},
		}},
		{"View", ki.PropSlice{
			{"Splits", ki.PropSlice{
				{"SplitsSetView", ki.Props{
					"label":   "Set View",
					"submenu": &AvailSplitNames,
					"Args": ki.PropSlice{
						{"Split Name", ki.Props{}},
					},
				}},
				{"SplitsSaveAs", ki.Props{
					"label": "Save As...",
					"desc":  "save current splitter values to a new named split configuration",
					"Args": ki.PropSlice{
						{"Name", ki.Props{
							"width": 60,
						}},
						{"Desc", ki.Props{
							"width": 60,
						}},
					},
				}},
				{"SplitsSave", ki.Props{
					"label":   "Save",
					"submenu": &AvailSplitNames,
					"Args": ki.PropSlice{
						{"Split Name", ki.Props{}},
					},
				}},
				{"SplitsEdit", ki.Props{
					"label": "Edit...",
				}},
			}},
		}},
		{"Window", "Windows"},
		{"Help", ki.PropSlice{
			{"HelpWiki", ki.Props{}},
		}},
	},
}
View Source
var GridViewResetRecents = "<i>Reset Recents</i>"

GridViewResetRecents defines a string that is added as an item to the recents menu

View Source
var KiT_AlignAnchors = kit.Enums.AddEnum(AlignAnchorsN, kit.NotBitFlag, nil)
View Source
var KiT_AlignView = kit.Types.AddType(&AlignView{}, AlignViewProps)
View Source
var KiT_BBoxPoints = kit.Enums.AddEnum(BBoxPointsN, kit.NotBitFlag, nil)
View Source
var KiT_ColorPrefs = kit.Types.AddType(&ColorPrefs{}, ColorPrefsProps)
View Source
var KiT_GridView = kit.Types.AddType(&GridView{}, GridViewProps)
View Source
var KiT_GridViewFlags = kit.Enums.AddEnumExt(gi.KiT_NodeFlags, GridViewFlagsN, kit.BitFlag, nil)
View Source
var KiT_MarkerColors = kit.Enums.AddEnum(MarkerColorsN, kit.NotBitFlag, nil)
View Source
var KiT_PaintTypes = kit.Enums.AddEnum(PaintTypesN, kit.NotBitFlag, nil)
View Source
var KiT_PaintView = kit.Types.AddType(&PaintView{}, PaintViewProps)
View Source
var KiT_PhysSize = kit.Types.AddType(&PhysSize{}, nil)
View Source
var KiT_Preferences = kit.Types.AddType(&Preferences{}, PreferencesProps)
View Source
var KiT_SVGView = kit.Types.AddType(&SVGView{}, SVGViewProps)
View Source
var KiT_SplitValueView = kit.Types.AddType(&SplitValueView{}, nil)
View Source
var KiT_Splits = kit.Types.AddType(&Splits{}, SplitsProps)
View Source
var KiT_Sprites = kit.Enums.AddEnum(SpritesN, kit.NotBitFlag, nil)
View Source
var KiT_StdSizes = kit.Enums.AddEnum(StdSizesN, kit.NotBitFlag, nil)
View Source
var KiT_Tools = kit.Enums.AddEnum(ToolsN, kit.NotBitFlag, nil)
View Source
var KiT_TreeView = kit.Types.AddType(&TreeView{}, nil)
View Source
var MarkerColorNames = []string{
	"Def",
	"Copy",
	"Cust",
}

MarkerColorNames are user-facing names for colors (todo: use icons instead)

View Source
var MarkerIconsInited = false

MarkerIconsInited records whether the dashes have been initialized into Icons for use in selectors: see MarkerIconsInit()

View Source
var PaintTypeNames = []string{"Off", "Solid", "Linear", "Radial", "Inherit"}
View Source
var PaintViewProps = ki.Props{
	"EnumType:Flag":    gi.KiT_VpFlags,
	"background-color": &gi.Prefs.Colors.Background,
	"color":            &gi.Prefs.Colors.Font,
	"max-width":        -1,
	"max-height":       -1,
}
View Source
var PreferencesProps = ki.Props{
	"MainMenu": ki.PropSlice{
		{"AppMenu", ki.BlankProp{}},
		{"File", ki.PropSlice{
			{"Open", ki.Props{
				"shortcut": "Command+O",
			}},
			{"Save", ki.Props{
				"shortcut": "Command+S",
				"updtfunc": giv.ActionUpdateFunc(func(pfi any, act *gi.Action) {
					pf := pfi.(*Preferences)
					act.SetActiveState(pf.Changed)
				}),
			}},
			{"sep-color", ki.BlankProp{}},
			{"LightMode", ki.Props{}},
			{"DarkMode", ki.Props{}},
			{"sep-close", ki.BlankProp{}},
			{"Close Window", ki.BlankProp{}},
		}},
		{"Edit", "Copy Cut Paste"},
		{"Window", "Windows"},
	},
	"ToolBar": ki.PropSlice{
		{"Save", ki.Props{
			"desc": "Saves current preferences to standard prefs.json file, which is auto-loaded at startup.",
			"icon": "file-save",
			"updtfunc": giv.ActionUpdateFunc(func(pfi any, act *gi.Action) {
				pf := pfi.(*Preferences)
				act.SetActiveStateUpdt(pf.Changed)
			}),
		}},
		{"sep-color", ki.BlankProp{}},
		{"LightMode", ki.Props{
			"desc": "Set color mode to Light mode as defined in ColorSchemes -- automatically does Save and UpdateAll ",
			"icon": "color",
		}},
		{"DarkMode", ki.Props{
			"desc": "Set color mode to Dark mode as defined in ColorSchemes -- automatically does Save and UpdateAll",
			"icon": "color",
		}},
		{"sep-misc", ki.BlankProp{}},
		{"VersionInfo", ki.Props{
			"desc":        "shows current Grid version information",
			"icon":        "info",
			"show-return": true,
		}},
		{"sep-key", ki.BlankProp{}},
		{"EditSplits", ki.Props{
			"icon": "file-binary",
			"desc": "opens the SplitsView editor of saved named splitter settings.  Current customized settings are saved and loaded with preferences automatically.",
		}},
	},
}

PreferencesProps define the ToolBar and MenuBar for StructView, e.g., giv.PrefsView

View Source
var Prefs = Preferences{}

Prefs are the overall Grid preferences

View Source
var PrefsFileName = "grid_prefs.json"

PrefsFileName is the name of the preferences file in GoGi prefs directory

View Source
var PrefsSplitsFileName = "splits_prefs.json"

PrefsSplitsFileName is the name of the preferences file in App prefs directory for saving / loading the default AvailSplits

View Source
var SVGViewProps = ki.Props{
	"EnumType:Flag":    svg.KiT_SVGFlags,
	"background-color": &Prefs.Colors.Background,
	"border-width":     units.NewDot(1),
}
View Source
var SavedPaths gi.FilePaths

SavedPaths is a slice of strings that are file paths

SavedPathsExtras are the reset and edit items we add to the recents menu

View Source
var SavedPathsFileName = "grid_saved_paths.json"

SavedPathsFileName is the name of the saved file paths file in GoGi prefs directory

View Source
var SplitsProps = ki.Props{
	"MainMenu": ki.PropSlice{
		{"AppMenu", ki.BlankProp{}},
		{"File", ki.PropSlice{
			{"OpenPrefs", ki.Props{}},
			{"SavePrefs", ki.Props{
				"shortcut": "Command+S",
				"updtfunc": giv.ActionUpdateFunc(func(spi any, act *gi.Action) {
					act.SetActiveState(AvailSplitsChanged && spi.(*Splits) == &AvailSplits)
				}),
			}},
			{"sep-file", ki.BlankProp{}},
			{"OpenJSON", ki.Props{
				"label":    "Open from file",
				"desc":     "You can save and open named splits to / from files to share, experiment, transfer, etc",
				"shortcut": "Command+O",
				"Args": ki.PropSlice{
					{"File Name", ki.Props{
						"ext": ".json",
					}},
				},
			}},
			{"SaveJSON", ki.Props{
				"label": "Save to file",
				"desc":  "You can save and open named splits to / from files to share, experiment, transfer, etc",
				"Args": ki.PropSlice{
					{"File Name", ki.Props{
						"ext": ".json",
					}},
				},
			}},
		}},
		{"Edit", "Copy Cut Paste Dupe"},
		{"Window", "Windows"},
	},
	"ToolBar": ki.PropSlice{
		{"SavePrefs", ki.Props{
			"desc": "saves Splits to App standard prefs directory, in file splits_prefs.json, which will be loaded automatically at startup)",
			"icon": "file-save",
			"updtfunc": giv.ActionUpdateFunc(func(spi any, act *gi.Action) {
				act.SetActiveState(AvailSplitsChanged && spi.(*Splits) == &AvailSplits)
			}),
		}},
		{"sep-file", ki.BlankProp{}},
		{"OpenJSON", ki.Props{
			"label": "Open from file",
			"icon":  "file-open",
			"desc":  "You can save and open named splits to / from files to share, experiment, transfer, etc",
			"Args": ki.PropSlice{
				{"File Name", ki.Props{
					"ext": ".json",
				}},
			},
		}},
		{"SaveJSON", ki.Props{
			"label": "Save to file",
			"icon":  "file-save",
			"desc":  "You can save and open named splits to / from files to share, experiment, transfer, etc",
			"Args": ki.PropSlice{
				{"File Name", ki.Props{
					"ext": ".json",
				}},
			},
		}},
	},
}

SplitsProps define the ToolBar and MenuBar for TableView of Splits

View Source
var SpriteNames = map[Sprites]string{
	SpBBoxUpL: "up-l",
	SpBBoxUpC: "up-c",
	SpBBoxUpR: "up-r",
	SpBBoxDnL: "dn-l",
	SpBBoxDnC: "dn-c",
	SpBBoxDnR: "dn-r",
	SpBBoxLfM: "lf-m",
	SpBBoxRtM: "rt-m",

	SpReshapeBBox: "reshape-bbox",

	SpSelBBox: "sel-bbox",

	SpNodePoint: "node-point",
	SpNodeCtrl:  "node-ctrl",

	SpRubberBand: "rubber-band",

	SpAlignMatch: "align-match",
}

SpriteNames are name strings to use for naming sprites

View Source
var StdDashNames = []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",
}

StdDashNames are standard dash patterns

View Source
var StdDashesMap = map[string][]float64{
	"dash-solid":     {},
	"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},
}

StdDashesMap are standard dash patterns

View Source
var StdMarkerNames = []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",
}

StdMarkerNames is an ordered list of marker names

View Source
var StdMarkersMap = 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: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>`,
	"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: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>`,

	"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>`,
}

StdMarkersMap is a map of the standard markers

View Source
var StdSizesMap = map[StdSizes]*StdSizeVals{
	Img1280x720:  &StdSizeVals{units.Px, 1280, 720},
	Img1920x1080: &StdSizeVals{units.Px, 1920, 1080},
	Img3840x2160: &StdSizeVals{units.Px, 3840, 2160},
	Img7680x4320: &StdSizeVals{units.Px, 7680, 4320},
	Img1024x768:  &StdSizeVals{units.Px, 1024, 768},
	Img720x480:   &StdSizeVals{units.Px, 720, 480},
	Img640x480:   &StdSizeVals{units.Px, 640, 480},
	Img320x240:   &StdSizeVals{units.Px, 320, 240},
	A4:           &StdSizeVals{units.Mm, 210, 297},
	USLetter:     &StdSizeVals{units.Pt, 612, 792},
	USLegal:      &StdSizeVals{units.Pt, 612, 1008},
	A0:           &StdSizeVals{units.Mm, 841, 1189},
	A1:           &StdSizeVals{units.Mm, 594, 841},
	A2:           &StdSizeVals{units.Mm, 420, 594},
	A3:           &StdSizeVals{units.Mm, 297, 420},
	A5:           &StdSizeVals{units.Mm, 148, 210},
	A6:           &StdSizeVals{units.Mm, 105, 148},
	A7:           &StdSizeVals{units.Mm, 74, 105},
	A8:           &StdSizeVals{units.Mm, 52, 74},
	A9:           &StdSizeVals{units.Mm, 37, 52},
	A10:          &StdSizeVals{units.Mm, 26, 37},
}

StdSizesMap is the map of size values for each standard size

View Source
var StdSplits = Splits{
	{"Std", "standard splits with all visible", []float32{.1, .65, .25}},
	{"HideTree", "tree panel not visible", []float32{.0, .70, .30}},
	{"BigTabs", "bigger tabs", []float32{.1, .55, .35}},
}

StdSplits is the original compiled-in set of standard named splits.

View Source
var TreeViewIsLayerFunc = giv.ActionUpdateFunc(func(fni any, act *gi.Action) {
	tv := fni.(ki.Ki).Embed(KiT_TreeView).(*TreeView)
	sn := tv.SrcNode
	if sn != nil {
		act.SetInactiveState(!NodeIsLayer(sn))
	}
})

TreeViewIsLayerFunc is an ActionUpdateFunc that activates if node is a Layer

View Source
var TreeViewProps = ki.Props{
	"EnumType:Flag":    giv.KiT_TreeViewFlags,
	"indent":           units.NewCh(2),
	"spacing":          units.NewCh(.5),
	"border-width":     units.NewPx(0),
	"border-radius":    units.NewPx(0),
	"padding":          units.NewPx(0),
	"margin":           units.NewPx(1),
	"text-align":       gist.AlignLeft,
	"vertical-align":   gist.AlignTop,
	"color":            &gi.Prefs.Colors.Font,
	"background-color": "inherit",
	"no-templates":     true,
	".svgnode": ki.Props{
		"font-weight": gist.WeightNormal,
		"font-style":  gist.FontNormal,
	},
	".layer": ki.Props{
		"font-weight": gist.WeightBold,
	},
	".invisible": ki.Props{
		"font-style": gist.FontItalic,
	},
	".locked": ki.Props{
		"color": "#ff4252",
	},
	"#icon": ki.Props{
		"width":   units.NewEm(1),
		"height":  units.NewEm(1),
		"margin":  units.NewPx(0),
		"padding": units.NewPx(0),
		"fill":    &gi.Prefs.Colors.Icon,
		"stroke":  &gi.Prefs.Colors.Font,
	},
	"#branch": ki.Props{
		"icon":             "wedge-down",
		"icon-off":         "wedge-right",
		"margin":           units.NewPx(0),
		"padding":          units.NewPx(0),
		"background-color": color.Transparent,
		"max-width":        units.NewEm(.8),
		"max-height":       units.NewEm(.8),
	},
	"#space": ki.Props{
		"width": units.NewEm(.5),
	},
	"#label": ki.Props{
		"margin":    units.NewPx(0),
		"padding":   units.NewPx(0),
		"min-width": units.NewCh(16),
	},
	"#menu": ki.Props{
		"indicator": "none",
	},
	giv.TreeViewSelectors[giv.TreeViewActive]: ki.Props{},
	giv.TreeViewSelectors[giv.TreeViewSel]: ki.Props{
		"background-color": &gi.Prefs.Colors.Select,
	},
	giv.TreeViewSelectors[giv.TreeViewFocus]: ki.Props{
		"background-color": &gi.Prefs.Colors.Control,
	},
	"CtxtMenuActive": ki.PropSlice{
		{"SrcEdit", ki.Props{
			"label": "Edit",
		}},
		{"SelectSVG", ki.Props{
			"label": "Select",
		}},
		{"sep-edit", ki.BlankProp{}},
		{"SrcDuplicate", ki.Props{
			"label":    "Duplicate",
			"shortcut": gi.KeyFunDuplicate,
		}},
		{"Copy", ki.Props{
			"shortcut": gi.KeyFunCopy,
			"Args": ki.PropSlice{
				{"reset", ki.Props{
					"value": true,
				}},
			},
		}},
		{"Cut", ki.Props{
			"shortcut": gi.KeyFunCut,
			"updtfunc": giv.ActionUpdateFunc(func(tvi any, act *gi.Action) {
				tv := tvi.(ki.Ki).Embed(KiT_TreeView).(*TreeView)
				act.SetInactiveState(tv.IsRootOrField(""))
			}),
		}},
		{"Paste", ki.Props{
			"shortcut": gi.KeyFunPaste,
		}},
		{"sep-layer", ki.BlankProp{}},
		{"LayerSetCurrent", ki.Props{
			"label":    "Layer: Set Current",
			"updtfunc": TreeViewIsLayerFunc,
		}},
		{"LayerToggleLock", ki.Props{
			"label":    "Layer: Toggle Lock",
			"updtfunc": TreeViewIsLayerFunc,
		}},
		{"LayerToggleVis", ki.Props{
			"label":    "Layer: Toggle Visible",
			"updtfunc": TreeViewIsLayerFunc,
		}},
		{"sep-open", ki.BlankProp{}},
		{"OpenAll", ki.Props{}},
		{"CloseAll", ki.Props{}},
	},
}

Functions

func AddNewDash

func AddNewDash(dary []float64) string

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 *mat32.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

func DashMatchArray(lwidth float64, dary []float64) (bool, string)

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

func DashMulWidth(lwidth float64, dary []float64) []float64

DashMulWidth returns the dash array multiplied by the line width -- what is actually set

func DashString

func DashString(dary []float64) string

DashString returns string of dash array values

func DefaultColorSchemes

func DefaultColorSchemes() map[string]*ColorPrefs

func DrawAlignMatchHoriz

func DrawAlignMatchHoriz(sp *gi.Sprite, trgsz image.Point)

DrawAlignMatchHoriz renders a horizontal alignment line

func DrawAlignMatchVert

func DrawAlignMatchVert(sp *gi.Sprite, trgsz image.Point)

DrawAlignMatchVert renders a vertical alignment line

func DrawRubberBandHoriz

func DrawRubberBandHoriz(sp *gi.Sprite, trgsz image.Point)

DrawRubberBandHoriz renders a horizontal rubber band line

func DrawRubberBandVert

func DrawRubberBandVert(sp *gi.Sprite, trgsz image.Point)

DrawRubberBandVert renders a vertical rubber band line

func DrawSpriteNodeCtrl

func DrawSpriteNodeCtrl(sp *gi.Sprite, subtyp Sprites)

DrawSpriteNodeCtrl renders a NodePoint sprite handle

func DrawSpriteNodePoint

func DrawSpriteNodePoint(sp *gi.Sprite, bbtyp Sprites)

DrawSpriteNodePoint renders a NodePoint sprite handle

func DrawSpriteReshape

func DrawSpriteReshape(sp *gi.Sprite, bbtyp Sprites)

DrawSpriteReshape renders a Reshape sprite handle

func DrawSpriteSel

func DrawSpriteSel(sp *gi.Sprite, bbtyp Sprites)

DrawSpriteSel renders a Select sprite handle -- smaller

func HandleSpriteSize

func HandleSpriteSize(scale float32) (int, image.Point)

HandleSpriteSize returns the border size and overall size of handle-type sprites, with given scaling factor

func IconToMarkerName

func IconToMarkerName(icnm any) string

IconToMarkerName converts a gi.IconName (as an interface{}) to a marker name suitable for use (removes marker- prefix)

func InactivateSprites

func InactivateSprites(win *gi.Window, typ Sprites)

InactivateSprites inactivates sprites of given type

func InitPrefs

func InitPrefs()

InitPrefs must be called at startup in mainrun()

func LayerIsLocked

func LayerIsLocked(kn ki.Ki) bool

LayerIsLocked returns true if layer is locked (insensitive = true)

func LayerIsVisible

func LayerIsVisible(kn ki.Ki) bool

LayerIsVisible returns true if layer is visible

func LineSpriteSize

func LineSpriteSize() (int, int)

LineSpriteSize returns the border size and overall size of line-type sprites

func MarkerDeleteCtxtColors

func MarkerDeleteCtxtColors(mk *svg.Marker)

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

func MarkerNameToIcon(nm string) gi.IconName

MarkerNameToIcon converts a marker name to a gi.IconName

func MarkerSetColors

func MarkerSetColors(mk *svg.Marker, fill, stroke string)

MarkerSetColors sets color properties in each element

func MarkerSetProp

func MarkerSetProp(sg *svg.SVG, sii svg.NodeSVG, prop, name string, mc MarkerColors)

MarkerSetProp sets marker property for given node to given marker name (canonical)

func MarkerUpdateColorProp

func MarkerUpdateColorProp(sg *svg.SVG, sii svg.NodeSVG, prop string)

MarkerUpdateColorProp updates marker color for given marker property

func NewMarker

func NewMarker(sg *svg.SVG, name string, id int) *svg.Marker

NewMarker makes a new marker of given name and id in given svg, copying from existing one in AllMarkersSVGMap.

func NewMarkerFromXML

func NewMarkerFromXML(name, xml string) *svg.Marker

NewMarkerFromXML makes a new marker from given XML source.

func NodeIsLayer

func NodeIsLayer(kn ki.Ki) bool

NodeIsLayer returns true if given node is a layer

func NodeIsMetaData

func NodeIsMetaData(kn ki.Ki) bool

NodeIsMetaData returns true if given node is a MetaData

func NodeParentLayer

func NodeParentLayer(kn ki.Ki) ki.Ki

NodeParentLayer returns the parent group that is a layer -- nil if none

func OpenPaths

func OpenPaths()

OpenPaths loads the active SavedPaths from prefs dir

func PrefsView

func PrefsView(pf *Preferences) *gi.Window

PrefsView opens a view of user preferences, returns structview and window

func ProportionalBBox added in v0.5.1

func ProportionalBBox(bb, orig mat32.Box2) mat32.Box2

func QuitReq

func QuitReq() bool

QuitReq is called when user tries to quit the app -- we go through all open main windows and look for grid windows and call their CloseWindowReq functions!

func RecycleMarker

func RecycleMarker(sg *svg.SVG, sii svg.NodeSVG, name string, id int, mc MarkerColors) *svg.Marker

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

func SavePaths()

SavePaths saves the active SavedPaths to prefs dir

func SetSpritePos

func SetSpritePos(sp *gi.Sprite, pos image.Point)

SetSpritePos sets sprite position, taking into account relative offsets

func SetSpriteProps

func SetSpriteProps(sp *gi.Sprite, typ, subtyp Sprites, idx int)

SetSpriteProps sets sprite properties

func SnapToIncr

func SnapToIncr(val, off, incr float32) (float32, bool)

SnapToIncr snaps value to given increment, first subtracting given offset. Tolerance is determined by preferences, which is in screen pixels. Returns true if snapped.

func SnapToPt

func SnapToPt(val, snap float32) (float32, bool)

SnapToPt snaps value to given potential snap point, in screen pixel units. Tolerance is determined by preferences. Returns true if snapped.

func SplitsView

func SplitsView(pt *Splits)

SplitsView opens a view of a commands table

func Sprite

func Sprite(win *gi.Window, typ, subtyp Sprites, idx int, trgsz image.Point) *gi.Sprite

Sprite returns given sprite -- renders to window if not yet made. trgsz is the target size (e.g., for rubber band boxes)

func SpriteConnectEvent

func SpriteConnectEvent(win *gi.Window, typ, subtyp Sprites, idx int, trgsz image.Point, recv ki.Ki, fun ki.RecvFunc) *gi.Sprite

SpriteConnectEvent activates and sets mouse event functions to given function

func SpriteName

func SpriteName(typ, subtyp Sprites, idx int) string

SpriteName returns the unique name of the sprite based on main type, subtype (e.g., bbox) if relevant, and index if relevant

func SquareBBox

func SquareBBox(bb mat32.Box2) mat32.Box2

func ToolDoesBasicSelect

func ToolDoesBasicSelect(tl Tools) bool

ToolDoesBasicSelect returns true if tool should do select for clicks

Types

type AlignAnchors

type AlignAnchors int

AlignAnchors are ways of anchoring alignment

const (
	AlignFirst AlignAnchors = iota
	AlignLast
	AlignDrawing
	AlignSelectBox
	AlignAnchorsN
)

func (*AlignAnchors) FromString

func (i *AlignAnchors) FromString(s string) error

func (AlignAnchors) MarshalJSON

func (ev AlignAnchors) MarshalJSON() ([]byte, error)

func (AlignAnchors) String

func (i AlignAnchors) String() string

func (*AlignAnchors) UnmarshalJSON

func (ev *AlignAnchors) UnmarshalJSON(b []byte) error

type AlignView

type AlignView struct {
	gi.Layout

	// [view: -] the parent gridview
	GridView *GridView `copy:"-" json:"-" xml:"-" view:"-" desc:"the parent gridview"`
}

AlignView provides a range of alignment actions on selected objects.

func (*AlignView) AlignAnchor

func (av *AlignView) AlignAnchor() AlignAnchors

AlignAnchor returns the align anchor currently selected

func (*AlignView) AlignAnchorComboBox

func (av *AlignView) AlignAnchorComboBox() *gi.ComboBox

AlignAnchorComboBox returns the combobox representing align anchor options

func (*AlignView) Config

func (av *AlignView) Config(gv *GridView)

type BBoxPoints

type BBoxPoints int

BBoxPoints are the different control points within a bounding box

const (
	BBLeft BBoxPoints = iota
	BBCenter
	BBRight
	BBTop
	BBMiddle
	BBBottom
	BBoxPointsN
)

func ReshapeBBoxPoints

func ReshapeBBoxPoints(reshape Sprites) (bbX, bbY BBoxPoints)

ReshapeBBoxPoints returns the X and Y BBoxPoints for given sprite Reshape control point.

func (BBoxPoints) Dim

func (ev BBoxPoints) Dim() mat32.Dims

Dim returns the relevant dimension for this point

func (*BBoxPoints) FromString

func (i *BBoxPoints) FromString(s string) error

func (BBoxPoints) MarshalJSON

func (ev BBoxPoints) MarshalJSON() ([]byte, error)

func (BBoxPoints) MoveDelta

func (ev BBoxPoints) MoveDelta(bb *mat32.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 mat32.Box2) mat32.Vec2

PointBox returns the relevant point for a given bounding box, where relevant dimension is from ValRect and other is midpoint -- for drawing lines. BBox is an image.Rectangle

func (BBoxPoints) PointRect

func (ev BBoxPoints) PointRect(bb image.Rectangle) mat32.Vec2

PointRect returns the relevant point for a given bounding box, where relevant dimension is from ValRect and other is midpoint -- for drawing lines. BBox is an image.Rectangle

func (BBoxPoints) SetValBox

func (ev BBoxPoints) SetValBox(bb *mat32.Box2, val float32)

SetValBox sets the relevant value for a given bounding box as a mat32.Box2

func (BBoxPoints) String

func (i BBoxPoints) String() string

func (*BBoxPoints) UnmarshalJSON

func (ev *BBoxPoints) UnmarshalJSON(b []byte) error

func (BBoxPoints) ValBox

func (ev BBoxPoints) ValBox(bb mat32.Box2) float32

ValBox returns the relevant value for a given bounding box as a mat32.Box2

func (BBoxPoints) ValRect

func (ev BBoxPoints) ValRect(bb image.Rectangle) float32

ValRect returns the relevant value for a given bounding box as an image.Rectangle

type ColorPrefs

type ColorPrefs struct {

	// drawing background color
	Background gist.Color `desc:"drawing background color"`

	// border color of the drawing
	Border gist.Color `desc:"border color of the drawing"`

	// grid line color
	Grid gist.Color `desc:"grid line color"`
}

ColorPrefs for

func (*ColorPrefs) DarkDefaults

func (pf *ColorPrefs) DarkDefaults()

func (*ColorPrefs) Defaults

func (pf *ColorPrefs) Defaults()

func (*ColorPrefs) OpenJSON

func (pf *ColorPrefs) OpenJSON(filename gi.FileName) error

OpenJSON opens colors from a JSON-formatted file.

func (*ColorPrefs) SaveJSON

func (pf *ColorPrefs) SaveJSON(filename gi.FileName) error

SaveJSON saves colors to a JSON-formatted file.

func (*ColorPrefs) SetToPrefs

func (pf *ColorPrefs) SetToPrefs()

SetToPrefs sets this color scheme as the current active setting in overall default prefs.

type EditState

type EditState struct {

	// current tool in use
	Tool Tools `desc:"current tool in use"`

	// current action being performed -- used for undo labeling
	Action string `desc:"current action being performed -- used for undo labeling"`

	// action data set at start of action
	ActData string `desc:"action data set at start of action"`

	// list of layers
	Layers Layers `desc:"list of layers"`

	// current layer -- where new objects are inserted
	CurLayer string `desc:"current layer -- where new objects are inserted"`

	// current shared gradients, referenced by obj-specific gradients
	Gradients []*Gradient `desc:"current shared gradients, referenced by obj-specific gradients"`

	// current text styling info
	Text TextStyle `desc:"current text styling info"`

	// undo manager
	UndoMgr undo.Mgr `desc:"undo manager"`

	// [view: inactive] contents have changed
	Changed bool `view:"inactive" desc:"contents have changed"`

	// [view: -] action mutex, protecting start / end of actions
	ActMu sync.Mutex `copy:"-" json:"-" xml:"-" view:"-" desc:"action mutex, protecting start / end of actions"`

	// [view: -] selected item(s)
	Selected map[svg.NodeSVG]*SelState `copy:"-" json:"-" xml:"-" view:"-" desc:"selected item(s)"`

	// selection just happened on press, and no drag happened in between
	SelNoDrag bool `desc:"selection just happened on press, and no drag happened in between"`

	// true if a new text item was made while dragging
	NewTextMade bool `desc:"true if a new text item was made while dragging"`

	// point where dragging started, mouse coords
	DragStartPos image.Point `desc:"point where dragging started, mouse coords"`

	// current dragging position, mouse coords
	DragCurPos image.Point `desc:"current dragging position, mouse coords"`

	// current selection bounding box
	SelBBox mat32.Box2 `desc:"current selection bounding box"`

	// number of current selectbox sprites
	NSelSprites int `desc:"number of current selectbox sprites"`

	// last select action position -- continued clicks in same area lead to deeper selection
	LastSelPos image.Point `desc:"last select action position -- continued clicks in same area lead to deeper selection"`

	// [view: -] recently selected item(s) -- within the same selection position
	RecentlySelected map[svg.NodeSVG]*SelState `copy:"-" json:"-" xml:"-" view:"-" desc:"recently selected item(s) -- within the same selection position"`

	// bbox at start of dragging
	DragSelStartBBox mat32.Box2 `desc:"bbox at start of dragging"`

	// current bbox during dragging -- non-snapped version
	DragSelCurBBox mat32.Box2 `desc:"current bbox during dragging -- non-snapped version"`

	// current effective bbox during dragging -- snapped version
	DragSelEffBBox mat32.Box2 `desc:"current effective bbox during dragging -- snapped version"`

	// potential points of alignment for dragging
	AlignPts [BBoxPointsN][]mat32.Vec2 `desc:"potential points of alignment for dragging"`

	// number of current node sprites in use
	NNodeSprites int `desc:"number of current node sprites in use"`

	// currently manipulating path object
	ActivePath *svg.Path `desc:"currently manipulating path object"`

	// current path node points
	PathNodes []*PathNode `desc:"current path node points"`

	// selected path nodes
	PathSel map[int]struct{} `desc:"selected path nodes"`

	// current path command indexes within PathNodes -- where the commands start
	PathCmds []int `desc:"current path command indexes within PathNodes -- where the commands start"`
}

EditState has all the current edit state information

func (*EditState) ActDone

func (es *EditState) ActDone()

ActDone finishes an action, resetting action to ""

func (*EditState) ActStart

func (es *EditState) ActStart(act, data string)

ActStart starts an action, locking the mutex so only one can start

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

func (es *EditState) DragNodeStart(pos image.Point)

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

func (es *EditState) DragSelStart(pos image.Point)

DragSelStart captures the current state at start of dragging manipulation with selected items. position is starting position.

func (*EditState) FirstSelectedNode

func (es *EditState) FirstSelectedNode() svg.NodeSVG

FirstSelectedNode returns the first selected node, that is not a Group (recurses into groups)

func (*EditState) FirstSelectedPath

func (es *EditState) FirstSelectedPath() *svg.Path

FirstSelectedPath returns the first selected Path, that is not a Group (recurses into groups)

func (*EditState) HasSelected

func (es *EditState) HasSelected() bool

HasSelected returns true if there are selected items

func (*EditState) InAction

func (es *EditState) InAction() bool

InAction reports whether we currently doing an action

func (*EditState) Init

func (es *EditState) Init()

Init initializes the edit state -- e.g. after opening a new file

func (*EditState) IsSelected

func (es *EditState) IsSelected(itm svg.NodeSVG) bool

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

func (es *EditState) PosInLastSel(pos image.Point) bool

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

func (es *EditState) Select(itm svg.NodeSVG)

Select selects given item (if not already selected) -- updates select status of index label

func (*EditState) SelectAction

func (es *EditState) SelectAction(itm svg.NodeSVG, mode mouse.SelectModes, pos image.Point)

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

func (es *EditState) SelectedList(descendingSort bool) []svg.NodeSVG

SelectedList returns list of selected items, sorted either ascending or descending according to order of selection

func (*EditState) SelectedListDepth added in v0.5.2

func (es *EditState) SelectedListDepth(sv *SVGView, descendingSort bool) []svg.NodeSVG

SelectedListDepth returns list of selected items, sorted either ascending or descending according to depth: ascending = deepest first, descending = highest first

func (*EditState) SelectedNames

func (es *EditState) SelectedNames() []string

SelectedNames returns names of selected items, in order selected

func (*EditState) SelectedNamesString

func (es *EditState) SelectedNamesString() string

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

func (es *EditState) StartRecents(pos image.Point)

StartRecents starts a new list of recently-selected items

func (*EditState) Unselect

func (es *EditState) Unselect(itm svg.NodeSVG)

Unselect unselects given idx (if selected)

func (*EditState) UpdateSelBBox

func (es *EditState) UpdateSelBBox()

UpdateSelBBox updates the current selection bbox surrounding all selected items

type GradStop

type GradStop struct {

	// color -- alpha is ignored -- set opacity separately
	Color gist.Color `desc:"color -- alpha is ignored -- set opacity separately"`

	// opacity determines how opaque color is - used instead of alpha in color
	Opacity float64 `desc:"opacity determines how opaque color is - used instead of alpha in color"`

	// offset position along the gradient vector: 0 = start, 1 = nominal end
	Offset float64 `desc:"offset position along the gradient vector: 0 = start, 1 = nominal end"`
}

GradStop represents a single gradient stop

type Gradient

type Gradient struct {

	// [tableview: no-header] icon of gradient -- generated to display each gradient
	Ic gi.IconName `inactive:"+" tableview:"no-header" width:"5" desc:"icon of gradient -- generated to display each gradient"`

	// name of gradient (id)
	Id string `inactive:"+" width:"6" desc:"name of gradient (id)"`

	// [view: -] full name of gradient as SVG element
	Name string `view:"-" desc:"full name of gradient as SVG element"`

	// gradient stops
	Stops []*GradStop `desc:"gradient stops"`
}

Gradient represents a single gradient that defines stops (referenced in StopName of other gradients)

func (*Gradient) ConfigDefaultGradientStops added in v0.5.2

func (gr *Gradient) ConfigDefaultGradientStops()

ConfigDefaultGradientStops configures a new default gradient stops

func (*Gradient) UpdateFromGrad

func (gr *Gradient) UpdateFromGrad(g *gi.Gradient)

Updates our gradient from svg gradient

func (*Gradient) UpdateGrad

func (gr *Gradient) UpdateGrad(g *gi.Gradient)

Updates svg gradient from our gradient

func (*Gradient) UpdateIcon added in v0.5.2

func (gr *Gradient) UpdateIcon()

UpdateIcon updates icon

type GridView

type GridView struct {
	gi.Frame

	// full path to current drawing filename
	Filename gi.FileName `ext:".svg" desc:"full path to current drawing filename"`

	// current edit state
	EditState EditState `desc:"current edit state"`
}

GridView is the Grid SVG vector drawing program: Go-rendered interactive drawing

func AddNewGridView

func AddNewGridView(parent ki.Ki, name string) *GridView

AddNewGridView adds a new editor to given parent node, with given name.

func NewDrawing added in v0.5.2

func NewDrawing(sz PhysSize) *GridView

NewDrawing opens a new drawing window

func NewGridWindow

func NewGridWindow(fnm string) (*gi.Window, *GridView)

NewGridWindow returns a new GridWindow loading given file if non-empty

func (*GridView) AddImage

func (gv *GridView) AddImage(fname gi.FileName, width, height float32) error

AddImage adds a new image node set to given image

func (*GridView) AddLayer added in v0.5.2

func (gv *GridView) AddLayer()

func (*GridView) AlignAnchorBBox

func (gv *GridView) AlignAnchorBBox(aa AlignAnchors) (image.Rectangle, svg.NodeSVG)

AlignAnchorBBox returns the bounding box for given type of align anchor and the anchor node if non-nil

func (*GridView) AlignCenter

func (gv *GridView) AlignCenter(aa AlignAnchors, dim mat32.Dims, act string)

func (*GridView) AlignMax

func (gv *GridView) AlignMax(aa AlignAnchors, dim mat32.Dims, act string)

func (*GridView) AlignMaxAnchor

func (gv *GridView) AlignMaxAnchor(aa AlignAnchors, dim mat32.Dims, act string)

func (*GridView) AlignMin

func (gv *GridView) AlignMin(aa AlignAnchors, dim mat32.Dims, act string)

AlignMin aligns to min coordinate (Left, Top) in bbox

func (*GridView) AlignMinAnchor

func (gv *GridView) AlignMinAnchor(aa AlignAnchors, dim mat32.Dims, act string)

func (*GridView) AutoSave

func (gv *GridView) AutoSave() error

AutoSave does the autosave -- safe to call in a separate goroutine

func (*GridView) AutoSaveCheck

func (gv *GridView) AutoSaveCheck() bool

AutoSaveCheck checks if an autosave file exists -- logic for dealing with it is left to larger app -- call this before opening a file

func (*GridView) AutoSaveDelete

func (gv *GridView) AutoSaveDelete()

AutoSaveDelete deletes any existing autosave file

func (*GridView) AutoSaveFilename

func (gv *GridView) AutoSaveFilename() string

AutoSaveFilename returns the autosave filename

func (*GridView) ChangeMade added in v0.5.1

func (gv *GridView) ChangeMade()

ChangeMade should be called after any change is completed on the drawing. Calls autosave.

func (*GridView) ClearCurLayer

func (gv *GridView) ClearCurLayer(lay string)

ClearCurLayer clears the current layer for creating items if it was set to the given layer name

func (*GridView) CloseWindowReq

func (gv *GridView) CloseWindowReq() bool

CloseWindowReq is called when user tries to close window -- we automatically save the project if it already exists (no harm), and prompt to save open files -- if this returns true, then it is OK to close -- otherwise not

func (*GridView) Config

func (gv *GridView) Config()

Config configures entire view -- only runs if no children yet

func (*GridView) ConfigMainToolbar

func (gv *GridView) ConfigMainToolbar()

func (*GridView) ConfigModalToolbar

func (gv *GridView) ConfigModalToolbar()

func (*GridView) ConfigNodeToolbar

func (gv *GridView) ConfigNodeToolbar()

ConfigNodeToolbar configures the node modal toolbar (default tooblar)

func (*GridView) ConfigSelectToolbar

func (gv *GridView) ConfigSelectToolbar()

ConfigSelectToolbar configures the selection modal toolbar (default tooblar)

func (*GridView) ConfigStatusBar

func (gv *GridView) ConfigStatusBar()

ConfigStatusBar configures statusbar with label

func (*GridView) ConfigTabs

func (gv *GridView) ConfigTabs()

func (*GridView) ConfigTextToolbar

func (gv *GridView) ConfigTextToolbar()

ConfigTextToolbar configures the text modal toolbar

func (*GridView) ConfigTools

func (gv *GridView) ConfigTools()

func (*GridView) ConnectEvents2D

func (gv *GridView) ConnectEvents2D()

func (*GridView) CopyFieldsFrom

func (g *GridView) CopyFieldsFrom(frm any)

func (*GridView) CopySelected

func (gv *GridView) CopySelected()

CopySelected copies selected items in SVG view, using TreeView methods

func (*GridView) CutSelected

func (gv *GridView) CutSelected()

CutSelected cuts selected items in SVG view, using TreeView methods

func (*GridView) DefaultGradient

func (gv *GridView) DefaultGradient() string

DefaultGradient returns the default gradient to use for setting stops

func (*GridView) Defaults

func (gv *GridView) Defaults()

func (*GridView) DeleteSelected

func (gv *GridView) DeleteSelected()

DeleteSelected deletes selected items in SVG view, using TreeView methods

func (*GridView) DuplicateSelected

func (gv *GridView) DuplicateSelected()

DuplicateSelected duplicates selected items in SVG view, using TreeView methods

func (*GridView) EditRecents

func (gv *GridView) EditRecents()

RecentsEdit opens a dialog editor for deleting from the recents project list

func (*GridView) ExportPDF

func (gv *GridView) ExportPDF(dpi float32) error

ExportPDF exports drawing to a PDF file (auto-names to same name with .pdf suffix). Calls inkscape -- 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 (*GridView) ExportPNG

func (gv *GridView) ExportPNG(width, height float32) error

ExportPNG exports drawing to a PNG image (auto-names to same name with .png suffix). Calls inkscape -- needs to be on the PATH. specify either width or height of resulting image, or nothing for physical size as set. Renders full current page -- do ResizeToContents to render just current contents.

func (*GridView) FirstLayerIndex added in v0.5.2

func (gv *GridView) FirstLayerIndex() int

FirstLayerIndex returns index of first layer group in svg

func (*GridView) HBox

func (gv *GridView) HBox() *gi.Layout

func (*GridView) HelpWiki

func (gv *GridView) HelpWiki()

HelpWiki opens wiki page for grid on github

func (*GridView) IsConfiged

func (gv *GridView) IsConfiged() bool

IsConfiged returns true if the view is fully configured

func (*GridView) IsCurLayer

func (gv *GridView) IsCurLayer(lay string) bool

IsCurLayer returns true if given layer is the current layer for creating items

func (*GridView) LayerTree added in v0.5.2

func (gv *GridView) LayerTree() *gi.Layout

func (*GridView) LayerView added in v0.5.2

func (gv *GridView) LayerView() *giv.TableView

func (*GridView) LayerViewSigs added in v0.5.2

func (gv *GridView) LayerViewSigs(lyv *giv.TableView)

func (*GridView) MainToolbar

func (gv *GridView) MainToolbar() *gi.ToolBar

func (*GridView) ManipAction

func (gv *GridView) ManipAction(act, data string, manip bool, fun func(sii svg.NodeSVG))

ManipAction manages all the updating etc associated with performing an action that includes an ongoing manipulation with a final non-manip update. runs given function to actually do the update.

func (*GridView) ManipActionFun

func (gv *GridView) ManipActionFun(sii svg.NodeSVG, fun func(itm svg.NodeSVG))

func (*GridView) ModalToolbarStack

func (gv *GridView) ModalToolbarStack() *gi.Layout

func (*GridView) NewDrawing

func (gv *GridView) NewDrawing(sz PhysSize) *GridView

NewDrawing opens a new drawing window

func (*GridView) NodeEnableFunc

func (gv *GridView) NodeEnableFunc(act *gi.Action)

NodeEnableFunc is an ActionUpdateFunc that inactivates action if no node selected

func (*GridView) NodeSetXPos

func (gv *GridView) NodeSetXPos(xp float32)

func (*GridView) NodeSetYPos

func (gv *GridView) NodeSetYPos(yp float32)

func (*GridView) NodeToolbar

func (gv *GridView) NodeToolbar() *gi.ToolBar

func (*GridView) OSFileEvent

func (gv *GridView) OSFileEvent()

func (*GridView) OpenDrawing

func (gv *GridView) OpenDrawing(fnm gi.FileName) error

OpenDrawing opens a new .svg drawing

func (*GridView) OpenDrawingFile

func (gv *GridView) OpenDrawingFile(fnm gi.FileName) error

OpenDrawingFile opens a new .svg drawing file -- just the basic opening

func (*GridView) OpenRecent

func (gv *GridView) OpenRecent(filename gi.FileName)

OpenRecent opens a recently-used file

func (*GridView) PaintView

func (gv *GridView) PaintView() *PaintView

func (*GridView) PasteAvailFunc

func (gv *GridView) PasteAvailFunc(act *gi.Action)

PasteAvailFunc is an ActionUpdateFunc that inactivates action if no paste avail

func (*GridView) PasteClip

func (gv *GridView) PasteClip()

PasteClip pastes clipboard, using cur layer etc

func (*GridView) PromptPhysSize

func (gv *GridView) PromptPhysSize()

PromptPhysSize prompts for physical size of drawing and sets it

func (*GridView) RecycleTab

func (gv *GridView) RecycleTab(label string, typ reflect.Type, sel bool) gi.Node2D

RecycleTab returns a tab with given name, first by looking for an existing one, and if not found, making a new one with widget of given type. If sel, then select it. returns widget for tab.

func (*GridView) Redo

func (gv *GridView) Redo() string

Redo redoes one step, returning name of action that was redone

func (*GridView) RedoAvailFunc

func (gv *GridView) RedoAvailFunc(act *gi.Action)

RedoAvailFunc is an ActionUpdateFunc that inactivates action if no more redos

func (*GridView) ResizeToContents

func (gv *GridView) 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 (*GridView) SVG

func (gv *GridView) SVG() *SVGView

func (*GridView) SaveDrawing

func (gv *GridView) SaveDrawing() error

SaveDrawing saves .svg drawing to current filename

func (*GridView) SaveDrawingAs

func (gv *GridView) SaveDrawingAs(fname gi.FileName) error

SaveDrawingAs saves .svg drawing to given filename

func (*GridView) SelFlipHoriz

func (gv *GridView) SelFlipHoriz()

func (*GridView) SelFlipVert

func (gv *GridView) SelFlipVert()

func (*GridView) SelGroup

func (gv *GridView) SelGroup()

func (*GridView) SelLower

func (gv *GridView) SelLower()

func (*GridView) SelLowerBot

func (gv *GridView) SelLowerBot()

func (*GridView) SelRaise

func (gv *GridView) SelRaise()

func (*GridView) SelRaiseTop

func (gv *GridView) SelRaiseTop()

func (*GridView) SelRotate

func (gv *GridView) SelRotate(deg float32)

func (*GridView) SelRotateLeft

func (gv *GridView) SelRotateLeft()

func (*GridView) SelRotateRight

func (gv *GridView) SelRotateRight()

func (*GridView) SelScale

func (gv *GridView) SelScale(scx, scy float32)

func (*GridView) SelSetHeight

func (gv *GridView) SelSetHeight(ht float32)

func (*GridView) SelSetWidth

func (gv *GridView) SelSetWidth(wd float32)

func (*GridView) SelSetXPos

func (gv *GridView) SelSetXPos(xp float32)

func (*GridView) SelSetYPos

func (gv *GridView) SelSetYPos(yp float32)

func (*GridView) SelUnGroup

func (gv *GridView) SelUnGroup()

func (*GridView) SelectNodeInSVG

func (gv *GridView) SelectNodeInSVG(kn ki.Ki, mode mouse.SelectModes)

SelectNodeInSVG selects given svg node in SVG drawing

func (*GridView) SelectNodeInTree

func (gv *GridView) SelectNodeInTree(kn ki.Ki, mode mouse.SelectModes)

SelectNodeInTree selects given node in TreeView

func (*GridView) SelectToolbar

func (gv *GridView) SelectToolbar() *gi.ToolBar

func (*GridView) SelectedAsTreeViews

func (gv *GridView) SelectedAsTreeViews() []*giv.TreeView

SelectedAsTreeViews returns the currently-selected items from SVG as TreeView nodes

func (*GridView) SelectedEnableFunc

func (gv *GridView) SelectedEnableFunc(act *gi.Action)

SelectedEnableFunc is an ActionUpdateFunc that inactivates action if no selected items

func (*GridView) SetColorNode

func (gv *GridView) SetColorNode(sii svg.NodeSVG, prop string, prev, pt PaintTypes, sp string)

SetColorNode sets the color properties of Node based on previous and current PaintType

func (*GridView) SetCurLayer

func (gv *GridView) SetCurLayer(lay string)

SetCurLayer sets the current layer for creating items to given one

func (*GridView) SetDashNode

func (gv *GridView) SetDashNode(sii svg.NodeSVG, dary []float64)

SetDashNode sets the stroke-dasharray property of Node. multiplies dash values by the line width in dots.

func (*GridView) SetDashProps

func (gv *GridView) SetDashProps(dary []float64)

SetDashProps sets the dash props

func (*GridView) SetDefaultStyle

func (gv *GridView) SetDefaultStyle()

func (*GridView) SetFill

func (gv *GridView) SetFill(prev, pt PaintTypes, fp string)

SetFill sets the fill props of selected items based on previous and current PaintType

func (*GridView) SetFillColor

func (gv *GridView) SetFillColor(fp string, manip bool)

SetFillColor sets the fill color for selected items manip means currently being manipulated -- don't save undo.

func (*GridView) SetMarkerNode

func (gv *GridView) SetMarkerNode(sii svg.NodeSVG, start, mid, end string, sc, mc, ec MarkerColors)

SetMarkerNode sets the marker properties of Node.

func (*GridView) SetMarkerProps

func (gv *GridView) SetMarkerProps(start, mid, end string, sc, mc, ec MarkerColors)

SetMarkerProps sets the marker props

func (*GridView) SetModalNode

func (gv *GridView) SetModalNode()

SetModalNode sets the modal toolbar to be the node editing one

func (*GridView) SetModalSelect

func (gv *GridView) SetModalSelect()

SetModalSelect sets the modal toolbar to be the select one

func (*GridView) SetModalText

func (gv *GridView) SetModalText()

SetModalText sets the modal toolbar to be the text editing one

func (*GridView) SetModalToolbar

func (gv *GridView) SetModalToolbar()

SetModalToolbar sets the current modal toolbar based on tool

func (*GridView) SetPhysSize

func (gv *GridView) SetPhysSize(sz *PhysSize)

SetPhysSize sets physical size of drawing

func (*GridView) SetStatus

func (gv *GridView) SetStatus(msg string)

SetStatus updates the statusbar label with given message, along with other status info

func (*GridView) SetStroke

func (gv *GridView) SetStroke(prev, pt PaintTypes, sp string)

SetStroke sets the stroke properties of selected items based on previous and current PaintType

func (*GridView) SetStrokeColor

func (gv *GridView) SetStrokeColor(sp string, manip bool)

SetStrokeColor sets the stroke color for selected items. manip means currently being manipulated -- don't save undo.

func (*GridView) SetStrokeWidth

func (gv *GridView) SetStrokeWidth(wp string, manip bool)

SetStrokeWidth sets the stroke width property for selected items manip means currently being manipulated -- don't save undo.

func (*GridView) SetStrokeWidthNode

func (gv *GridView) SetStrokeWidthNode(sii svg.NodeSVG, wp string)

SetStrokeWidthNode sets the stroke width of Node

func (*GridView) SetText

func (gv *GridView) SetText(txt string)

SetText sets the text of selected Text node

func (*GridView) SetTextNode

func (gv *GridView) SetTextNode(sii svg.NodeSVG, txt string) bool

SetTextNode sets the text of given Text node

func (*GridView) SetTextProps

func (gv *GridView) SetTextProps(tps map[string]string)

SetTextProps sets the text properties of selected Text nodes

func (*GridView) SetTextPropsNode

func (gv *GridView) SetTextPropsNode(sii svg.NodeSVG, tps map[string]string)

SetTextPropsNode sets the text properties of given Text node

func (*GridView) SetTitle

func (gv *GridView) SetTitle()

func (*GridView) SetTool

func (gv *GridView) SetTool(tl Tools)

SetTool sets the current active tool

func (*GridView) SplitView

func (gv *GridView) SplitView() *gi.SplitView

func (*GridView) SplitsEdit

func (gv *GridView) SplitsEdit()

SplitsEdit opens the SplitsView editor to customize saved splitter settings

func (*GridView) SplitsSave

func (gv *GridView) SplitsSave(split SplitName)

SplitsSave saves current splitter settings to named splitter settings under existing name, and saves to prefs file

func (*GridView) SplitsSaveAs

func (gv *GridView) SplitsSaveAs(name, desc string)

SplitsSaveAs saves current splitter settings to new named splitter settings, and saves to prefs file

func (*GridView) SplitsSetView

func (gv *GridView) SplitsSetView(split SplitName)

SplitsSetView sets split view splitters to given named setting

func (*GridView) StatusBar

func (gv *GridView) StatusBar() *gi.Frame

StatusBar returns the statusbar widget

func (*GridView) StatusLabel

func (gv *GridView) StatusLabel() *gi.Label

StatusLabel returns the statusbar label widget

func (*GridView) SyncLayers added in v0.5.2

func (gv *GridView) SyncLayers()

func (*GridView) Tab

func (gv *GridView) Tab(label string) gi.Node2D

Tab returns tab with given label

func (*GridView) Tabs

func (gv *GridView) Tabs() *gi.TabView

func (*GridView) TextToolbar

func (gv *GridView) TextToolbar() *gi.ToolBar

func (*GridView) Tools

func (gv *GridView) Tools() *gi.ToolBar

func (*GridView) TreeView

func (gv *GridView) TreeView() *TreeView

func (*GridView) Undo

func (gv *GridView) Undo() string

Undo undoes one step, returning name of action that was undone

func (*GridView) UndoAvailFunc

func (gv *GridView) UndoAvailFunc(act *gi.Action)

UndoAvailFunc is an ActionUpdateFunc that inactivates action if no more undos

func (*GridView) UpdateAll

func (gv *GridView) UpdateAll()

func (*GridView) UpdateDisp

func (gv *GridView) UpdateDisp()

func (*GridView) UpdateGradients

func (gv *GridView) UpdateGradients()

UpdateGradients updates gradients from EditState

func (*GridView) UpdateLayerView added in v0.5.2

func (gv *GridView) UpdateLayerView()

func (*GridView) UpdateMarkerColors

func (gv *GridView) UpdateMarkerColors(sii svg.NodeSVG)

UpdateMarkerColors updates the marker colors, when setting fill or stroke

func (*GridView) UpdateNodeToolbar

func (gv *GridView) UpdateNodeToolbar()

UpdateNodeToolbar updates the node toolbar based on current nodeion

func (*GridView) UpdateSelectToolbar

func (gv *GridView) UpdateSelectToolbar()

UpdateSelectToolbar updates the select toolbar based on current selection

func (*GridView) UpdateTabs

func (gv *GridView) UpdateTabs()

func (*GridView) UpdateTextToolbar

func (gv *GridView) UpdateTextToolbar()

UpdateTextToolbar updates the select toolbar based on current selection

func (*GridView) UpdateTreeView

func (gv *GridView) UpdateTreeView()

type GridViewFlags

type GridViewFlags int

GridViewFlags extend NodeBase NodeFlags to hold viewport state

const (
	// VpFlagPopup means viewport is a popup (menu or dialog) -- does not obey
	// parent bounds (otherwise does)
	GridViewAutoSaving GridViewFlags = GridViewFlags(gi.NodeFlagsN) + iota

	GridViewFlagsN
)

func StringToGridViewFlags

func StringToGridViewFlags(s string) (GridViewFlags, error)

func (GridViewFlags) String

func (i GridViewFlags) String() string

type Layer added in v0.5.2

type Layer struct {
	Name string

	// visiblity toggle
	Vis bool `desc:"visiblity toggle"`

	// lock toggle
	Lck bool `desc:"lock toggle"`
}

Layer represents one layer group

func (*Layer) FromNode added in v0.5.2

func (l *Layer) FromNode(k ki.Ki)

FromNode copies state / prop values from given node

func (*Layer) ToNode added in v0.5.2

func (l *Layer) ToNode(k ki.Ki)

ToNode copies state / prop values to given node

type Layers added in v0.5.2

type Layers []*Layer

Layers is the list of all layers

func (*Layers) LayerIdxByName added in v0.5.2

func (ly *Layers) LayerIdxByName(nm string) int

func (*Layers) LayersUpdated added in v0.5.2

func (ly *Layers) LayersUpdated(svg *SVGView)

func (*Layers) SyncLayers added in v0.5.2

func (ly *Layers) SyncLayers(sv *SVGView)

type MarkerColors

type MarkerColors int

MarkerColors are the drawing tools

const (
	// use the default color of marker (typically black)
	MarkerStdColor MarkerColors = iota

	// copy color of object using marker (create separate marker object per element)
	MarkerCopyColor

	// marker has its own separate custom color
	MarkerCustomColor

	MarkerColorsN
)

func MarkerFromNodeProp

func MarkerFromNodeProp(kn ki.Ki, prop string) (string, int, MarkerColors)

MarkerFromNodeProp returns the marker name (canonicalized -- no id) and id and color type

func (*MarkerColors) FromString

func (i *MarkerColors) FromString(s string) error

func (MarkerColors) MarshalJSON

func (ev MarkerColors) MarshalJSON() ([]byte, error)

func (MarkerColors) String

func (i MarkerColors) String() string

func (*MarkerColors) UnmarshalJSON

func (ev *MarkerColors) UnmarshalJSON(b []byte) error

type PaintTypes

type PaintTypes int
const (
	PaintOff PaintTypes = iota
	PaintSolid
	PaintLinear
	PaintRadial
	PaintInherit
	PaintTypesN
)

func (*PaintTypes) FromString

func (i *PaintTypes) FromString(s string) error

func (PaintTypes) MarshalJSON

func (ev PaintTypes) MarshalJSON() ([]byte, error)

func (PaintTypes) String

func (i PaintTypes) String() string

func (*PaintTypes) UnmarshalJSON

func (ev *PaintTypes) UnmarshalJSON(b []byte) error

type PaintView

type PaintView struct {
	gi.Layout

	// paint type for stroke
	StrokeType PaintTypes `desc:"paint type for stroke"`

	// name of gradient with stops
	StrokeStops string `desc:"name of gradient with stops"`

	// paint type for fill
	FillType PaintTypes `desc:"paint type for fill"`

	// name of gradient with stops
	FillStops string `desc:"name of gradient with stops"`

	// [view: -] the parent gridview
	GridView *GridView `copy:"-" json:"-" xml:"-" view:"-" desc:"the parent gridview"`
}

PaintView provides editing of basic Stroke and Fill painting parameters for selected items

func (*PaintView) Config

func (pv *PaintView) Config(gv *GridView)

func (*PaintView) DecodeType

func (pv *PaintView) DecodeType(kn ki.Ki, cs *gist.ColorSpec, prop string) (PaintTypes, string)

DecodeType decodes the paint type from paint and props also returns the name of the gradient if using one.

func (*PaintView) FillProp

func (pv *PaintView) FillProp() string

FillProp returns the fill property string according to current settings

func (*PaintView) FillStack added in v0.5.1

func (pv *PaintView) FillStack() *gi.Frame

FillStack returns the fill stack frame

func (*PaintView) GradStopsName

func (pv *PaintView) GradStopsName(gii gi.Node2D, url string) string

GradStopsName returns the stopsname for gradient from url

func (*PaintView) IsFillOn

func (pv *PaintView) IsFillOn() bool

IsFillOn returns true if Fill is active

func (*PaintView) IsStrokeOn

func (pv *PaintView) IsStrokeOn() bool

IsStrokeOn returns true if stroke is active

func (*PaintView) MarkerProps

func (pv *PaintView) MarkerProps() (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 (*PaintView) SelectFillGrad

func (pv *PaintView) SelectFillGrad()

func (*PaintView) SelectStrokeGrad

func (pv *PaintView) SelectStrokeGrad()

func (*PaintView) SetProps

func (pv *PaintView) SetProps(sii svg.NodeSVG)

SetProps sets the props for given node according to current settings

func (*PaintView) StrokeDashProp

func (pv *PaintView) 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 (*PaintView) StrokeProp

func (pv *PaintView) StrokeProp() string

StrokeProp returns the stroke property string according to current settings

func (*PaintView) StrokeStack added in v0.5.1

func (pv *PaintView) StrokeStack() *gi.Frame

StrokeStack returns the stroke stack frame

func (*PaintView) StrokeWidthProp

func (pv *PaintView) StrokeWidthProp() string

StrokeWidthProp returns stroke-width property

func (*PaintView) Update

func (pv *PaintView) Update(pc *girl.Paint, kn ki.Ki)

Update updates the current settings based on the values in the given Paint and props from node (node can be nil)

type PathNode

type PathNode struct {

	// path command
	Cmd svg.PathCmds `desc:"path command"`

	// previous path command
	PrevCmd svg.PathCmds `desc:"previous path command"`

	// starting index of command
	CmdIdx int `desc:"starting index of command"`

	// index of points in data stream
	Idx int `desc:"index of points in data stream"`

	// logical index of point within current command (0 = first point, etc)
	PtIdx int `desc:"logical index of point within current command (0 = first point, etc)"`

	// local coords abs previous current point that is starting point for this command
	PCp mat32.Vec2 `desc:"local coords abs previous current point that is starting point for this command"`

	// local coords abs current point
	Cp mat32.Vec2 `desc:"local coords abs current point"`

	// main point coords in window (dot) coords
	WinPt mat32.Vec2 `desc:"main point coords in window (dot) coords"`

	// control point coords in window (dot) coords (nil until manipulated)
	WinCtrls []mat32.Vec2 `desc:"control point coords in window (dot) coords (nil until manipulated)"`
}

PathNode is info about each node in a path that is being edited

type PhysSize

type PhysSize struct {

	// select a standard size -- this will set units and size
	StdSize StdSizes `desc:"select a standard size -- this will set units and size"`

	// for standard size, use first number as width, second as height
	Portrait bool `desc:"for standard size, use first number as width, second as height"`

	// default units to use, e.g., in line widths etc
	Units units.Units `desc:"default units to use, e.g., in line widths etc"`

	// drawing size, in Units
	Size mat32.Vec2 `desc:"drawing size, in Units"`

	// grid spacing, in units of ViewBox size
	Grid float32 `desc:"grid spacing, in units of ViewBox size"`
}

PhysSize specifies the physical size of the drawing, when making a new one

func (*PhysSize) Defaults

func (ps *PhysSize) Defaults()

func (*PhysSize) SetFromSVG

func (ps *PhysSize) SetFromSVG(sv *SVGView)

SetFromSVG sets from svg

func (*PhysSize) SetStdSize

func (ps *PhysSize) SetStdSize(std StdSizes) error

SetStdSize sets drawing to a standard size

func (*PhysSize) SetToSVG

func (ps *PhysSize) SetToSVG(sv *SVGView)

SetToSVG sets svg from us

func (*PhysSize) SetToStdSize

func (ps *PhysSize) SetToStdSize() error

SetToStdSize sets drawing to the current standard size value

func (*PhysSize) Update

func (ps *PhysSize) Update()

type Preferences

type Preferences struct {

	// default physical size, when app is started without opening a file
	Size PhysSize `desc:"default physical size, when app is started without opening a file"`

	// active color preferences
	Colors ColorPrefs `desc:"active color preferences"`

	// named color schemes -- has Light and Dark schemes by default
	ColorSchemes map[string]*ColorPrefs `desc:"named color schemes -- has Light and Dark schemes by default"`

	// default shape styles
	ShapeStyle girl.Paint `desc:"default shape styles"`

	// default text styles
	TextStyle girl.Paint `desc:"default text styles"`

	// default line styles
	PathStyle girl.Paint `desc:"default line styles"`

	// default line styles
	LineStyle girl.Paint `desc:"default line styles"`

	// turns on the grid display
	GridDisp bool `desc:"turns on the grid display"`

	// snap positions and sizes to underlying grid
	SnapGrid bool `desc:"snap positions and sizes to underlying grid"`

	// snap positions and sizes to line up with other elements
	SnapGuide bool `desc:"snap positions and sizes to line up with other elements"`

	// snap node movements to align with guides
	SnapNodes bool `desc:"snap node movements to align with guides"`

	// [min: 1] number of screen pixels around target point (in either direction) to snap
	SnapTol int `min:"1" desc:"number of screen pixels around target point (in either direction) to snap"`

	// named-split config in use for configuring the splitters
	SplitName SplitName `desc:"named-split config in use for configuring the splitters"`

	// environment variables to set for this app -- if run from the command line, standard shell environment variables are inherited, but on some OS's (Mac), they are not set when run as a gui app
	EnvVars map[string]string `` /* 196-byte string literal not displayed */

	// [view: -] flag that is set by StructView by virtue of changeflag tag, whenever an edit is made.  Used to drive save menus etc.
	Changed bool `` /* 164-byte string literal not displayed */
}

Preferences is the overall Grid preferences

func (*Preferences) ApplyEnvVars added in v0.5.3

func (pf *Preferences) ApplyEnvVars()

ApplyEnvVars applies environment variables set in EnvVars

func (*Preferences) DarkMode

func (pf *Preferences) DarkMode()

DarkMode sets colors to dark mode

func (*Preferences) Defaults

func (pf *Preferences) Defaults()

func (*Preferences) EditSplits

func (pf *Preferences) EditSplits()

EditSplits opens the SplitsView editor to customize saved splitter settings

func (*Preferences) LightMode

func (pf *Preferences) LightMode()

LightMode sets colors to light mode

func (*Preferences) Open

func (pf *Preferences) Open() error

Open preferences from GoGi standard prefs directory, and applies them

func (*Preferences) Save

func (pf *Preferences) Save() error

Save Preferences to GoGi standard prefs directory

func (*Preferences) Update

func (pf *Preferences) Update()

func (*Preferences) UpdateAll

func (pf *Preferences) UpdateAll()

UpdateAll updates all open windows with current preferences -- triggers rebuild of default styles.

func (*Preferences) VersionInfo

func (pf *Preferences) VersionInfo() string

VersionInfo returns Grid version information

type SVGView

type SVGView struct {
	svg.SVG

	// [view: -] the parent gridview
	GridView *GridView `copy:"-" json:"-" xml:"-" view:"-" desc:"the parent gridview"`

	// view translation offset (from dragging)
	Trans mat32.Vec2 `desc:"view translation offset (from dragging)"`

	// view scaling (from zooming)
	Scale float32 `desc:"view scaling (from zooming)"`

	// grid spacing, in native ViewBox units
	Grid float32 `desc:"grid spacing, in native ViewBox units"`

	// [view: inactive] effective grid spacing given Scale level
	GridEff float32 `view:"inactive" desc:"effective grid spacing given Scale level"`

	// [view: -] has dragging cursor been set yet?
	SetDragCursor bool `view:"-" desc:"has dragging cursor been set yet?"`

	// [view: -] background pixels, includes page outline and grid
	BgPixels *image.RGBA `copy:"-" json:"-" xml:"-" view:"-" desc:"background pixels, includes page outline and grid"`

	// [view: -] render state for background rendering
	BgRender girl.State `copy:"-" json:"-" xml:"-" view:"-" desc:"render state for background rendering"`
	// contains filtered or unexported fields
}

SVGView is the element for viewing, interacting with the SVG

func AddNewSVGView

func AddNewSVGView(parent ki.Ki, name string, gv *GridView) *SVGView

AddNewSVGView adds a new editor to given parent node, with given name.

func (*SVGView) BgNeedsUpdate

func (sv *SVGView) BgNeedsUpdate() bool

func (*SVGView) ConnectEvents2D

func (sv *SVGView) ConnectEvents2D()

func (*SVGView) ConstrainPoint

func (sv *SVGView) ConstrainPoint(st, rawpt mat32.Vec2) (mat32.Vec2, bool)

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 (*SVGView) ContentsBBox

func (sv *SVGView) ContentsBBox() mat32.Box2

ContentsBBox returns the object-level box of the entire contents

func (*SVGView) CopyFieldsFrom

func (g *SVGView) CopyFieldsFrom(frm any)

func (*SVGView) DepthMap added in v0.5.2

func (sv *SVGView) DepthMap() map[ki.Ki]int

DepthMap returns a map of all nodes and their associated depth count counting up from 0 as the deepest, first drawn node.

func (*SVGView) DragEvent

func (sv *SVGView) DragEvent(me *mouse.DragEvent)

DragEvent processes a mouse drag event on the SVG canvas

func (*SVGView) DragMove

func (sv *SVGView) DragMove(win *gi.Window, me *mouse.DragEvent)

DragMove is when dragging a selection for moving

func (*SVGView) EditNode

func (sv *SVGView) EditNode(kn ki.Ki)

EditNode opens a structview editor on node

func (*SVGView) EditState

func (sv *SVGView) EditState() *EditState

EditState returns the EditState for this view

func (*SVGView) EnsureBgSize

func (sv *SVGView) EnsureBgSize() bool

EnsureBgSize ensures Bg is set to the right size -- returns true if resized

func (*SVGView) FillViewportWithBg

func (sv *SVGView) FillViewportWithBg()

func (*SVGView) GatherAlignPoints

func (sv *SVGView) GatherAlignPoints()

GatherAlignPoints gets all the potential points of alignment for objects not in selection group

func (*SVGView) Gradients

func (sv *SVGView) Gradients() []*Gradient

Gradients returns the currently-defined gradients with stops that are shared among obj-specific ones

func (*SVGView) GridDots

func (sv *SVGView) GridDots() (float32, mat32.Vec2)

GridDots is the current grid spacing and offsets in dots

func (*SVGView) KeyChordEvent

func (sv *SVGView) KeyChordEvent()

func (*SVGView) MakeNodeContextMenu

func (sv *SVGView) MakeNodeContextMenu(m *gi.Menu, kn ki.Ki)

MakeNodeContextMenu makes the menu of options for context right click

func (*SVGView) ManipDone

func (sv *SVGView) ManipDone()

ManipDone happens when a manipulation has finished: resets action, does render

func (*SVGView) ManipStart

func (sv *SVGView) ManipStart(act, data string)

ManipStart is called at the start of a manipulation, saving the state prior to the action

func (*SVGView) ManipUpdate

func (sv *SVGView) ManipUpdate()

ManipUpdate is called from goroutine: 'go sv.ManipUpdate()' to update the current display while manipulating. It checks if already rendering and if so, just returns immediately, so that updates are not stacked up and laggy.

func (*SVGView) MetaData

func (sv *SVGView) MetaData(mknew bool) (main, grid *gi.MetaData2D)

MetaData returns the overall metadata and grid if present. if mknew is true, it will create new ones if not found.

func (*SVGView) MouseDrag

func (sv *SVGView) MouseDrag()

func (*SVGView) MouseEvent

func (sv *SVGView) MouseEvent()

func (*SVGView) MouseHover

func (sv *SVGView) MouseHover()

func (*SVGView) MouseScroll

func (sv *SVGView) MouseScroll()

func (*SVGView) NewEl

func (sv *SVGView) NewEl(typ reflect.Type) svg.NodeSVG

NewEl makes a new SVG element, giving it a new unique name. Uses currently active layer if set.

func (*SVGView) NewElDrag

func (sv *SVGView) NewElDrag(typ reflect.Type, start, end image.Point) svg.NodeSVG

NewElDrag makes a new SVG element during the drag operation

func (*SVGView) NewPath

func (sv *SVGView) NewPath(start, end image.Point) *svg.Path

NewPath makes a new SVG Path element during the drag operation

func (*SVGView) NewText

func (sv *SVGView) NewText(start, end image.Point) svg.NodeSVG

NewText makes a new Text element with embedded tspan

func (*SVGView) NodeContextMenu

func (sv *SVGView) NodeContextMenu(kn ki.Ki, pos image.Point)

NodeContextMenu pops up the right-click context menu for given node

func (*SVGView) NodeContextMenuPos

func (sv *SVGView) NodeContextMenuPos(pos image.Point) image.Point

ContextMenuPos returns position to use for context menu, based on input position

func (*SVGView) NodeSpriteEvent

func (sv *SVGView) NodeSpriteEvent(idx int, et oswin.EventType, d any)

func (*SVGView) PathNodeSetOnePoint

func (sv *SVGView) PathNodeSetOnePoint(path *svg.Path, pts []*PathNode, pidx int, dv mat32.Vec2, svoff mat32.Vec2)

PathNodeMoveOnePoint moves given node index by given delta in window coords and all following points up to cmd = z or m are moved in the opposite direction to compensate, so only the one point is moved in effect. svoff is the window starting vector coordinate for view.

func (*SVGView) PathNodeSetPoint

func (sv *SVGView) PathNodeSetPoint(path *svg.Path, pn *PathNode, npt mat32.Vec2)

PathNodeSetPoint sets data point for path node to given new point value which is in *absolute* (but local) coordinates -- translates into relative coordinates as needed.

func (*SVGView) PathNodes

func (sv *SVGView) PathNodes(path *svg.Path) ([]*PathNode, []int)

PathNodes returns the PathNode data for given path data, and a list of indexes where commands start

func (*SVGView) ReadMetaData

func (sv *SVGView) ReadMetaData()

ReadMetaData reads meta data of drawing

func (*SVGView) Redo

func (sv *SVGView) Redo() string

Redo redoes one step, returning the action that was redone

func (*SVGView) RemoveNodeSprites

func (sv *SVGView) RemoveNodeSprites(win *gi.Window)

func (*SVGView) RemoveSelSprites

func (sv *SVGView) RemoveSelSprites(win *gi.Window)

func (*SVGView) Render2D

func (sv *SVGView) Render2D()

func (*SVGView) RenderBg

func (sv *SVGView) RenderBg()

RenderBg renders our background image

func (*SVGView) ResizeToContents

func (sv *SVGView) ResizeToContents(grid_off bool)

ResizeToContents resizes the drawing to just fit the current contents, including moving everything to start at upper-left corner, optionally preserving the current grid offset, so grid snapping is preserved -- recommended.

func (*SVGView) SVGViewEvents

func (sv *SVGView) SVGViewEvents()

func (*SVGView) SVGViewKeys

func (sv *SVGView) SVGViewKeys(kt *key.ChordEvent)

func (*SVGView) SelSpriteEvent

func (sv *SVGView) SelSpriteEvent(sp Sprites, et oswin.EventType, d any)

func (*SVGView) SelectContainsPoint

func (sv *SVGView) SelectContainsPoint(pt image.Point, leavesOnly, excludeSel bool) svg.NodeSVG

SelectContainsPoint finds the first node whose WinBBox contains the given point -- nil if none. If leavesOnly is set then only nodes that have no nodes (leaves, terminal nodes) will be considered. if leavesOnly, only terminal leaves (no children) are included if excludeSel, any leaf nodes that are within the current edit selection are excluded,

func (*SVGView) SelectWithinBBox

func (sv *SVGView) SelectWithinBBox(bbox image.Rectangle, leavesOnly bool) []svg.NodeSVG

SelectWithinBBox returns a list of all nodes whose WinBBox is fully contained within the given BBox. SVG version excludes layer groups.

func (*SVGView) SetBBoxSpritePos

func (sv *SVGView) SetBBoxSpritePos(typ Sprites, idx int, bbox mat32.Box2)

SetBBoxSpritePos sets positions of given type of sprites

func (*SVGView) SetMetaData

func (sv *SVGView) SetMetaData()

SetMetaData sets meta data of drawing

func (*SVGView) SetRubberBand

func (sv *SVGView) SetRubberBand(cur image.Point)

SetRubberBand updates the rubber band postion

func (*SVGView) SetSVGName

func (sv *SVGView) SetSVGName(el svg.NodeSVG)

SetSVGName sets the name of the element to standard type + id name

func (*SVGView) SetSelSpritePos

func (sv *SVGView) SetSelSpritePos()

func (*SVGView) SetTransform

func (sv *SVGView) SetTransform()

SetTransform sets the transform based on Trans and Scale values

func (*SVGView) ShowAlignMatches

func (sv *SVGView) ShowAlignMatches(pts []image.Rectangle, typs []BBoxPoints)

ShowAlignMatches draws the align matches as given between BBox Min - Max. typs are corresponding bounding box sources.

func (*SVGView) SnapBBox

func (sv *SVGView) SnapBBox(rawbb mat32.Box2) mat32.Box2

SnapBBox does snapping on given raw bbox according to preferences, aligning movement of bbox edges / centers relative to other bboxes.. returns snapped bbox.

func (*SVGView) SnapPoint

func (sv *SVGView) SnapPoint(rawpt mat32.Vec2) mat32.Vec2

SnapPoint does snapping on one raw point, given that point, in window coordinates. returns the snapped point.

func (*SVGView) SnapPointToGrid

func (sv *SVGView) SnapPointToGrid(rawpt mat32.Vec2) mat32.Vec2

func (*SVGView) SpriteNodeDrag

func (sv *SVGView) SpriteNodeDrag(idx int, win *gi.Window, me *mouse.DragEvent)

SpriteNodeDrag processes a mouse node drag event on a path node sprite

func (*SVGView) SpriteReshapeDrag

func (sv *SVGView) SpriteReshapeDrag(sp Sprites, win *gi.Window, me *mouse.DragEvent)

SpriteReshapeDrag processes a mouse reshape drag event on a selection sprite

func (*SVGView) SpriteRotateDrag

func (sv *SVGView) SpriteRotateDrag(sp Sprites, delta image.Point, win *gi.Window)

SpriteRotateDrag processes a mouse rotate drag event on a selection sprite

func (*SVGView) Undo

func (sv *SVGView) Undo() string

Undo undoes one step, returning the action that was undone

func (*SVGView) UndoSave

func (sv *SVGView) UndoSave(action, data string)

UndoSave save current state for potential undo

func (*SVGView) UndoSaveReplace

func (sv *SVGView) UndoSaveReplace(action, data string)

UndoSaveReplace save current state to replace current

func (*SVGView) UpdateGradients

func (sv *SVGView) UpdateGradients(gl []*Gradient)

UpdateGradients update SVG gradients from given gradient list

func (*SVGView) UpdateGridEff

func (sv *SVGView) UpdateGridEff()

UpdateGridEff updates the GirdEff value based on current scale

func (*SVGView) UpdateNodeSprites

func (sv *SVGView) UpdateNodeSprites()

func (*SVGView) UpdateSelSprites

func (sv *SVGView) UpdateSelSprites()

func (*SVGView) UpdateSelect

func (sv *SVGView) UpdateSelect()

UpdateSelect should be called whenever selection changes

func (*SVGView) UpdateView

func (sv *SVGView) UpdateView(full bool)

UpdateView updates the view, optionally with a full re-render

func (*SVGView) XFormAllLeaves

func (sv *SVGView) XFormAllLeaves(trans mat32.Vec2, scale mat32.Vec2, rot float32, pt mat32.Vec2)

XFormAllLeaves transforms all the leaf items in the drawing (not groups) uses ApplyDeltaXForm manipulation.

func (*SVGView) ZoomAt

func (sv *SVGView) ZoomAt(pt image.Point, delta float32)

ZoomAt updates the scale and translate parameters at given point by given delta: + means zoom in, - means zoom out, delta should always be < 1)

func (*SVGView) ZoomToContents

func (sv *SVGView) ZoomToContents(width bool)

ZoomToContents sets the scale to fit the current contents into view

func (*SVGView) ZoomToPage

func (sv *SVGView) ZoomToPage(width bool)

ZoomToPage sets the scale to fit the current viewbox

type SelState

type SelState struct {

	// order item was selected
	Order int `desc:"order item was selected"`

	// initial geometry, saved when first selected or start dragging -- manipulations restore then transform from there
	InitGeom []float32 `desc:"initial geometry, saved when first selected or start dragging -- manipulations restore then transform from there"`
}

SelState is state for selected nodes

type Split

type Split struct {

	// name of splitter config
	Name string `desc:"name of splitter config"`

	// brief description
	Desc string `desc:"brief description"`

	// [min: 0] [max: 1] [step: .05] splitter panel proportions
	Splits []float32 `min:"0" max:"1" step:".05" fixed-len:"3" desc:"splitter panel proportions"`
}

Split is a named splitter configuration

func (Split) Label

func (sp Split) Label() string

Label satisfies the Labeler interface

func (*Split) SaveSplits

func (lt *Split) SaveSplits(sp []float32)

SaveSplits saves given splits to this setting -- must use copy!

type SplitName

type SplitName string

SplitName has an associated ValueView for selecting from the list of available named splits

func (SplitName) ValueView

func (kn SplitName) ValueView() giv.ValueView

ValueView registers SplitValueView as the viewer of SplitName

type SplitValueView

type SplitValueView struct {
	giv.ValueViewBase
}

SplitValueView presents an action for displaying an SplitName and selecting

func (*SplitValueView) Activate

func (vv *SplitValueView) Activate(vp *gi.Viewport2D, dlgRecv ki.Ki, dlgFunc ki.RecvFunc)

func (*SplitValueView) ConfigWidget

func (vv *SplitValueView) ConfigWidget(widg gi.Node2D)

func (*SplitValueView) HasAction

func (vv *SplitValueView) HasAction() bool

func (*SplitValueView) UpdateWidget

func (vv *SplitValueView) UpdateWidget()

func (*SplitValueView) WidgetType

func (vv *SplitValueView) WidgetType() reflect.Type

type Splits

type Splits []*Split

Splits is a list of named splitter configurations

var AvailSplits Splits

AvailSplits are available named splitter settings. can be loaded / saved / edited with preferences. This is set to StdSplits at startup.

func (*Splits) Add

func (lt *Splits) Add(name, desc string, splits []float32) (*Split, int)

Add adds a new splitter setting, returns split and index

func (*Splits) CopyFrom

func (lt *Splits) CopyFrom(cp Splits)

CopyFrom copies named splits from given other map

func (*Splits) FixLen

func (lt *Splits) FixLen()

FixLen ensures that there are exactly 3 splits in each

func (*Splits) Names

func (lt *Splits) Names() []string

Names returns a slice of current names

func (*Splits) OpenJSON

func (lt *Splits) OpenJSON(filename gi.FileName) error

OpenJSON opens named splits from a JSON-formatted file.

func (*Splits) OpenPrefs

func (lt *Splits) OpenPrefs() error

OpenPrefs opens Splits from App standard prefs directory, using PrefSplitsFileName

func (*Splits) SaveJSON

func (lt *Splits) SaveJSON(filename gi.FileName) error

SaveJSON saves named splits to a JSON-formatted file.

func (*Splits) SavePrefs

func (lt *Splits) SavePrefs() error

SavePrefs saves Splits to App standard prefs directory, using PrefSplitsFileName

func (*Splits) SplitByName

func (lt *Splits) SplitByName(name SplitName) (*Split, int, bool)

SplitByName returns a named split and index by name -- returns false and emits a message to stdout if not found

type Sprites

type Sprites int

Sprites are the type of sprite

const (
	// SpUnk is an unknown sprite type
	SpUnk 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 sel box
	// subtyp = UpC, LfM, RtM, DnC for sides
	SpRubberBand

	// SpAlignMatch is an alignment match (n of these),
	// subtyp is actually BBoxPoints so we just hack cast that
	SpAlignMatch

	// Sprite bounding boxes are set as a "bbox" property on sprites
	SpBBoxUpL
	SpBBoxUpC
	SpBBoxUpR
	SpBBoxDnL
	SpBBoxDnC
	SpBBoxDnR
	SpBBoxLfM
	SpBBoxRtM

	SpritesN
)

func SpriteProps

func SpriteProps(sp *gi.Sprite) (typ, subtyp Sprites, idx int)

SpriteProps reads the sprite properties -- returns SpUnk if not one of our sprites.

func (*Sprites) FromString

func (i *Sprites) FromString(s string) error

func (Sprites) MarshalJSON

func (ev Sprites) MarshalJSON() ([]byte, error)

func (Sprites) String

func (i Sprites) String() string

func (*Sprites) UnmarshalJSON

func (ev *Sprites) UnmarshalJSON(b []byte) error

type StdSizeVals

type StdSizeVals struct {
	Units units.Units
	X     float32
	Y     float32
}

StdSizeVals are values for standard sizes

type StdSizes

type StdSizes int

StdSizes are standard physical drawing sizes

const (
	// CustomSize =  nonstandard
	CustomSize StdSizes = 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

	StdSizesN
)

func MatchStdSize

func MatchStdSize(wd, ht float32, un units.Units) StdSizes

func (*StdSizes) FromString

func (i *StdSizes) FromString(s string) error

func (StdSizes) MarshalJSON

func (ev StdSizes) MarshalJSON() ([]byte, error)

func (StdSizes) String

func (i StdSizes) String() string

func (*StdSizes) UnmarshalJSON

func (ev *StdSizes) UnmarshalJSON(b []byte) error

type TextStyle

type TextStyle struct {

	// current text to edit
	Text string `desc:"current text to edit"`

	// font family
	Font gi.FontName `xml:"font-family" desc:"font family"`

	// font size
	Size units.Value `xml:"font-size" desc:"font size"`

	// prop: font-style = style -- normal, italic, etc
	Style gist.FontStyles `xml:"font-style" inherit:"true" desc:"prop: font-style = style -- normal, italic, etc"`

	// prop: font-weight = weight: normal, bold, etc
	Weight gist.FontWeights `xml:"font-weight" inherit:"true" desc:"prop: font-weight = weight: normal, bold, etc"`

	// prop: font-stretch = font stretch / condense options
	Stretch gist.FontStretch `xml:"font-stretch" inherit:"true" desc:"prop: font-stretch = font stretch / condense options"`

	// prop: font-variant = normal or small caps
	Variant gist.FontVariants `xml:"font-variant" inherit:"true" desc:"prop: font-variant = normal or small caps"`

	// prop: text-decoration = underline, line-through, etc -- not inherited
	Deco gist.TextDecorations `xml:"text-decoration" desc:"prop: text-decoration = underline, line-through, etc -- not inherited"`

	// prop: baseline-shift = super / sub script -- not inherited
	Shift gist.BaselineShifts `xml:"baseline-shift" desc:"prop: baseline-shift = super / sub script -- not inherited"`

	// prop: text-align (inherited) = how to align text, horizontally. This *only* applies to the text within its containing element, and is typically relevant only for multi-line text: for single-line text, if element does not have a specified size that is different from the text size, then this has *no effect*.
	Align gist.Align `` /* 346-byte string literal not displayed */

	// [view: -] font value view for font toolbar
	FontVal giv.FontValueView `view:"-" desc:"font value view for font toolbar"`

	// [view: -] the parent gridview
	GridView *GridView `copy:"-" json:"-" xml:"-" view:"-" desc:"the parent gridview"`
}

TextStyle is text styling info -- using StructView to do text editor

func (*TextStyle) Defaults

func (ts *TextStyle) Defaults()

func (*TextStyle) SetFromFontStyle

func (ts *TextStyle) SetFromFontStyle(fs *gist.Font)

SetFromFontStyle sets from standard gist.Font style

func (*TextStyle) SetFromNode

func (ts *TextStyle) SetFromNode(txt *svg.Text)

SetFromNode sets text style info from given svg.Text node

func (*TextStyle) TextProps

func (ts *TextStyle) TextProps() map[string]string

TextProps returns non-default text properties to set

func (*TextStyle) Update

func (ts *TextStyle) Update()

type Tools

type Tools int

Tools are the drawing tools

const (
	SelectTool Tools = iota
	NodeTool
	RectTool
	EllipseTool
	BezierTool
	TextTool
	ToolsN
)

func (*Tools) FromString

func (i *Tools) FromString(s string) error

func (Tools) MarshalJSON

func (ev Tools) MarshalJSON() ([]byte, error)

func (Tools) String

func (i Tools) String() string

func (*Tools) UnmarshalJSON

func (ev *Tools) UnmarshalJSON(b []byte) error

type TreeView

type TreeView struct {
	giv.TreeView

	// [view: -] the parent gridview
	GridView *GridView `copy:"-" json:"-" xml:"-" view:"-" desc:"the parent gridview"`
}

TreeView is a TreeView that knows how to operate on FileNode nodes

func AddNewTreeView

func AddNewTreeView(parent ki.Ki, name string) *TreeView

AddNewTreeView adds a new filetreeview to given parent node, with given name.

func (*TreeView) LayerClearCurrent

func (tv *TreeView) LayerClearCurrent()

LayerClearCurrent clears this layer as the current layer if it was set as such.

func (*TreeView) LayerIsCurrent

func (tv *TreeView) LayerIsCurrent() bool

LayerIsCurrent returns true if layer is the current active one for creating

func (*TreeView) LayerSetCurrent

func (tv *TreeView) LayerSetCurrent()

LayerSetCurrent sets this layer as the current layer name

func (*TreeView) LayerToggleLock

func (tv *TreeView) LayerToggleLock()

LayerToggleLock toggles whether layer is locked or not

func (*TreeView) LayerToggleVis

func (tv *TreeView) LayerToggleVis()

LayerToggleVis toggles visibility of the layer

func (*TreeView) ParGridView

func (tv *TreeView) ParGridView() *GridView

ParGridView returns the parent GridView

func (*TreeView) SelectSVG

func (tv *TreeView) SelectSVG()

SelectSVG

func (*TreeView) Style2D

func (tv *TreeView) Style2D()

Jump to

Keyboard shortcuts

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