Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
confucius
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
罗超
confucius
Commits
5f62045e
Commit
5f62045e
authored
Apr 14, 2021
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
b0192037
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
47 deletions
+5
-47
SeeksRGStore.js
src/components/relation/core4vue/SeeksRGStore.js
+1
-9
SeeksAutoLayouter.js
...mponents/relation/core4vue/layouters/SeeksAutoLayouter.js
+2
-8
SeeksCenterLayouter.js
...onents/relation/core4vue/layouters/SeeksCenterLayouter.js
+1
-8
index.vue
src/components/relation/index.vue
+1
-22
No files found.
src/components/relation/core4vue/SeeksRGStore.js
View file @
5f62045e
...
...
@@ -93,7 +93,6 @@ const SeeksStoreManager = {
}
}
var
_debug
=
userGraphSetting
.
debug
!==
true
?
false
:
true
if
(
_debug
)
console
.
log
(
'user instance graphSetting:'
,
userGraphSetting
)
if
(
window
)
{
window
.
SeeksGraphDebug
=
_debug
}
...
...
@@ -101,19 +100,15 @@ const SeeksStoreManager = {
Object
.
keys
(
userGraphSetting
).
forEach
(
key
=>
{
var
_thisUserValue
=
userGraphSetting
[
key
]
if
(
typeof
_thisUserValue
===
'object'
)
{
if
(
window
.
SeeksGraphDebug
)
console
.
log
(
'user setting object:'
,
key
,
_thisUserValue
)
var
_objectValue
=
_graphSetting
[
key
]
if
(
_objectValue
)
{
if
(
_objectValue
&&
!
Array
.
isArray
(
_objectValue
)
&&
_thisUserValue
)
{
Object
.
keys
(
_objectValue
).
forEach
(
l2Key
=>
{
if
(
window
.
SeeksGraphDebug
)
console
.
log
(
' user setting:'
,
key
+
'.'
+
l2Key
,
_thisUserValue
[
l2Key
])
_objectValue
[
l2Key
]
=
_thisUserValue
[
l2Key
]
})
}
else
if
(
Array
.
isArray
(
_objectValue
))
{
if
(
window
.
SeeksGraphDebug
)
console
.
log
(
' user setting array:'
,
key
,
'size:'
,
_thisUserValue
.
length
)
var
_new_arr
=
[]
_thisUserValue
.
forEach
(
thisItem
=>
{
if
(
window
.
SeeksGraphDebug
)
console
.
log
(
' user setting array:'
,
key
,
'push:'
,
thisItem
)
if
(
thisItem
&&
typeof
thisItem
===
'object'
)
{
_new_arr
.
push
(
JSON
.
parse
(
JSON
.
stringify
(
thisItem
)))
}
else
{
...
...
@@ -122,14 +117,12 @@ const SeeksStoreManager = {
})
_graphSetting
[
key
]
=
_new_arr
}
else
{
if
(
window
.
SeeksGraphDebug
)
console
.
log
(
'user setting value:'
,
key
)
_graphSetting
[
key
]
=
_thisUserValue
}
}
else
{
console
.
log
(
'ignore option:'
,
key
)
}
}
else
{
if
(
window
.
SeeksGraphDebug
)
console
.
log
(
'user setting:'
,
key
,
_thisUserValue
)
_graphSetting
[
key
]
=
_thisUserValue
}
})
...
...
@@ -213,7 +206,6 @@ const SeeksStoreManager = {
}
},
createNewStore
(
userGraphSetting
)
{
if
(
window
.
SeeksGraphDebug
)
console
.
log
(
'Create new GraphSetting:'
)
var
_graphSetting
=
SeeksStoreManager
.
createDefaultConfig
(
userGraphSetting
)
return
new
SeeksRGStore
(
_graphSetting
)
}
...
...
src/components/relation/core4vue/layouters/SeeksAutoLayouter.js
View file @
5f62045e
...
...
@@ -13,7 +13,7 @@ function SeeksAutoLayouter(layoutSetting, graphSetting) {
if
(
!
rootNode
)
{
return
}
else
{
if
(
window
.
SeeksGraphDebug
)
console
.
log
(
'layout by root:'
,
rootNode
)
}
this
.
__origin_nodes
=
allNodes
this
.
rootNode
=
rootNode
...
...
@@ -35,15 +35,12 @@ function SeeksAutoLayouter(layoutSetting, graphSetting) {
max_length
:
1
}
SeeksGraphMath
.
analysisNodes4Didirectional
(
this
.
allNodes
,
[
this
.
rootNode
],
0
,
analyticResult
,
0
)
if
(
window
.
SeeksGraphDebug
)
console
.
log
(
'调整画布大小'
)
var
__mapWidth
=
this
.
graphSetting
.
viewSize
.
width
var
__mapHeight
=
this
.
graphSetting
.
viewSize
.
height
rootNode
.
lot
.
x
=
parseInt
((
__mapWidth
-
rootNode
.
el
.
offsetWidth
)
/
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
.
allNodes
.
forEach
(
thisNode
=>
{
if
(
thisNode
.
fixed
===
true
)
return
...
...
@@ -52,10 +49,7 @@ function SeeksAutoLayouter(layoutSetting, graphSetting) {
thisNode
.
y
=
thisNode
.
lot
.
y
thisNode
.
lot
.
placed
=
true
})
if
(
window
.
SeeksGraphDebug
)
console
.
log
(
'Start Auto Layout.....'
)
this
.
autoLayout
(
true
)
}
this
.
placeRelativePosition
=
function
(
rootNode
)
{
var
__level1_r
=
80
...
...
@@ -86,7 +80,7 @@ function SeeksAutoLayouter(layoutSetting, graphSetting) {
if
(
forceLayout
)
{
this
.
layoutTimes
=
0
}
if
(
window
.
SeeksGraphDebug
)
console
.
log
(
'this.layoutTimes:'
,
this
.
layoutTimes
)
if
(
this
.
layoutTimes
>
300
)
{
this
.
graphSetting
.
autoLayouting
=
false
return
...
...
src/components/relation/core4vue/layouters/SeeksCenterLayouter.js
View file @
5f62045e
...
...
@@ -7,16 +7,12 @@ function SeeksCenterLayouter(layoutSetting, graphSetting) {
this
.
allNodes
=
[]
this
.
__origin_nodes
=
[]
this
.
refresh
=
function
()
{
if
(
window
.
SeeksGraphDebug
)
console
.
log
(
'SeeksCenterLayouter:refresh'
)
this
.
placeNodes
(
this
.
__origin_nodes
,
this
.
rootNode
)
}
this
.
placeNodes
=
function
(
allNodes
,
rootNode
)
{
if
(
window
.
SeeksGraphDebug
)
console
.
log
(
'SeeksCenterLayouter:placeNodes'
)
if
(
!
rootNode
)
{
return
}
else
{
if
(
window
.
SeeksGraphDebug
)
console
.
log
(
'layout by root:'
,
rootNode
)
}
this
.
__origin_nodes
=
allNodes
this
.
rootNode
=
rootNode
...
...
@@ -38,9 +34,6 @@ function SeeksCenterLayouter(layoutSetting, graphSetting) {
max_length
:
1
}
SeeksGraphMath
.
analysisNodes4Didirectional
(
this
.
allNodes
,
[
this
.
rootNode
],
0
,
analyticResult
,
0
)
if
(
window
.
SeeksGraphDebug
)
console
.
log
(
'调整画布大小'
)
var
__mapWidth
=
this
.
graphSetting
.
viewSize
.
width
var
__mapHeight
=
this
.
graphSetting
.
viewSize
.
height
rootNode
.
lot
.
x
=
parseInt
((
__mapWidth
-
rootNode
.
el
.
offsetWidth
)
/
2
)
...
...
@@ -61,7 +54,7 @@ function SeeksCenterLayouter(layoutSetting, graphSetting) {
this
.
placeRelativePosition
=
function
(
rootNode
,
analyticResult
)
{
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
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
var
__level1_r
=
0
this
.
allNodes
.
forEach
(
thisNode
=>
{
...
...
src/components/relation/index.vue
View file @
5f62045e
...
...
@@ -305,14 +305,12 @@
if
(
this
.
alive
)
{
var
_box
=
this
.
$refs
.
seeksRelationGraph
.
getBoundingClientRect
()
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
.
height
=
_box
.
height
this
.
resetViewSize
()
this
.
refreshNVAnalysisInfo
()
this
.
wow
()
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
(()
=>
{
var
_min_x
=
9999999
...
...
@@ -355,7 +353,6 @@
this
.
init
()
if
(
this
.
graphSetting
.
layouts
&&
this
.
graphSetting
.
layouts
.
length
>
0
)
{
var
_defaultLayoutSetting
=
this
.
graphSetting
.
layouts
[
0
]
if
(
window
.
SeeksGraphDebug
)
console
.
log
(
'创建默认布局器:'
,
this
.
graphSetting
.
layoutName
)
if
(
_defaultLayoutSetting
.
layouter
)
{
this
.
graphSetting
.
layouter
=
_defaultLayoutSetting
.
layouter
}
else
{
...
...
@@ -407,23 +404,18 @@
x
:
e
.
offsetX
,
y
:
e
.
offsetY
}
if
(
window
.
SeeksGraphDebug
)
console
.
log
(
'[F]'
,
userZoomCenter
.
x
,
userZoomCenter
.
y
)
var
currentNode
=
e
.
target
.
parentNode
for
(
var
i
=
0
;
i
<
8
;
i
++
)
{
if
(
i
>
6
)
{
if
(
window
.
SeeksGraphDebug
)
console
.
log
(
'getPositionOfCanvas error'
,
e
)
}
if
(
currentNode
.
classList
.
contains
(
'rel-map-canvas'
))
{
if
(
window
.
SeeksGraphDebug
)
console
.
log
(
'[S]'
,
currentNode
.
tagName
+
'.'
+
currentNode
.
className
)
break
}
else
{
userZoomCenter
.
x
+=
currentNode
.
offsetLeft
||
0
userZoomCenter
.
y
+=
currentNode
.
offsetTop
||
0
if
(
window
.
SeeksGraphDebug
)
console
.
log
(
'['
+
i
+
']'
,
currentNode
.
tagName
+
'.'
+
currentNode
.
className
,
':'
,
currentNode
.
offsetLeft
,
currentNode
.
offsetTop
)
currentNode
=
currentNode
.
parentNode
}
}
if
(
window
.
SeeksGraphDebug
)
console
.
log
(
'[F]'
,
userZoomCenter
.
x
,
userZoomCenter
.
y
)
return
userZoomCenter
},
zoom
(
buff
,
userZoomCenter
)
{
...
...
@@ -563,11 +555,9 @@
return
result
},
syncToolsPosition
()
{
if
(
window
.
SeeksGraphDebug
)
console
.
log
(
'on scroll...'
)
if
(
!
this
.
$refs
.
seeksRelationGraph
)
return
const
windowHeight
=
this
.
getWindowHeight
()
var
_box_info
=
this
.
$refs
.
seeksRelationGraph
.
getBoundingClientRect
()
if
(
window
.
SeeksGraphDebug
)
console
.
log
(
'syncToolsPosition...'
)
var
__top
=
_box_info
.
top
if
(
this
.
isNeedFixedTools
===
false
)
{
...
...
@@ -760,7 +750,6 @@
this
.
flatNodeData
(
_orign_nodes
,
null
,
_nodes
,
_links
)
jsonData
.
links
=
_links
.
concat
(
jsonData
.
links
)
this
.
loadNodes
(
_nodes
)
if
(
window
.
SeeksGraphDebug
)
console
.
log
(
'节点预处理完毕'
)
this
.
loadLinks
(
jsonData
.
links
)
},
setJsonData
(
jsonData
,
callback
)
{
...
...
@@ -776,7 +765,6 @@
this
.
resetViewSize
()
if
(
this
.
graphSetting
.
layouts
&&
this
.
graphSetting
.
layouts
.
length
>
0
)
{
var
_defaultLayoutSetting
=
this
.
graphSetting
.
layouts
[
0
]
if
(
window
.
SeeksGraphDebug
)
console
.
log
(
'创建默认布局器:'
,
this
.
graphSetting
.
layoutName
)
if
(
_defaultLayoutSetting
.
layouter
)
{
this
.
graphSetting
.
layouter
=
_defaultLayoutSetting
.
layouter
}
else
{
...
...
@@ -853,11 +841,9 @@
this
.
refreshNVAnalysisInfo
()
},
addEventClick
()
{
},
wow
()
{
if
(
window
.
SeeksGraphDebug
)
console
.
log
(
'wow.....'
)
this
.
graphSetting
.
canvasOffset
.
x
=
this
.
graphSetting
.
canvasOffset
.
x
+
1
this
.
graphSetting
.
canvasOffset
.
y
=
this
.
graphSetting
.
canvasOffset
.
y
+
1
this
.
graphSetting
.
canvasOffset
.
x
=
this
.
graphSetting
.
canvasOffset
.
x
-
1
...
...
@@ -874,12 +860,6 @@
if
(
this
.
onLineClick
)
{
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
)
{
for
(
let
i
=
0
;
i
<
this
.
nodeViewList
.
length
;
i
++
)
{
...
...
@@ -1068,7 +1048,6 @@
callback
(
rst
)
},
focusRootNode
()
{
if
(
window
.
SeeksGraphDebug
)
console
.
log
(
'relation-graph:focusRootNode'
)
this
.
handleSelect
(
this
.
graphData
.
rootNode
)
},
focusNodeById
(
nodeId
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment