js画图开发库--mxgraph--[toolbar-工具栏.html]
<!Doctype html> <html xmlns=http://www.w3.org/1999/xhtml> <head> <meta http-equiv=Content-Type content="text/html;charset=utf-8"> <title>工具栏</title> <!-- 如果本文件的包与src不是在同一个目录,就要将basepath设置到src目录下 --> <script type="text/javascript"> mxBasePath = '../src'; </script> <!-- 引入支持库文件 --> <script type="text/javascript" src="../src/js/mxClient.js"></script> <!-- 示例代码 --> <script type="text/javascript"> // 程序在此方法中启动 function main() { //定义新连接的图标 mxConnectionHandler.prototype.connectImage = new mxImage('images/connector.gif', 16, 16); // 检测浏览器兼容性 if (!mxClient.isBrowserSupported()) { mxUtils.error('Browser is not supported!', 200, false); } else { // 创建工具栏容器 var tbContainer = document.createElement('div'); tbContainer.style.position = 'absolute'; tbContainer.style.overflow = 'hidden'; tbContainer.style.padding = '2px'; tbContainer.style.left = '0px'; tbContainer.style.top = '26px'; tbContainer.style.width = '24px'; tbContainer.style.bottom = '0px'; document.body.appendChild(tbContainer); // 创建工具栏监听工具 var toolbar = new mxToolbar(tbContainer); toolbar.enabled = false // 在图形中创建容器 container = document.createElement('div'); container.style.position = 'absolute'; container.style.overflow = 'hidden'; container.style.left = '24px'; container.style.top = '26px'; container.style.right = '0px'; container.style.bottom = '0px'; container.style.background = 'url("editors/images/grid.gif")'; document.body.appendChild(container); // 解决IE浏览器忽略的样式 if (mxClient.IS_QUIRKS) { document.body.style.overflow = 'hidden'; new mxDivResizer(tbContainer); new mxDivResizer(container); } // 在容器中创建图形和模型 var model = new mxGraphModel(); var graph = new mxGraph(container, model); //在图中,启用新的连接 graph.setConnectable(true); graph.setMultigraph(false); // 按下回车和空格键停止编辑 var keyHandler = new mxKeyHandler(graph); var rubberband = new mxRubberband(graph); var addVertex = function(icon, w, h, style) { var vertex = new mxCell(null, new mxGeometry(0, 0, w, h), style); vertex.setVertex(true); addToolbarItem(graph, toolbar, vertex, icon); }; addVertex('editors/images/rectangle.gif', 100, 40, ''); addVertex('editors/images/rounded.gif', 100, 40, 'shape=rounded'); addVertex('editors/images/ellipse.gif', 40, 40, 'shape=ellipse'); addVertex('editors/images/rhombus.gif', 40, 40, 'shape=rhombus'); addVertex('editors/images/triangle.gif', 40, 40, 'shape=triangle'); addVertex('editors/images/cylinder.gif', 40, 40, 'shape=cylinder'); addVertex('editors/images/actor.gif', 30, 40, 'shape=actor'); toolbar.addLine(); var button = mxUtils.button('Create toolbar entry from selection', function(evt) { if (!graph.isSelectionEmpty()) { // 创建一个副本,并保存它的状态 var cells = graph.getSelectionCells(); var bounds = graph.getView().getBounds(cells); // 添加、删除功能 var funct = function(graph, evt, cell) { graph.stopEditing(false); var pt = graph.getPointForEvent(evt); var dx = pt.x - bounds.x; var dy = pt.y - bounds.y; var clones = graph.importCells(cells, dx, dy); graph.setSelectionCells(clones); } // 创建拖动预览图标 var img = toolbar.addMode(null, 'editors/images/outline.gif', funct); mxUtils.makeDraggable(img, graph, funct); } }); button.style.position = 'absolute'; button.style.left = '2px'; button.style.top = '2px'; document.body.appendChild(button); } } function addToolbarItem(graph, toolbar, prototype, image) { // 添加、删除功能 var funct = function(graph, evt, cell) { graph.stopEditing(false); var pt = graph.getPointForEvent(evt); var vertex = graph.getModel().cloneCell(prototype); vertex.geometry.x = pt.x; vertex.geometry.y = pt.y; graph.addCell(vertex); graph.setSelectionCell(vertex); } // 创建拖动预览图标 var img = toolbar.addMode(null, image, funct); mxUtils.makeDraggable(img, graph, funct); } </script> </head> <!-- 页面载入后启动程序. --> <body onload="main();"> </body> </html>
相关推荐
MXGRAPH..MXGRAPH..MXGRAPH..MXGRAPH..MXGRAPH..MXGRAPH..MXGRAPH..MXGRAPH..MXGRAPH..
资源:mxGraph;包含ie,Firefox两个版本;版本号都是1.4.0.0;只带了一个Hello World的示例,其他的例子请自己去官网找吧
mxgraph 右键 toolbar工具条
mxgraph开发包
NULL 博文链接:https://chwshuang.iteye.com/blog/1797168
mxGraph里头包含源码,以及常用的一些实例,相关介绍可以查阅博客:http://www.cnblogs.com/shawWey/p/7115124.html
这个插件支持在HTML页面中插入流程图,画得很漂亮 :-)
带Webpack的typed-mxgraph演示 来自Webpack Typescript入门 如何使用 在本地克隆项目 git clone https://github.com/typed-mxgraph/typed-mxgraph-demo.git 切换到项目目录 cd typed-mxgraph-demo 确保使用节点10...
mxgraph-svg2shape 一套将SVG文件转换为mxGraph资源的工具。 该存储库基于: SVG to XML mxGraph stencil definition translation tool. ... 添加 :将XML mxGraph模具定义转换为一组相应JavaScript /
mxGraph1.8.0.3破解版mxclient,分IE ,FF 和chrome三个部分,不同浏览器加载不同的js文件,手动尝试过,1.8.0.5官方的例子都可以正常运行。
web开发拓扑图插件 mxGraph - An open source JavaScript diagramming component, started in 2005, that works on all major browsers, including touch devices.
mxGraph 简单易用,只需要在HTML文件中加入JavaScript链接,就可立即使用最简洁最强大的基于浏览器自身的绘图工具。 HTML 5和全系列IE支持。 想像一下,整个应用都是基于Web。在浏览器中设计工作流,操纵有背景图...
mxgraph-1_10_4_0 官方源码+文档+示例
前段实现mxgraph插件绘制流程图,后台实现保存的xml导出成图片格式,遇到图标没有引用,文字label位置不正确,label换行不识别 标签,linux服务器部署中文字体等问题
mxgraph-demo-源码.rar
vue配合mxGraph 入门实例项目,
在线画图www.draw.io网站的源码,基于mxGraph开发
十分强大的js绘图工具,适用于设计/编辑 Workflow/BPM 流程图、图表、网络图和普通图形的 Web 应用程序。这是破解过的源js库。
mxGraph1.9.1.1 mxclient.js破解文件下载 1.找到mxclient.js文件中的这句代码 注释 if ((eval('/156/145/167/40/104/141/164/145/50/51/56/147/145/164/124/151/155/145/50/51') / 1000) - 1270532723 >...
基于mxGraph来做的一款web的绘制流程图的javascript库工具