示例#1
0
func translateLabelPosition(css map[string]interface{},
	cxProps map[string]interface{}, converter cyjs.VisualPropConverter) {

	value := cxProps["NODE_LABEL_POSITION"]
	pos := converter.GetCyjsPropertyValue("NODE_LABEL_POSITION", value.(string)).([2]string)
	css["text-valign"] = pos[0]
	css["text-halign"] = pos[1]

}
示例#2
0
func processNodeSizeLocked(sizeLockedStr string,
	css map[string]interface{}, cxProps map[string]interface{}, converter cyjs.VisualPropConverter) {
	sizeLocked, _ := strconv.ParseBool(sizeLockedStr)

	if sizeLocked {
		value := cxProps["NODE_SIZE"]
		convertedValue := converter.GetCyjsPropertyValue("NODE_SIZE", value.(string))
		css["height"] = convertedValue
		css["width"] = convertedValue
	} else {
		w := cxProps["NODE_WIDTH"]
		h := cxProps["NODE_HEIGHT"]
		wValue := converter.GetCyjsPropertyValue("NODE_WIDTH", w.(string))
		hValue := converter.GetCyjsPropertyValue("NODE_HEIGHT", h.(string))
		css["height"] = hValue
		css["width"] = wValue
	}
}
示例#3
0
func processEdgeArrowColor(arrowLockedStr string,
	css map[string]interface{}, cxProps map[string]interface{}, converter cyjs.VisualPropConverter) {
	arrowLocked, _ := strconv.ParseBool(arrowLockedStr)

	if arrowLocked {
		// Need to use EDGE_UNSELECTED_PAINT if locked.
		value := cxProps["EDGE_UNSELECTED_PAINT"]
		convertedValue := converter.GetCyjsPropertyValue("EDGE_UNSELECTED_PAINT", value.(string))
		css["target-arrow-color"] = convertedValue
		css["source-arrow-color"] = convertedValue
		css["line-color"] = convertedValue
	} else {
		l := cxProps["EDGE_STROKE_UNSELECTED_PAINT"]
		s := cxProps["EDGE_SOURCE_ARROW_UNSELECTED_PAINT"]
		t := cxProps["EDGE_TARGET_ARROW_UNSELECTED_PAINT"]
		lColor := converter.GetCyjsPropertyValue("EDGE_STROKE_UNSELECTED_PAINT", l.(string))
		sColor := converter.GetCyjsPropertyValue("EDGE_STROKE_UNSELECTED_PAINT", s.(string))
		tColor := converter.GetCyjsPropertyValue("EDGE_STROKE_UNSELECTED_PAINT", t.(string))
		css["line-color"] = lColor
		css["source-arrow-color"] = sColor
		css["target-arrow-color"] = tColor
	}

}