Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
smart
Project
Project
Details
Activity
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
wangqinghua
smart
Commits
3d090a41
Commit
3d090a41
authored
Jun 19, 2019
by
wangqinghua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style update
parent
57a67aa7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
37 deletions
+42
-37
jtopo-editor.js
src/main/webapp/content/javascript/jtopo/js/jtopo-editor.js
+42
-37
No files found.
src/main/webapp/content/javascript/jtopo/js/jtopo-editor.js
View file @
3d090a41
...
...
@@ -47,32 +47,32 @@ TopologyPanel.prototype.resetTopology = function (url) {
* @param backImg 拓扑图的背景图片
*/
TopologyPanel
.
prototype
.
loadTopology
=
function
(
response
,
topologyGuid
,
backImg
,
canvasWidth
,
canvasHeight
)
{
// 错误处理
if
(
!
response
)
{
// 拓扑不存在,创建一个空白的拓扑图
var
initTopologyJson
=
{
'version'
:
'0.4.8'
,
'wheelZoom'
:
0.95
,
'width'
:
972
,
'height'
:
569
,
'id'
:
'ST172.19.105.52015100809430700001'
,
'childs'
:
[
{
'elementType'
:
'scene'
,
'id'
:
'S172.19.105.52015100809430700002'
,
'translateX'
:
-
121.82
,
'translateY'
:
306.72
,
'scaleX'
:
1.26
,
'scaleY'
:
1.26
,
'childs'
:
[]
}
]
// 错误处理
if
(
!
response
)
{
// 拓扑不存在,创建一个空白的拓扑图
var
initTopologyJson
=
{
'version'
:
'0.4.8'
,
'wheelZoom'
:
0.95
,
'width'
:
972
,
'height'
:
569
,
'id'
:
'ST172.19.105.52015100809430700001'
,
'childs'
:
[
{
'elementType'
:
'scene'
,
'id'
:
'S172.19.105.52015100809430700002'
,
'translateX'
:
-
121.82
,
'translateY'
:
306.72
,
'scaleX'
:
1.26
,
'scaleY'
:
1.26
,
'childs'
:
[]
}
editor
.
init
(
topologyGuid
,
backImg
,
initTopologyJson
,
canvasWidth
,
canvasHeight
)
}
else
{
// 拓扑存在,渲染拓扑图
editor
.
init
(
topologyGuid
,
backImg
,
response
,
canvasWidth
,
canvasHeight
)
}
]
}
editor
.
init
(
topologyGuid
,
backImg
,
initTopologyJson
,
canvasWidth
,
canvasHeight
)
}
else
{
// 拓扑存在,渲染拓扑图
editor
.
init
(
topologyGuid
,
backImg
,
response
,
canvasWidth
,
canvasHeight
)
}
}
/**
...
...
@@ -550,22 +550,26 @@ TopologyEditor.prototype.init = function (topologyGuid, backImg, topologyJson,ca
// 鼠标进入事件
this
.
scene
.
mouseover
(
function
(
event
)
{
console
.
log
(
event
.
target
)
Timer
.
start
()
// 进入某个节点
if
(
event
.
target
!=
null
&&
event
.
target
instanceof
JTopo
.
Node
&&
event
.
target
.
nodeTooltip
&&
editor
.
stageMode
!==
'edit'
)
{
$
(
'.node-tooltip span'
).
html
(
event
.
target
.
nodeTooltip
)
if
(
event
.
target
!=
null
&&
event
.
target
instanceof
JTopo
.
Node
&&
event
.
target
.
description
&&
editor
.
stageMode
!==
'edit'
)
{
console
.
log
(
'scene.mouseover.target'
)
$
(
'.node-infobox span'
).
html
(
event
.
target
.
description
);
// 记录鼠标触发位置在canvas中的相对位置
var
menuY
=
event
.
layerY
?
event
.
layerY
:
event
.
offsetY
var
menuX
=
event
.
layerX
?
event
.
layerX
:
event
.
offsetX
// 判断边界出是否能完整显示弹出菜单
if
(
menuX
+
$
(
'.node-
tooltip
'
).
width
()
>=
self
.
stage
.
width
)
{
menuX
-=
$
(
'.node-
tooltip
'
).
width
()
if
(
menuX
+
$
(
'.node-
infobox
'
).
width
()
>=
self
.
stage
.
width
)
{
menuX
-=
$
(
'.node-
infobox
'
).
width
()
}
if
(
menuY
+
$
(
'.node-
tooltip
'
).
height
()
>=
self
.
stage
.
height
)
{
menuY
-=
$
(
'.node-
tooltip
'
).
height
()
if
(
menuY
+
$
(
'.node-
infobox
'
).
height
()
>=
self
.
stage
.
height
)
{
menuY
-=
$
(
'.node-
infobox
'
).
height
()
}
$
(
'.link-tooltip'
).
css
(
'display'
,
'none'
)
$
(
'.node-
tooltip
'
).
css
({
$
(
'.link-tooltip'
).
css
(
'display'
,
'none'
)
;
$
(
'.node-
infobox
'
).
css
({
'display'
:
'block'
,
'margin-top'
:
menuY
,
'margin-left'
:
menuX
,
...
...
@@ -592,6 +596,7 @@ TopologyEditor.prototype.init = function (topologyGuid, backImg, topologyJson,ca
'cursor'
:
'pointer'
})
}
else
{
$
(
'.node-infobox'
).
css
(
'display'
,
'none'
)
// 鼠标进入别的地方
}
})
...
...
@@ -1381,14 +1386,14 @@ editor.utils = {
},
// 查找节点,便居中闪动显示
findNodeAndFlash
:
function
(
text
)
{
if
(
!
text
)
return
if
(
!
text
)
return
;
// var self = this
text
=
text
.
trim
()
text
=
text
.
trim
()
;
var
nodes
=
editor
.
stage
.
find
(
'node[text="'
+
text
+
'"]'
)
if
(
nodes
.
length
>
0
)
{
var
node
=
nodes
[
0
]
var
node
=
nodes
[
0
]
;
this
.
unSelectAllNodeExcept
(
node
)
node
.
selected
=
true
node
.
selected
=
true
;
var
location
=
node
.
getCenterLocation
()
// 查询到的节点居中显示
editor
.
stage
.
setCenter
(
location
.
x
,
location
.
y
)
...
...
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