Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
liangzhen
/
framework-tools-web
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit d92061af
authored
Jan 23, 2024
by
liuyong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改画布
1 parent
c725af75
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
131 additions
and
13 deletions
public/drawio/extention/js/exApp.js
public/drawio/extention/js/exApp.js
View file @
d92061a
...
...
@@ -2,7 +2,7 @@ const initDrawioGraph = function(that) {//一进入画布显示的图形
if
(
urlParams
[
'id'
]
==
2
)
{
var
mockFile
=
loadDiagram
(
urlParams
[
'id'
],
'业务架构资产管理'
);
const
file
=
new
LocalFile
(
that
,
mockFile
.
data
,
mockFile
.
title
,
that
.
mode
);
that
.
loadFile
(
`-2`
,
true
,
file
);
}
else
{
const
xmlData
=
localStorage
.
getItem
(
'xmlData'
);
...
...
@@ -145,16 +145,133 @@ const setGraphDefault = function(that) {
//设置画布只能预览
const
setGraphOnlyView
=
function
(
graph
)
{
graph
.
setEnabled
(
false
);
graph
.
setCellsEditable
(
false
);
graph
.
setTooltips
(
false
);
graph
.
setCellsSelectable
(
false
);
graph
.
setConnectable
(
false
);
graph
.
setCellsMovable
(
false
);
graph
.
getCursorForCell
=
function
(
cell
){
//预览时鼠标悬浮到节点时,改变鼠标样式
if
(
cell
!=
null
&&
cell
.
value
!=
null
&&
cell
.
vertex
==
1
)
{
return
'pointer'
;
}
};
// graph.selectAll(null, true);
// graph.getModel().beginUpdate();
// var cells = graph.getSelectionCells();
// var style = graph.getCurrentCellStyle(graph.getSelectionCell());
// var value = (mxUtils.getValue(style, mxConstants.STYLE_EDITABLE, 1)) == 1 ? 0 : 1;
// graph.setCellStyles(mxConstants.STYLE_MOVABLE, value, cells);
// graph.setCellStyles(mxConstants.STYLE_RESIZABLE, value, cells);
// graph.setCellStyles(mxConstants.STYLE_ROTATABLE, value, cells);
// graph.setCellStyles(mxConstants.STYLE_DELETABLE, value, cells);
// graph.setCellStyles(mxConstants.STYLE_EDITABLE, value, cells);
// graph.setCellStyles('locked', 1, cells);
// graph.setCellStyles('connectable', value, cells);
// graph.getModel().endUpdate();
// graph.setEnabled(false);
// graph.setCellsEditable(false);
// graph.setTooltips(false);
// graph.setCellsSelectable(false);
// graph.setConnectable(false);
// graph.setCellsMovable(false);
// graph.getCursorForCell = function(cell){//预览时鼠标悬浮到节点时,改变鼠标样式
// if (cell != null && cell.value != null && cell.vertex ==1 )
// {
// return 'pointer';
// }
// };
}
var
exToolbar
=
function
(
toolbarContainer
)
{
//版本发布按钮
this
.
toggleElement
=
document
.
createElement
(
'a'
);
this
.
toggleElement
.
setAttribute
(
'title'
,
'版本发布'
);
this
.
toggleElement
.
style
.
position
=
'absolute'
;
this
.
toggleElement
.
style
.
display
=
'inline-block'
;
this
.
toggleElement
.
style
.
width
=
'100px'
;
this
.
toggleElement
.
style
.
height
=
'16px'
;
this
.
toggleElement
.
style
.
color
=
'#666'
;
this
.
toggleElement
.
style
.
top
=
'6px'
;
this
.
toggleElement
.
style
.
right
=
'10px'
;
this
.
toggleElement
.
style
.
padding
=
'2px'
;
this
.
toggleElement
.
style
.
fontSize
=
'14px'
;
this
.
toggleElement
.
style
.
textDecoration
=
'none'
;
this
.
toggleElement
.
text
=
'版本发布'
;
this
.
toggleElement
.
style
.
marginRight
=
'100px'
;
this
.
toggleElement
.
style
.
cursor
=
'pointer'
;
this
.
toggleElement
.
style
.
color
=
'rgb(13,134,127)'
;
this
.
toggleElement
.
style
.
backgroundPosition
=
'50% 50%'
;
this
.
toggleElement
.
style
.
backgroundRepeat
=
'no-repeat'
;
// Prevents focus
mxEvent
.
addListener
(
this
.
toggleElement
,
(
mxClient
.
IS_POINTER
)
?
'pointerdown'
:
'mousedown'
,
mxUtils
.
bind
(
this
,
function
(
evt
)
{
evt
.
preventDefault
();
}));
// Toggles compact mode
mxEvent
.
addListener
(
this
.
toggleElement
,
'click'
,
mxUtils
.
bind
(
this
,
function
(
evt
)
{
window
.
parent
.
postMessage
({
type
:
'saveVersion'
},
'*'
);
}));
if
(
Editor
.
currentTheme
!=
'atlas'
)
{
toolbarContainer
.
appendChild
(
this
.
toggleElement
);
}
// Enable compact mode for small screens except for Firefox where the height is wrong
if
(
!
mxClient
.
IS_FF
&&
screen
.
height
<=
740
&&
typeof
this
.
toggleElement
.
click
!==
'undefined'
)
{
window
.
setTimeout
(
mxUtils
.
bind
(
this
,
function
()
{
this
.
toggleElement
.
click
();
}),
0
);
}
}
var
backGraph
=
function
(
that
,
toolbarContainer
)
{
//返回上级图形按钮
this
.
toggleElement
=
document
.
createElement
(
'a'
);
this
.
toggleElement
.
setAttribute
(
'title'
,
'返回上级图形'
);
this
.
toggleElement
.
style
.
position
=
'absolute'
;
this
.
toggleElement
.
style
.
display
=
'inline-block'
;
this
.
toggleElement
.
style
.
width
=
'100px'
;
this
.
toggleElement
.
style
.
height
=
'16px'
;
this
.
toggleElement
.
style
.
color
=
'#666'
;
this
.
toggleElement
.
style
.
top
=
'6px'
;
this
.
toggleElement
.
style
.
right
=
'150px'
;
this
.
toggleElement
.
style
.
padding
=
'2px'
;
this
.
toggleElement
.
style
.
fontSize
=
'14px'
;
this
.
toggleElement
.
style
.
textDecoration
=
'none'
;
this
.
toggleElement
.
text
=
'返回上级图形'
;
this
.
toggleElement
.
style
.
marginRight
=
'100px'
;
this
.
toggleElement
.
style
.
cursor
=
'pointer'
;
this
.
toggleElement
.
style
.
color
=
'rgb(13,134,127)'
;
this
.
toggleElement
.
style
.
backgroundPosition
=
'50% 50%'
;
this
.
toggleElement
.
style
.
backgroundRepeat
=
'no-repeat'
;
// Toggles compact mode
mxEvent
.
addListener
(
this
.
toggleElement
,
'click'
,
mxUtils
.
bind
(
this
,
function
(
evt
)
{
console
.
log
(
'上级图形'
)
// const mockFile = {
// data: `<mxGraphModel dx="1273" dy="619" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
// <root>
// <mxCell id="0"/>
// <mxCell id="1" parent="0"/>
// <mxCell id="NuJ1xgI3z5VlG4THHdq2-1" value="" style="rounded=1;whiteSpace=wrap;html=1;container=1;collapsible=0;;fillColor=#4CD964;attr=[];eleId=5;eaLevel=1;" vertex="1" parent="1">
// <mxGeometry x="110" y="130" width="170" height="85" as="geometry"/>
// </mxCell>
// <mxCell id="NuJ1xgI3z5VlG4THHdq2-2" value="" style="rounded=1;whiteSpace=wrap;html=1;container=1;collapsible=0;;fillColor=#4CD964;attr=[];eleId=5;eaLevel=1;" vertex="1" parent="NuJ1xgI3z5VlG4THHdq2-1">
// <mxGeometry x="20" y="10" width="150" height="75" as="geometry"/>
// </mxCell>
// </root>
// </mxGraphModel>`,
// title: '原始数据'
// };
// that.editor.setStatus('');
// that.fileLoaded(null);
// that.spinner.stop();
// const file = new LocalFile(that, mockFile.data, mockFile.title, null);
// that.loadFile(`-3`, true, file);
}));
if
(
Editor
.
currentTheme
!=
'atlas'
)
{
toolbarContainer
.
appendChild
(
this
.
toggleElement
);
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
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 post a comment