删除注释后的空行

This commit is contained in:
wanglin2 2023-03-28 19:35:57 +08:00
parent fcfcb1c3d1
commit 747a781ad8
6 changed files with 386 additions and 481 deletions

View File

@ -5,7 +5,6 @@ import Base from './layouts/Base'
class Drag extends Base { class Drag extends Base {
// 构造函数 // 构造函数
constructor({ mindMap }) { constructor({ mindMap }) {
super(mindMap.renderer) super(mindMap.renderer)
this.mindMap = mindMap this.mindMap = mindMap
@ -14,7 +13,6 @@ class Drag extends Base {
} }
// 复位 // 复位
reset() { reset() {
// 当前拖拽节点 // 当前拖拽节点
this.node = null this.node = null
@ -48,7 +46,6 @@ class Drag extends Base {
} }
// 绑定事件 // 绑定事件
bindEvent() { bindEvent() {
this.checkOverlapNode = throttle(this.checkOverlapNode, 300, this) this.checkOverlapNode = throttle(this.checkOverlapNode, 300, this)
this.mindMap.on('node_mousedown', (node, e) => { this.mindMap.on('node_mousedown', (node, e) => {
@ -98,7 +95,6 @@ class Drag extends Base {
} }
// 鼠标松开事件 // 鼠标松开事件
onMouseup(e) { onMouseup(e) {
if (!this.isMousedown) { if (!this.isMousedown) {
return return
@ -141,7 +137,6 @@ class Drag extends Base {
} }
// 创建克隆节点 // 创建克隆节点
createCloneNode() { createCloneNode() {
if (!this.clone) { if (!this.clone) {
// 节点 // 节点
@ -163,7 +158,6 @@ class Drag extends Base {
} }
// 移除克隆节点 // 移除克隆节点
removeCloneNode() { removeCloneNode() {
if (!this.clone) { if (!this.clone) {
return return
@ -174,7 +168,6 @@ class Drag extends Base {
} }
// 拖动中 // 拖动中
onMove(x, y) { onMove(x, y) {
if (!this.isMousedown) { if (!this.isMousedown) {
return return
@ -201,7 +194,6 @@ class Drag extends Base {
} }
// 检测重叠节点 // 检测重叠节点
checkOverlapNode() { checkOverlapNode() {
if (!this.drawTransform) { if (!this.drawTransform) {
return return

View File

@ -24,7 +24,6 @@ const layouts = {
class Render { class Render {
// 构造函数 // 构造函数
constructor(opt = {}) { constructor(opt = {}) {
this.opt = opt this.opt = opt
this.mindMap = opt.mindMap this.mindMap = opt.mindMap
@ -51,7 +50,6 @@ class Render {
} }
// 设置布局结构 // 设置布局结构
setLayout() { setLayout() {
this.layout = new ( this.layout = new (
layouts[this.mindMap.opt.layout] layouts[this.mindMap.opt.layout]
@ -61,7 +59,6 @@ class Render {
} }
// 绑定事件 // 绑定事件
bindEvent() { bindEvent() {
// 点击事件 // 点击事件
this.mindMap.on('draw_click', () => { this.mindMap.on('draw_click', () => {
@ -73,7 +70,6 @@ class Render {
} }
// 注册命令 // 注册命令
registerCommands() { registerCommands() {
// 全选 // 全选
this.selectAll = this.selectAll.bind(this) this.selectAll = this.selectAll.bind(this)
@ -175,7 +171,6 @@ class Render {
} }
// 注册快捷键 // 注册快捷键
registerShortcutKeys() { registerShortcutKeys() {
// 插入下级节点 // 插入下级节点
this.mindMap.keyCommand.addShortcut('Tab', () => { this.mindMap.keyCommand.addShortcut('Tab', () => {
@ -220,7 +215,6 @@ class Render {
} }
// 开启文字编辑,会禁用回车键和删除键相关快捷键防止冲突 // 开启文字编辑,会禁用回车键和删除键相关快捷键防止冲突
startTextEdit() { startTextEdit() {
this.mindMap.keyCommand.save() this.mindMap.keyCommand.save()
// this.mindMap.keyCommand.removeShortcut('Del|Backspace') // this.mindMap.keyCommand.removeShortcut('Del|Backspace')
@ -229,7 +223,6 @@ class Render {
} }
// 结束文字编辑,会恢复回车键和删除键相关快捷键 // 结束文字编辑,会恢复回车键和删除键相关快捷键
endTextEdit() { endTextEdit() {
this.mindMap.keyCommand.restore() this.mindMap.keyCommand.restore()
// this.mindMap.keyCommand.addShortcut('Del|Backspace', this.removeNodeWrap) // this.mindMap.keyCommand.addShortcut('Del|Backspace', this.removeNodeWrap)
@ -238,7 +231,6 @@ class Render {
} }
// 渲染 // 渲染
render(callback = () => {}) { render(callback = () => {}) {
if (this.reRender) { if (this.reRender) {
this.clearActive() this.clearActive()
@ -254,7 +246,6 @@ class Render {
} }
// 清除当前激活的节点 // 清除当前激活的节点
clearActive() { clearActive() {
this.activeNodeList.forEach(item => { this.activeNodeList.forEach(item => {
this.setNodeActive(item, false) this.setNodeActive(item, false)
@ -263,7 +254,6 @@ class Render {
} }
// 清除当前所有激活节点,并会触发事件 // 清除当前所有激活节点,并会触发事件
clearAllActive() { clearAllActive() {
if (this.activeNodeList.length <= 0) { if (this.activeNodeList.length <= 0) {
return return
@ -273,7 +263,6 @@ class Render {
} }
// 添加节点到激活列表里 // 添加节点到激活列表里
addActiveNode(node) { addActiveNode(node) {
let index = this.findActiveNodeIndex(node) let index = this.findActiveNodeIndex(node)
if (index === -1) { if (index === -1) {
@ -282,7 +271,6 @@ class Render {
} }
// 在激活列表里移除某个节点 // 在激活列表里移除某个节点
removeActiveNode(node) { removeActiveNode(node) {
let index = this.findActiveNodeIndex(node) let index = this.findActiveNodeIndex(node)
if (index === -1) { if (index === -1) {
@ -292,7 +280,6 @@ class Render {
} }
// 检索某个节点在激活列表里的索引 // 检索某个节点在激活列表里的索引
findActiveNodeIndex(node) { findActiveNodeIndex(node) {
return this.activeNodeList.findIndex(item => { return this.activeNodeList.findIndex(item => {
return item === node return item === node
@ -300,7 +287,6 @@ class Render {
} }
// 获取节点在同级里的索引位置 // 获取节点在同级里的索引位置
getNodeIndex(node) { getNodeIndex(node) {
return node.parent return node.parent
? node.parent.children.findIndex(item => { ? node.parent.children.findIndex(item => {
@ -310,7 +296,6 @@ class Render {
} }
// 全选 // 全选
selectAll() { selectAll() {
walk( walk(
this.root, this.root,
@ -332,7 +317,6 @@ class Render {
} }
// 回退 // 回退
back(step) { back(step) {
this.clearAllActive() this.clearAllActive()
let data = this.mindMap.command.back(step) let data = this.mindMap.command.back(step)
@ -343,7 +327,6 @@ class Render {
} }
// 前进 // 前进
forward(step) { forward(step) {
this.clearAllActive() this.clearAllActive()
let data = this.mindMap.command.forward(step) let data = this.mindMap.command.forward(step)
@ -360,7 +343,6 @@ class Render {
} }
// 插入同级节点,多个节点只会操作第一个节点 // 插入同级节点,多个节点只会操作第一个节点
insertNode(openEdit = true, appointNodes = [], appointData = null) { insertNode(openEdit = true, appointNodes = [], appointData = null) {
appointNodes = this.formatAppointNodes(appointNodes) appointNodes = this.formatAppointNodes(appointNodes)
if (this.activeNodeList.length <= 0 && appointNodes.length <= 0) { if (this.activeNodeList.length <= 0 && appointNodes.length <= 0) {
@ -391,7 +373,6 @@ class Render {
} }
// 插入子节点 // 插入子节点
insertChildNode(openEdit = true, appointNodes = [], appointData = null) { insertChildNode(openEdit = true, appointNodes = [], appointData = null) {
appointNodes = this.formatAppointNodes(appointNodes) appointNodes = this.formatAppointNodes(appointNodes)
if (this.activeNodeList.length <= 0 && appointNodes.length <= 0) { if (this.activeNodeList.length <= 0 && appointNodes.length <= 0) {
@ -426,7 +407,6 @@ class Render {
} }
// 上移节点,多个节点只会操作第一个节点 // 上移节点,多个节点只会操作第一个节点
upNode() { upNode() {
if (this.activeNodeList.length <= 0) { if (this.activeNodeList.length <= 0) {
return return
@ -454,7 +434,6 @@ class Render {
} }
// 下移节点,多个节点只会操作第一个节点 // 下移节点,多个节点只会操作第一个节点
downNode() { downNode() {
if (this.activeNodeList.length <= 0) { if (this.activeNodeList.length <= 0) {
return return
@ -482,7 +461,6 @@ class Render {
} }
// 将节点移动到另一个节点的前面 // 将节点移动到另一个节点的前面
insertBefore(node, exist) { insertBefore(node, exist) {
if (node.isRoot) { if (node.isRoot) {
return return
@ -521,7 +499,6 @@ class Render {
} }
// 将节点移动到另一个节点的后面 // 将节点移动到另一个节点的后面
insertAfter(node, exist) { insertAfter(node, exist) {
if (node.isRoot) { if (node.isRoot) {
return return
@ -561,7 +538,6 @@ class Render {
} }
// 移除节点 // 移除节点
removeNode(appointNodes = []) { removeNode(appointNodes = []) {
appointNodes = this.formatAppointNodes(appointNodes) appointNodes = this.formatAppointNodes(appointNodes)
if (this.activeNodeList.length <= 0 && appointNodes.length <= 0) { if (this.activeNodeList.length <= 0 && appointNodes.length <= 0) {
@ -603,7 +579,6 @@ class Render {
} }
// 移除某个指定节点 // 移除某个指定节点
removeOneNode(node) { removeOneNode(node) {
let index = this.getNodeIndex(node) let index = this.getNodeIndex(node)
node.remove() node.remove()
@ -612,7 +587,6 @@ class Render {
} }
// 复制节点,多个节点只会操作第一个节点 // 复制节点,多个节点只会操作第一个节点
copyNode() { copyNode() {
if (this.activeNodeList.length <= 0) { if (this.activeNodeList.length <= 0) {
return return
@ -621,7 +595,6 @@ class Render {
} }
// 剪切节点,多个节点只会操作第一个节点 // 剪切节点,多个节点只会操作第一个节点
cutNode(callback) { cutNode(callback) {
if (this.activeNodeList.length <= 0) { if (this.activeNodeList.length <= 0) {
return return
@ -641,7 +614,6 @@ class Render {
} }
// 移动一个节点作为另一个节点的子节点 // 移动一个节点作为另一个节点的子节点
moveNodeTo(node, toNode) { moveNodeTo(node, toNode) {
if (node.isRoot) { if (node.isRoot) {
return return
@ -658,7 +630,6 @@ class Render {
} }
// 粘贴节点到节点 // 粘贴节点到节点
pasteNode(data) { pasteNode(data) {
if (this.activeNodeList.length <= 0) { if (this.activeNodeList.length <= 0) {
return return
@ -670,7 +641,6 @@ class Render {
} }
// 设置节点样式 // 设置节点样式
setNodeStyle(node, prop, value, isActive) { setNodeStyle(node, prop, value, isActive) {
let data = {} let data = {}
if (isActive) { if (isActive) {
@ -702,7 +672,6 @@ class Render {
} }
// 设置节点是否激活 // 设置节点是否激活
setNodeActive(node, active) { setNodeActive(node, active) {
this.setNodeData(node, { this.setNodeData(node, {
isActive: active isActive: active
@ -711,7 +680,6 @@ class Render {
} }
// 设置节点是否展开 // 设置节点是否展开
setNodeExpand(node, expand) { setNodeExpand(node, expand) {
this.setNodeData(node, { this.setNodeData(node, {
expand expand
@ -735,7 +703,6 @@ class Render {
} }
// 展开所有 // 展开所有
expandAllNode() { expandAllNode() {
walk( walk(
this.renderTree, this.renderTree,
@ -754,7 +721,6 @@ class Render {
} }
// 收起所有 // 收起所有
unexpandAllNode() { unexpandAllNode() {
walk( walk(
this.renderTree, this.renderTree,
@ -774,7 +740,6 @@ class Render {
} }
// 展开到指定层级 // 展开到指定层级
expandToLevel(level) { expandToLevel(level) {
walk( walk(
this.renderTree, this.renderTree,
@ -792,7 +757,6 @@ class Render {
} }
// 切换激活节点的展开状态 // 切换激活节点的展开状态
toggleActiveExpand() { toggleActiveExpand() {
this.activeNodeList.forEach(node => { this.activeNodeList.forEach(node => {
if (node.nodeData.children.length <= 0) { if (node.nodeData.children.length <= 0) {
@ -803,7 +767,6 @@ class Render {
} }
// 切换节点展开状态 // 切换节点展开状态
toggleNodeExpand(node) { toggleNodeExpand(node) {
this.mindMap.execCommand( this.mindMap.execCommand(
'SET_NODE_EXPAND', 'SET_NODE_EXPAND',
@ -813,7 +776,6 @@ class Render {
} }
// 设置节点文本 // 设置节点文本
setNodeText(node, text, richText) { setNodeText(node, text, richText) {
this.setNodeDataRender(node, { this.setNodeDataRender(node, {
text, text,
@ -822,7 +784,6 @@ class Render {
} }
// 设置节点图片 // 设置节点图片
setNodeImage(node, { url, title, width, height }) { setNodeImage(node, { url, title, width, height }) {
this.setNodeDataRender(node, { this.setNodeDataRender(node, {
image: url, image: url,
@ -835,7 +796,6 @@ class Render {
} }
// 设置节点图标 // 设置节点图标
setNodeIcon(node, icons) { setNodeIcon(node, icons) {
this.setNodeDataRender(node, { this.setNodeDataRender(node, {
icon: icons icon: icons
@ -843,7 +803,6 @@ class Render {
} }
// 设置节点超链接 // 设置节点超链接
setNodeHyperlink(node, link, title = '') { setNodeHyperlink(node, link, title = '') {
this.setNodeDataRender(node, { this.setNodeDataRender(node, {
hyperlink: link, hyperlink: link,
@ -852,7 +811,6 @@ class Render {
} }
// 设置节点备注 // 设置节点备注
setNodeNote(node, note) { setNodeNote(node, note) {
this.setNodeDataRender(node, { this.setNodeDataRender(node, {
note note
@ -860,7 +818,6 @@ class Render {
} }
// 设置节点标签 // 设置节点标签
setNodeTag(node, tag) { setNodeTag(node, tag) {
this.setNodeDataRender(node, { this.setNodeDataRender(node, {
tag tag
@ -868,7 +825,6 @@ class Render {
} }
// 添加节点概要 // 添加节点概要
addGeneralization(data) { addGeneralization(data) {
if (this.activeNodeList.length <= 0) { if (this.activeNodeList.length <= 0) {
return return
@ -888,7 +844,6 @@ class Render {
} }
// 删除节点概要 // 删除节点概要
removeGeneralization() { removeGeneralization() {
if (this.activeNodeList.length <= 0) { if (this.activeNodeList.length <= 0) {
return return
@ -906,7 +861,6 @@ class Render {
} }
// 设置节点自定义位置 // 设置节点自定义位置
setNodeCustomPosition(node, left = undefined, top = undefined) { setNodeCustomPosition(node, left = undefined, top = undefined) {
let nodeList = [node] || this.activeNodeList let nodeList = [node] || this.activeNodeList
nodeList.forEach(item => { nodeList.forEach(item => {
@ -918,7 +872,6 @@ class Render {
} }
// 一键整理布局,即去除自定义位置 // 一键整理布局,即去除自定义位置
resetLayout() { resetLayout() {
walk( walk(
this.root, this.root,
@ -940,7 +893,6 @@ class Render {
} }
// 设置节点形状 // 设置节点形状
setNodeShape(node, shape) { setNodeShape(node, shape) {
if (!shape || !shapeList.includes(shape)) { if (!shape || !shapeList.includes(shape)) {
return return
@ -952,7 +904,6 @@ class Render {
} }
// 更新节点数据 // 更新节点数据
setNodeData(node, data) { setNodeData(node, data) {
Object.keys(data).forEach(key => { Object.keys(data).forEach(key => {
node.nodeData.data[key] = data[key] node.nodeData.data[key] = data[key]
@ -960,7 +911,6 @@ class Render {
} }
// 设置节点数据,并判断是否渲染 // 设置节点数据,并判断是否渲染
setNodeDataRender(node, data) { setNodeDataRender(node, data) {
this.setNodeData(node, data) this.setNodeData(node, data)
let changed = node.getSize() let changed = node.getSize()
@ -975,7 +925,6 @@ class Render {
} }
// 移动节点到画布中心 // 移动节点到画布中心
moveNodeToCenter(node) { moveNodeToCenter(node) {
let halfWidth = this.mindMap.width / 2 let halfWidth = this.mindMap.width / 2
let halfHeight = this.mindMap.height / 2 let halfHeight = this.mindMap.height / 2

View File

@ -2,16 +2,13 @@ import Base from './Base'
import { walk, asyncRun } from '../utils' import { walk, asyncRun } from '../utils'
// 逻辑结构图 // 逻辑结构图
class LogicalStructure extends Base { class LogicalStructure extends Base {
// 构造函数 // 构造函数
constructor(opt = {}) { constructor(opt = {}) {
super(opt) super(opt)
} }
// 布局 // 布局
doLayout(callback) { doLayout(callback) {
let task = [ let task = [
() => { () => {
@ -31,7 +28,6 @@ class LogicalStructure extends Base {
} }
// 遍历数据计算节点的left、width、height // 遍历数据计算节点的left、width、height
computedBaseValue() { computedBaseValue() {
walk( walk(
this.renderer.renderTree, this.renderer.renderTree,
@ -67,7 +63,6 @@ class LogicalStructure extends Base {
} }
// 遍历节点树计算节点的top // 遍历节点树计算节点的top
computedTopValue() { computedTopValue() {
walk( walk(
this.root, this.root,
@ -94,7 +89,6 @@ class LogicalStructure extends Base {
} }
// 调整节点top // 调整节点top
adjustTopValue() { adjustTopValue() {
walk( walk(
this.root, this.root,
@ -118,7 +112,6 @@ class LogicalStructure extends Base {
} }
// 更新兄弟节点的top // 更新兄弟节点的top
updateBrothers(node, addHeight) { updateBrothers(node, addHeight) {
if (node.parent) { if (node.parent) {
let childrenList = node.parent.children let childrenList = node.parent.children
@ -150,7 +143,6 @@ class LogicalStructure extends Base {
} }
// 绘制连线,连接该节点到其子节点 // 绘制连线,连接该节点到其子节点
renderLine(node, lines, style, lineStyle) { renderLine(node, lines, style, lineStyle) {
if (lineStyle === 'curve') { if (lineStyle === 'curve') {
this.renderLineCurve(node, lines, style) this.renderLineCurve(node, lines, style)
@ -162,7 +154,6 @@ class LogicalStructure extends Base {
} }
// 直线风格连线 // 直线风格连线
renderLineStraight(node, lines, style) { renderLineStraight(node, lines, style) {
if (node.children.length <= 0) { if (node.children.length <= 0) {
return [] return []
@ -192,7 +183,6 @@ class LogicalStructure extends Base {
} }
// 直连风格 // 直连风格
renderLineDirect(node, lines, style) { renderLineDirect(node, lines, style) {
if (node.children.length <= 0) { if (node.children.length <= 0) {
return [] return []
@ -218,7 +208,6 @@ class LogicalStructure extends Base {
} }
// 曲线风格连线 // 曲线风格连线
renderLineCurve(node, lines, style) { renderLineCurve(node, lines, style) {
if (node.children.length <= 0) { if (node.children.length <= 0) {
return [] return []
@ -249,7 +238,6 @@ class LogicalStructure extends Base {
} }
// 渲染按钮 // 渲染按钮
renderExpandBtn(node, btn) { renderExpandBtn(node, btn) {
let { width, height } = node let { width, height } = node
let { translateX, translateY } = btn.transform() let { translateX, translateY } = btn.transform()
@ -264,7 +252,6 @@ class LogicalStructure extends Base {
} }
// 创建概要节点 // 创建概要节点
renderGeneralization(node, gLine, gNode) { renderGeneralization(node, gLine, gNode) {
let { let {
top, top,

View File

@ -2,7 +2,6 @@ import Base from './Base'
import { walk, asyncRun } from '../utils' import { walk, asyncRun } from '../utils'
// 思维导图 // 思维导图
class MindMap extends Base { class MindMap extends Base {
// 构造函数 // 构造函数
// 在逻辑结构图的基础上增加一个变量来记录生长方向向左还是向右同时在计算left的时候根据方向来计算、调整top时只考虑同方向的节点即可 // 在逻辑结构图的基础上增加一个变量来记录生长方向向左还是向右同时在计算left的时候根据方向来计算、调整top时只考虑同方向的节点即可
@ -11,7 +10,6 @@ class MindMap extends Base {
} }
// 布局 // 布局
doLayout(callback) { doLayout(callback) {
let task = [ let task = [
() => { () => {
@ -31,7 +29,6 @@ class MindMap extends Base {
} }
// 遍历数据计算节点的left、width、height // 遍历数据计算节点的left、width、height
computedBaseValue() { computedBaseValue() {
walk( walk(
this.renderer.renderTree, this.renderer.renderTree,
@ -96,7 +93,6 @@ class MindMap extends Base {
} }
// 遍历节点树计算节点的top // 遍历节点树计算节点的top
computedTopValue() { computedTopValue() {
walk( walk(
this.root, this.root,
@ -129,7 +125,6 @@ class MindMap extends Base {
} }
// 调整节点top // 调整节点top
adjustTopValue() { adjustTopValue() {
walk( walk(
this.root, this.root,
@ -152,7 +147,6 @@ class MindMap extends Base {
} }
// 更新兄弟节点的top // 更新兄弟节点的top
updateBrothers(node, leftAddHeight, rightAddHeight) { updateBrothers(node, leftAddHeight, rightAddHeight) {
if (node.parent) { if (node.parent) {
// 过滤出和自己同方向的节点 // 过滤出和自己同方向的节点
@ -188,7 +182,6 @@ class MindMap extends Base {
} }
// 绘制连线,连接该节点到其子节点 // 绘制连线,连接该节点到其子节点
renderLine(node, lines, style, lineStyle) { renderLine(node, lines, style, lineStyle) {
if (lineStyle === 'curve') { if (lineStyle === 'curve') {
this.renderLineCurve(node, lines, style) this.renderLineCurve(node, lines, style)
@ -200,7 +193,6 @@ class MindMap extends Base {
} }
// 直线风格连线 // 直线风格连线
renderLineStraight(node, lines, style) { renderLineStraight(node, lines, style) {
if (node.children.length <= 0) { if (node.children.length <= 0) {
return [] return []
@ -238,7 +230,6 @@ class MindMap extends Base {
} }
// 直连风格 // 直连风格
renderLineDirect(node, lines, style) { renderLineDirect(node, lines, style) {
if (node.children.length <= 0) { if (node.children.length <= 0) {
return [] return []
@ -273,7 +264,6 @@ class MindMap extends Base {
} }
// 曲线风格连线 // 曲线风格连线
renderLineCurve(node, lines, style) { renderLineCurve(node, lines, style) {
if (node.children.length <= 0) { if (node.children.length <= 0) {
return [] return []
@ -313,7 +303,6 @@ class MindMap extends Base {
} }
// 渲染按钮 // 渲染按钮
renderExpandBtn(node, btn) { renderExpandBtn(node, btn) {
let { width, height, expandBtnSize } = node let { width, height, expandBtnSize } = node
let { translateX, translateY } = btn.transform() let { translateX, translateY } = btn.transform()
@ -327,7 +316,6 @@ class MindMap extends Base {
} }
// 创建概要节点 // 创建概要节点
renderGeneralization(node, gLine, gNode) { renderGeneralization(node, gLine, gNode) {
let isLeft = node.dir === 'left' let isLeft = node.dir === 'left'
let { let {

View File

@ -5,13 +5,11 @@ import { walk, asyncRun } from '../utils'
// 和逻辑结构图基本一样只是方向变成向下生长所以先计算节点的top后计算节点的left、最后调整节点的left即可 // 和逻辑结构图基本一样只是方向变成向下生长所以先计算节点的top后计算节点的left、最后调整节点的left即可
class OrganizationStructure extends Base { class OrganizationStructure extends Base {
// 构造函数 // 构造函数
constructor(opt = {}) { constructor(opt = {}) {
super(opt) super(opt)
} }
// 布局 // 布局
doLayout(callback) { doLayout(callback) {
let task = [ let task = [
() => { () => {
@ -31,7 +29,6 @@ class OrganizationStructure extends Base {
} }
// 遍历数据计算节点的left、width、height // 遍历数据计算节点的left、width、height
computedBaseValue() { computedBaseValue() {
walk( walk(
this.renderer.renderTree, this.renderer.renderTree,
@ -67,7 +64,6 @@ class OrganizationStructure extends Base {
} }
// 遍历节点树计算节点的left // 遍历节点树计算节点的left
computedLeftValue() { computedLeftValue() {
walk( walk(
this.root, this.root,
@ -94,7 +90,6 @@ class OrganizationStructure extends Base {
} }
// 调整节点left // 调整节点left
adjustLeftValue() { adjustLeftValue() {
walk( walk(
this.root, this.root,
@ -118,7 +113,6 @@ class OrganizationStructure extends Base {
} }
// 更新兄弟节点的left // 更新兄弟节点的left
updateBrothers(node, addWidth) { updateBrothers(node, addWidth) {
if (node.parent) { if (node.parent) {
let childrenList = node.parent.children let childrenList = node.parent.children
@ -150,7 +144,6 @@ class OrganizationStructure extends Base {
} }
// 绘制连线,连接该节点到其子节点 // 绘制连线,连接该节点到其子节点
renderLine(node, lines, style, lineStyle) { renderLine(node, lines, style, lineStyle) {
if (lineStyle === 'direct') { if (lineStyle === 'direct') {
this.renderLineDirect(node, lines, style) this.renderLineDirect(node, lines, style)
@ -160,7 +153,6 @@ class OrganizationStructure extends Base {
} }
// 直连风格 // 直连风格
renderLineDirect(node, lines, style) { renderLineDirect(node, lines, style) {
if (node.children.length <= 0) { if (node.children.length <= 0) {
return [] return []
@ -182,7 +174,6 @@ class OrganizationStructure extends Base {
} }
// 直线风格连线 // 直线风格连线
renderLineStraight(node, lines, style) { renderLineStraight(node, lines, style) {
if (node.children.length <= 0) { if (node.children.length <= 0) {
return [] return []
@ -232,7 +223,6 @@ class OrganizationStructure extends Base {
} }
// 渲染按钮 // 渲染按钮
renderExpandBtn(node, btn) { renderExpandBtn(node, btn) {
let { width, height, expandBtnSize } = node let { width, height, expandBtnSize } = node
let { translateX, translateY } = btn.transform() let { translateX, translateY } = btn.transform()
@ -243,7 +233,6 @@ class OrganizationStructure extends Base {
} }
// 创建概要节点 // 创建概要节点
renderGeneralization(node, gLine, gNode) { renderGeneralization(node, gLine, gNode) {
let { let {
bottom, bottom,