Commit 5f62045e authored by 黄奎's avatar 黄奎

页面修改

parent b0192037
...@@ -93,7 +93,6 @@ const SeeksStoreManager = { ...@@ -93,7 +93,6 @@ const SeeksStoreManager = {
} }
} }
var _debug = userGraphSetting.debug !== true ? false : true var _debug = userGraphSetting.debug !== true ? false : true
if (_debug) console.log('user instance graphSetting:', userGraphSetting)
if (window) { if (window) {
window.SeeksGraphDebug = _debug window.SeeksGraphDebug = _debug
} }
...@@ -101,19 +100,15 @@ const SeeksStoreManager = { ...@@ -101,19 +100,15 @@ const SeeksStoreManager = {
Object.keys(userGraphSetting).forEach(key => { Object.keys(userGraphSetting).forEach(key => {
var _thisUserValue = userGraphSetting[key] var _thisUserValue = userGraphSetting[key]
if (typeof _thisUserValue === 'object') { if (typeof _thisUserValue === 'object') {
if (window.SeeksGraphDebug) console.log('user setting object:', key, _thisUserValue)
var _objectValue = _graphSetting[key] var _objectValue = _graphSetting[key]
if (_objectValue) { if (_objectValue) {
if (_objectValue && !Array.isArray(_objectValue) && _thisUserValue) { if (_objectValue && !Array.isArray(_objectValue) && _thisUserValue) {
Object.keys(_objectValue).forEach(l2Key => { Object.keys(_objectValue).forEach(l2Key => {
if (window.SeeksGraphDebug) console.log(' user setting:', key + '.' + l2Key, _thisUserValue[l2Key])
_objectValue[l2Key] = _thisUserValue[l2Key] _objectValue[l2Key] = _thisUserValue[l2Key]
}) })
} else if(Array.isArray(_objectValue)) { } else if(Array.isArray(_objectValue)) {
if (window.SeeksGraphDebug) console.log(' user setting array:', key, 'size:', _thisUserValue.length)
var _new_arr = [] var _new_arr = []
_thisUserValue.forEach(thisItem => { _thisUserValue.forEach(thisItem => {
if (window.SeeksGraphDebug) console.log(' user setting array:', key, 'push:', thisItem)
if (thisItem && typeof thisItem === 'object') { if (thisItem && typeof thisItem === 'object') {
_new_arr.push(JSON.parse(JSON.stringify(thisItem))) _new_arr.push(JSON.parse(JSON.stringify(thisItem)))
} else { } else {
...@@ -122,14 +117,12 @@ const SeeksStoreManager = { ...@@ -122,14 +117,12 @@ const SeeksStoreManager = {
}) })
_graphSetting[key] = _new_arr _graphSetting[key] = _new_arr
} else { } else {
if (window.SeeksGraphDebug) console.log('user setting value:', key)
_graphSetting[key] = _thisUserValue _graphSetting[key] = _thisUserValue
} }
} else { } else {
console.log('ignore option:', key)
} }
} else { } else {
if (window.SeeksGraphDebug) console.log('user setting:', key, _thisUserValue)
_graphSetting[key] = _thisUserValue _graphSetting[key] = _thisUserValue
} }
}) })
...@@ -213,7 +206,6 @@ const SeeksStoreManager = { ...@@ -213,7 +206,6 @@ const SeeksStoreManager = {
} }
}, },
createNewStore(userGraphSetting) { createNewStore(userGraphSetting) {
if (window.SeeksGraphDebug) console.log('Create new GraphSetting:')
var _graphSetting = SeeksStoreManager.createDefaultConfig(userGraphSetting) var _graphSetting = SeeksStoreManager.createDefaultConfig(userGraphSetting)
return new SeeksRGStore(_graphSetting) return new SeeksRGStore(_graphSetting)
} }
......
...@@ -13,7 +13,7 @@ function SeeksAutoLayouter(layoutSetting, graphSetting) { ...@@ -13,7 +13,7 @@ function SeeksAutoLayouter(layoutSetting, graphSetting) {
if (!rootNode) { if (!rootNode) {
return return
} else { } else {
if (window.SeeksGraphDebug) console.log('layout by root:', rootNode)
} }
this.__origin_nodes = allNodes this.__origin_nodes = allNodes
this.rootNode = rootNode this.rootNode = rootNode
...@@ -35,15 +35,12 @@ function SeeksAutoLayouter(layoutSetting, graphSetting) { ...@@ -35,15 +35,12 @@ function SeeksAutoLayouter(layoutSetting, graphSetting) {
max_length: 1 max_length: 1
} }
SeeksGraphMath.analysisNodes4Didirectional(this.allNodes, [this.rootNode], 0, analyticResult, 0) SeeksGraphMath.analysisNodes4Didirectional(this.allNodes, [this.rootNode], 0, analyticResult, 0)
if (window.SeeksGraphDebug) console.log('调整画布大小')
var __mapWidth = this.graphSetting.viewSize.width var __mapWidth = this.graphSetting.viewSize.width
var __mapHeight = this.graphSetting.viewSize.height var __mapHeight = this.graphSetting.viewSize.height
rootNode.lot.x = parseInt((__mapWidth - rootNode.el.offsetWidth) / 2) rootNode.lot.x = parseInt((__mapWidth - rootNode.el.offsetWidth) / 2)
rootNode.lot.y = parseInt((__mapHeight - rootNode.el.offsetHeight) / 2) rootNode.lot.y = parseInt((__mapHeight - rootNode.el.offsetHeight) / 2)
if (window.SeeksGraphDebug) console.log('[layout canvasOffset]', this.graphSetting.viewSize, this.graphSetting.canvasSize)
this.placeRelativePosition(this.rootNode) this.placeRelativePosition(this.rootNode)
this.allNodes.forEach(thisNode => { this.allNodes.forEach(thisNode => {
if (thisNode.fixed === true) return if (thisNode.fixed === true) return
...@@ -52,10 +49,7 @@ function SeeksAutoLayouter(layoutSetting, graphSetting) { ...@@ -52,10 +49,7 @@ function SeeksAutoLayouter(layoutSetting, graphSetting) {
thisNode.y = thisNode.lot.y thisNode.y = thisNode.lot.y
thisNode.lot.placed = true thisNode.lot.placed = true
}) })
if (window.SeeksGraphDebug) console.log('Start Auto Layout.....')
this.autoLayout(true) this.autoLayout(true)
} }
this.placeRelativePosition = function(rootNode) { this.placeRelativePosition = function(rootNode) {
var __level1_r = 80 var __level1_r = 80
...@@ -86,7 +80,7 @@ function SeeksAutoLayouter(layoutSetting, graphSetting) { ...@@ -86,7 +80,7 @@ function SeeksAutoLayouter(layoutSetting, graphSetting) {
if (forceLayout) { if (forceLayout) {
this.layoutTimes = 0 this.layoutTimes = 0
} }
if (window.SeeksGraphDebug) console.log('this.layoutTimes:', this.layoutTimes)
if (this.layoutTimes > 300) { if (this.layoutTimes > 300) {
this.graphSetting.autoLayouting = false this.graphSetting.autoLayouting = false
return return
......
...@@ -7,16 +7,12 @@ function SeeksCenterLayouter(layoutSetting, graphSetting) { ...@@ -7,16 +7,12 @@ function SeeksCenterLayouter(layoutSetting, graphSetting) {
this.allNodes = [] this.allNodes = []
this.__origin_nodes = [] this.__origin_nodes = []
this.refresh = function() { this.refresh = function() {
if (window.SeeksGraphDebug) console.log('SeeksCenterLayouter:refresh')
this.placeNodes(this.__origin_nodes, this.rootNode) this.placeNodes(this.__origin_nodes, this.rootNode)
} }
this.placeNodes = function(allNodes, rootNode) { this.placeNodes = function(allNodes, rootNode) {
if (window.SeeksGraphDebug) console.log('SeeksCenterLayouter:placeNodes')
if (!rootNode) { if (!rootNode) {
return return
} else { } else {
if (window.SeeksGraphDebug) console.log('layout by root:', rootNode)
} }
this.__origin_nodes = allNodes this.__origin_nodes = allNodes
this.rootNode = rootNode this.rootNode = rootNode
...@@ -38,9 +34,6 @@ function SeeksCenterLayouter(layoutSetting, graphSetting) { ...@@ -38,9 +34,6 @@ function SeeksCenterLayouter(layoutSetting, graphSetting) {
max_length: 1 max_length: 1
} }
SeeksGraphMath.analysisNodes4Didirectional(this.allNodes, [this.rootNode], 0, analyticResult, 0) SeeksGraphMath.analysisNodes4Didirectional(this.allNodes, [this.rootNode], 0, analyticResult, 0)
if (window.SeeksGraphDebug) console.log('调整画布大小')
var __mapWidth = this.graphSetting.viewSize.width var __mapWidth = this.graphSetting.viewSize.width
var __mapHeight = this.graphSetting.viewSize.height var __mapHeight = this.graphSetting.viewSize.height
rootNode.lot.x = parseInt((__mapWidth - rootNode.el.offsetWidth) / 2) rootNode.lot.x = parseInt((__mapWidth - rootNode.el.offsetWidth) / 2)
...@@ -61,7 +54,7 @@ function SeeksCenterLayouter(layoutSetting, graphSetting) { ...@@ -61,7 +54,7 @@ function SeeksCenterLayouter(layoutSetting, graphSetting) {
this.placeRelativePosition = function(rootNode, analyticResult) { this.placeRelativePosition = function(rootNode, analyticResult) {
var distance_coefficient = this.config.distance_coefficient === undefined ? 1 : this.config.distance_coefficient var distance_coefficient = this.config.distance_coefficient === undefined ? 1 : this.config.distance_coefficient
var __leve1_min_r = parseInt(((this.graphSetting.viewSize.height + this.graphSetting.viewSize.width) / analyticResult.max_deep * 0.2)) * distance_coefficient var __leve1_min_r = parseInt(((this.graphSetting.viewSize.height + this.graphSetting.viewSize.width) / analyticResult.max_deep * 0.2)) * distance_coefficient
if (window.SeeksGraphDebug) console.log('analyticResult:', analyticResult, __leve1_min_r, this.config.distance_coefficient)
if (__leve1_min_r < 150 * distance_coefficient) __leve1_min_r = 150 * distance_coefficient if (__leve1_min_r < 150 * distance_coefficient) __leve1_min_r = 150 * distance_coefficient
var __level1_r = 0 var __level1_r = 0
this.allNodes.forEach(thisNode => { this.allNodes.forEach(thisNode => {
......
...@@ -305,14 +305,12 @@ ...@@ -305,14 +305,12 @@
if (this.alive) { if (this.alive) {
var _box = this.$refs.seeksRelationGraph.getBoundingClientRect() var _box = this.$refs.seeksRelationGraph.getBoundingClientRect()
if (_box.width !== this.graphSetting.viewSize.width || _box.height !== this.graphSetting.viewSize.height) { if (_box.width !== this.graphSetting.viewSize.width || _box.height !== this.graphSetting.viewSize.height) {
if (window.SeeksGraphDebug) console.log('relation-graph:view-size-changed:', [this.graphSetting.viewSize.width, this.graphSetting.viewSize.height], [_box.width, _box.height])
this.graphSetting.viewSize.width = _box.width this.graphSetting.viewSize.width = _box.width
this.graphSetting.viewSize.height = _box.height this.graphSetting.viewSize.height = _box.height
this.resetViewSize() this.resetViewSize()
this.refreshNVAnalysisInfo() this.refreshNVAnalysisInfo()
this.wow() this.wow()
if (this.viewSizeIsInited && this.graphSetting.moveToCenterWhenResize) { if (this.viewSizeIsInited && this.graphSetting.moveToCenterWhenResize) {
if (window.SeeksGraphDebug) console.log('relation-graph:move to center:', [this.graphSetting.viewSize.width, this.graphSetting.viewSize.height], [_box.width, _box.height])
this.$nextTick(() => { this.$nextTick(() => {
var _min_x = 9999999 var _min_x = 9999999
...@@ -355,7 +353,6 @@ ...@@ -355,7 +353,6 @@
this.init() this.init()
if (this.graphSetting.layouts && this.graphSetting.layouts.length > 0) { if (this.graphSetting.layouts && this.graphSetting.layouts.length > 0) {
var _defaultLayoutSetting = this.graphSetting.layouts[0] var _defaultLayoutSetting = this.graphSetting.layouts[0]
if (window.SeeksGraphDebug) console.log('创建默认布局器:', this.graphSetting.layoutName)
if (_defaultLayoutSetting.layouter) { if (_defaultLayoutSetting.layouter) {
this.graphSetting.layouter = _defaultLayoutSetting.layouter this.graphSetting.layouter = _defaultLayoutSetting.layouter
} else { } else {
...@@ -407,23 +404,18 @@ ...@@ -407,23 +404,18 @@
x: e.offsetX, x: e.offsetX,
y: e.offsetY y: e.offsetY
} }
if (window.SeeksGraphDebug) console.log('[F]', userZoomCenter.x, userZoomCenter.y)
var currentNode = e.target.parentNode var currentNode = e.target.parentNode
for (var i = 0; i < 8; i++) { for (var i = 0; i < 8; i++) {
if (i > 6) { if (i > 6) {
if (window.SeeksGraphDebug) console.log('getPositionOfCanvas error', e)
} }
if (currentNode.classList.contains('rel-map-canvas')) { if (currentNode.classList.contains('rel-map-canvas')) {
if (window.SeeksGraphDebug) console.log('[S]', currentNode.tagName + '.' + currentNode.className)
break break
} else { } else {
userZoomCenter.x += currentNode.offsetLeft || 0 userZoomCenter.x += currentNode.offsetLeft || 0
userZoomCenter.y += currentNode.offsetTop || 0 userZoomCenter.y += currentNode.offsetTop || 0
if (window.SeeksGraphDebug) console.log('[' + i + ']', currentNode.tagName + '.' + currentNode.className, ':', currentNode.offsetLeft, currentNode.offsetTop)
currentNode = currentNode.parentNode currentNode = currentNode.parentNode
} }
} }
if (window.SeeksGraphDebug) console.log('[F]', userZoomCenter.x, userZoomCenter.y)
return userZoomCenter return userZoomCenter
}, },
zoom(buff, userZoomCenter) { zoom(buff, userZoomCenter) {
...@@ -563,11 +555,9 @@ ...@@ -563,11 +555,9 @@
return result return result
}, },
syncToolsPosition() { syncToolsPosition() {
if (window.SeeksGraphDebug) console.log('on scroll...')
if (!this.$refs.seeksRelationGraph) return if (!this.$refs.seeksRelationGraph) return
const windowHeight = this.getWindowHeight() const windowHeight = this.getWindowHeight()
var _box_info = this.$refs.seeksRelationGraph.getBoundingClientRect() var _box_info = this.$refs.seeksRelationGraph.getBoundingClientRect()
if (window.SeeksGraphDebug) console.log('syncToolsPosition...')
var __top = _box_info.top var __top = _box_info.top
if (this.isNeedFixedTools === false) { if (this.isNeedFixedTools === false) {
...@@ -760,7 +750,6 @@ ...@@ -760,7 +750,6 @@
this.flatNodeData(_orign_nodes, null, _nodes, _links) this.flatNodeData(_orign_nodes, null, _nodes, _links)
jsonData.links = _links.concat(jsonData.links) jsonData.links = _links.concat(jsonData.links)
this.loadNodes(_nodes) this.loadNodes(_nodes)
if (window.SeeksGraphDebug) console.log('节点预处理完毕')
this.loadLinks(jsonData.links) this.loadLinks(jsonData.links)
}, },
setJsonData(jsonData, callback) { setJsonData(jsonData, callback) {
...@@ -776,7 +765,6 @@ ...@@ -776,7 +765,6 @@
this.resetViewSize() this.resetViewSize()
if (this.graphSetting.layouts && this.graphSetting.layouts.length > 0) { if (this.graphSetting.layouts && this.graphSetting.layouts.length > 0) {
var _defaultLayoutSetting = this.graphSetting.layouts[0] var _defaultLayoutSetting = this.graphSetting.layouts[0]
if (window.SeeksGraphDebug) console.log('创建默认布局器:', this.graphSetting.layoutName)
if (_defaultLayoutSetting.layouter) { if (_defaultLayoutSetting.layouter) {
this.graphSetting.layouter = _defaultLayoutSetting.layouter this.graphSetting.layouter = _defaultLayoutSetting.layouter
} else { } else {
...@@ -853,11 +841,9 @@ ...@@ -853,11 +841,9 @@
this.refreshNVAnalysisInfo() this.refreshNVAnalysisInfo()
}, },
addEventClick() { addEventClick() {
}, },
wow() { wow() {
if (window.SeeksGraphDebug) console.log('wow.....')
this.graphSetting.canvasOffset.x = this.graphSetting.canvasOffset.x + 1 this.graphSetting.canvasOffset.x = this.graphSetting.canvasOffset.x + 1
this.graphSetting.canvasOffset.y = this.graphSetting.canvasOffset.y + 1 this.graphSetting.canvasOffset.y = this.graphSetting.canvasOffset.y + 1
this.graphSetting.canvasOffset.x = this.graphSetting.canvasOffset.x - 1 this.graphSetting.canvasOffset.x = this.graphSetting.canvasOffset.x - 1
...@@ -874,12 +860,6 @@ ...@@ -874,12 +860,6 @@
if (this.onLineClick) { if (this.onLineClick) {
this.onLineClick(lineData, e) this.onLineClick(lineData, e)
} }
// for (let i = 0; i < this.lineViewList.length; i++) {
// var thisLine = this.lineViewList[i]
// if (thisLine.fromNode.id === nodeData.id || thisLine.toNode.id === nodeData.id) {
// thisLine.flash = thisLine.flash + 1
// }
// }
}, },
getNodeById(nodeId) { getNodeById(nodeId) {
for (let i = 0; i < this.nodeViewList.length; i++) { for (let i = 0; i < this.nodeViewList.length; i++) {
...@@ -1068,7 +1048,6 @@ ...@@ -1068,7 +1048,6 @@
callback(rst) callback(rst)
}, },
focusRootNode() { focusRootNode() {
if (window.SeeksGraphDebug) console.log('relation-graph:focusRootNode')
this.handleSelect(this.graphData.rootNode) this.handleSelect(this.graphData.rootNode)
}, },
focusNodeById(nodeId) { focusNodeById(nodeId) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment