function initializeMark()

in packages/processing-scenegraph/src/parse.ts [104:132]


function initializeMark(rawMark: any): SGMark<any> {
	const { marktype, role } = rawMark

	// Construct the output mark
	const result = new Mark()
	result.marktype = marktype
	result.role = role
	result.items = (rawMark.items || []).map((rawItem: any) => {
		const parentType = marktype ? SGNodeType.Mark : SGNodeType.Item

		// Initialize the data for this child node
		const item: Item | Mark<any> =
			parentType === SGNodeType.Mark
				? initializeItem(marktype, rawItem)
				: initializeMark(rawItem)

		// Set parentage information
		item.parent = result
		item.parentType = parentType
		return item
	})
	if (Object.prototype.hasOwnProperty.call(rawMark, 'clip')) {
		result.clip = rawMark.clip
	}
	if (Object.prototype.hasOwnProperty.call(rawMark, 'interactive')) {
		result.interactive = rawMark.interactive
	}
	return result
}