Module: app

The main app service. It is mixed-paradigm code that combines Vue and vanilla JavaScript due to historical reasons.

Source:

Methods

(inner) computeImportShapesDefaults()

Bridge for the Import Shapes modal: viewport size / scene origin come from the live canvas and scene (see module:shapeImport.computeImportShapesDefaults).

Source:

(inner) importModulesFromSceneFile(parsedJson) → {boolean}

Merge module definitions from a parsed scene (or module package) JSON object.

Parameters:
Name Type Description
parsedJson object
Source:
Returns:

Whether the file contained a valid modules object.

Type
boolean

(inner) importShapes(paths, options) → {Object}

Import previously parsed shape paths into the current scene. Colors are used to decide the target object type per stroke / per fill. Open paths map to Bezier-mirror / Bezier-custom-surface / Drawing objects; closed paths additionally map to Bezier glass / GRIN-glass (using the shape's fill color). Imports can be optionally grouped under one Handle for easy transformation.

Parameters:
Name Type Description
paths Array

Parsed shape paths (from module:svgImport.parseShapesFile).

options Object
Properties
Name Type Attributes Default Description
scale number <optional>
1

Uniform scale applied to shape coordinates.

offsetX number <optional>
0

X offset applied after scaling.

offsetY number <optional>
0

Y offset applied after scaling.

tolerance number <optional>
0.1

Scene-unit tolerance used to (a) cap arc-to-Bezier deviation and (b) merge consecutive dense cubic segments. Applied in scene coordinates (after scaling).

strokeActions Object.<string, {action: ('none'|'CurveMirror'|'CustomCurveSurface'|'Drawing')}> <optional>

Mapping from stroke-color key (e.g. '#ff0000') to the chosen action.

fillActions Object.<string, {action: string, refIndex: (number|undefined), cauchyB: (number|undefined)}> <optional>

Mapping from fill-color key to the chosen action and per-color glass parameters.

groupInHandle boolean <optional>
true
sourceFileName string <optional>
''

When grouping in a handle, sets the handle's display name (e.g. the imported SVG filename).

Source:
Returns:
Type
Object