Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
stroke: '#ff0033',
'stroke-width': 2.5
});
this.attr({
'opacity': 1
});
this[0].toFront();
};
/**
* 取消选择的外形:根据节点的类型不同而改变取消选择的外形
* @param node
*/
Raphael.st.unSelectedShape = function(node){
if(node.isSecondMoreNode()){
this[1].attr({
'secondMoreStroke': null
})
}else{
//@workaround:暂时被选择的样式
this[1].attr({
'rootAndFirstStroke': null
})
}
};
/**
* 重叠时节点的外形
* @param node
* 取消重叠时,节点的外形:设置根据节点的类型不同而不同
* @param node
*/
Raphael.st.unOverlapShape = function(node){
if(node.isSecondMoreNode()){
this[1].attr({
'secondMoreStroke': null
})
}else{
this[1].attr({
'rootAndFirstStroke': null
});
}
};
Raphael.st.setLabel = function(node){
this[0].attr({
'text': node.label
})
};
/**
* 透明样式:用于拖动节点时的透明显示
* @param node
*/
Raphael.st.dragNodeOpacityShape = function(node){
Raphael.st.unSelectedShape.call(this, node);
this.attr({
opacity: 0.4
});
let secondMorePadding = {
width: 10,
height: 10
};
setNodePosition(label, rect, nodeX, nodeY, secondMorePadding);
};
/**
* 根绝节点的类型,设置节点的外形
* @param node
*/
Raphael.st.nodeShape = function(node, mindmapType){
mindmapType = mindmapType || 'desktop';
if(node.checkIsRootNode()){
setRootShape(this, node.x, node.y, node.label, mindmapType);
}else if(node.isFirstLevelNode()){
setFirstLevelShape(this, node.x, node.y, node.label);
}else{
setSecondMoreShape(this, node.x, node.y, node.label);
}
};
/**
* 被选择的外形
*/
Raphael.st.selectedShape = function(node){
//@workaround:暂时选择的样式
this[1].attr({
this.attr({
opacity: 0.4
});
this.toFront();
};
Raphael.st.opacityShape = function(){
this.attr({
opacity: 0.5
})
};
Raphael.st.unOpacityShape = function(){
this.attr({
opacity: 1
})
};
export default {
init: function(paper){
//设置默认的属性
//默认的根结点和第一层节点的外框笔触样式
paper.customAttributes.rootAndFirstStroke = function(){
return {
'stroke': '#808080',
'stroke-width': 1
*/
Raphael.st.nodeShape = function(node, mindmapType){
mindmapType = mindmapType || 'desktop';
if(node.checkIsRootNode()){
setRootShape(this, node.x, node.y, node.label, mindmapType);
}else if(node.isFirstLevelNode()){
setFirstLevelShape(this, node.x, node.y, node.label);
}else{
setSecondMoreShape(this, node.x, node.y, node.label);
}
};
/**
* 被选择的外形
*/
Raphael.st.selectedShape = function(node){
//@workaround:暂时选择的样式
this[1].attr({
stroke: '#ff0033',
'stroke-width': 2.5
});
this.attr({
'opacity': 1
});
this[0].toFront();
};
/**
* 取消选择的外形:根据节点的类型不同而改变取消选择的外形
* @param node
/**
* 重叠时节点的外形
* @param node
*/
Raphael.st.overlapShape = function(node){
this[1].attr({
stroke: 'blue'
})
};
/**
* 取消重叠时,节点的外形:设置根据节点的类型不同而不同
* @param node
*/
Raphael.st.unOverlapShape = function(node){
if(node.isSecondMoreNode()){
this[1].attr({
'secondMoreStroke': null
})
}else{
this[1].attr({
'rootAndFirstStroke': null
});
}
};
Raphael.st.setLabel = function(node){
this[0].attr({
'text': node.label
})
};
'secondMoreStroke': null
})
}else{
//@workaround:暂时被选择的样式
this[1].attr({
'rootAndFirstStroke': null
})
}
};
/**
* 重叠时节点的外形
* @param node
*/
Raphael.st.overlapShape = function(node){
this[1].attr({
stroke: 'blue'
})
};
/**
* 取消重叠时,节点的外形:设置根据节点的类型不同而不同
* @param node
*/
Raphael.st.unOverlapShape = function(node){
if(node.isSecondMoreNode()){
this[1].attr({
'secondMoreStroke': null
})
}else{
this[1].attr({
});
}
};
Raphael.st.setLabel = function(node){
this[0].attr({
'text': node.label
})
};
/**
* 透明样式:用于拖动节点时的透明显示
* @param node
*/
Raphael.st.dragNodeOpacityShape = function(node){
Raphael.st.unSelectedShape.call(this, node);
this.attr({
opacity: 0.4
});
this.toFront();
};
Raphael.st.opacityShape = function(){
this.attr({
opacity: 0.5
})
};
/**
* 透明样式:用于拖动节点时的透明显示
* @param node
*/
Raphael.st.dragNodeOpacityShape = function(node){
Raphael.st.unSelectedShape.call(this, node);
this.attr({
opacity: 0.4
});
this.toFront();
};
Raphael.st.opacityShape = function(){
this.attr({
opacity: 0.5
})
};
Raphael.st.unOpacityShape = function(){
this.attr({
opacity: 1
})
};
export default {
init: function(paper){
Raphael.st.dragNodeOpacityShape = function(node){
Raphael.st.unSelectedShape.call(this, node);
this.attr({
opacity: 0.4
});
this.toFront();
};