js画图开发库--mxgraph--contexticons-悬停图标.html
<!Doctype html> <html xmlns=http://www.w3.org/1999/xhtml> <head> <meta http-equiv=Content-Type content="text/html;charset=utf-8"> <title>悬停图标示例 for mxGraph</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"> // Defines a subclass for mxVertexHandler that adds a set of clickable icons to every selected vertex. //定义节点处理程序,每个节点在被点击时会显示节点图标。图表是以节点的子类形式存在的。 function mxVertexToolHandler(state) { mxVertexHandler.apply(this, arguments); }; mxVertexToolHandler.prototype = new mxVertexHandler(); mxVertexToolHandler.prototype.constructor = mxVertexToolHandler; mxVertexToolHandler.prototype.domNode = null; //初始化 mxVertexToolHandler.prototype.init = function() { mxVertexHandler.prototype.init.apply(this, arguments); //示例中使用div容器显示元素,这样做的目的就是解决IE浏览器中透明度的问题。 this.domNode = document.createElement('div'); this.domNode.style.position = 'absolute'; this.domNode.style.whiteSpace = 'nowrap'; var md = (mxClient.IS_TOUCH) ? 'touchstart' : 'mousedown'; // 删除按钮 var img = mxUtils.createImage('images/delete2.png'); img.style.cursor = 'pointer'; img.style.width = '16px'; img.style.height = '16px'; mxEvent.addListener(img, md, mxUtils.bind(this, function(evt) { // Disables dragging the image mxEvent.consume(evt); }) ); mxEvent.addListener(img, 'click', mxUtils.bind(this, function(evt) { this.graph.removeCells([this.state.cell]); mxEvent.consume(evt); }) ); this.domNode.appendChild(img); // 大小按钮 var img = mxUtils.createImage('images/fit_to_size.png'); img.style.cursor = 'se-resize'; img.style.width = '16px'; img.style.height = '16px'; mxEvent.addListener(img, md, mxUtils.bind(this, function(evt) { this.start(mxEvent.getClientX(evt), mxEvent.getClientY(evt), 7); this.graph.isMouseDown = true; mxEvent.consume(evt); }) ); this.domNode.appendChild(img); // 移动按钮 var img = mxUtils.createImage('images/connector.gif'); img.style.cursor = 'move'; img.style.width = '16px'; img.style.height = '16px'; mxEvent.addListener(img, md, mxUtils.bind(this, function(evt) { this.graph.graphHandler.start(this.state.cell, mxEvent.getClientX(evt), mxEvent.getClientY(evt)); this.graph.graphHandler.cellWasClicked = true; this.graph.isMouseDown = true; mxEvent.consume(evt); }) ); this.domNode.appendChild(img); // 链接按钮 var img = mxUtils.createImage('images/check.png'); img.style.cursor = 'pointer'; img.style.width = '16px'; img.style.height = '16px'; mxEvent.addListener(img, md, mxUtils.bind(this, function(evt) { var pt = mxUtils.convertPoint(this.graph.container, mxEvent.getClientX(evt), mxEvent.getClientY(evt)); this.graph.connectionHandler.start(this.state, pt.x, pt.y); this.graph.isMouseDown = true; mxEvent.consume(evt); }) ); this.domNode.appendChild(img); //将节点添加到容器 this.graph.container.appendChild(this.domNode); this.redrawTools(); }; //重绘 mxVertexToolHandler.prototype.redraw = function() { mxVertexHandler.prototype.redraw.apply(this); this.redrawTools(); }; //重绘工具 mxVertexToolHandler.prototype.redrawTools = function() { if (this.state != null && this.domNode != null) { var dy = (mxClient.IS_VML && document.compatMode == 'CSS1Compat') ? 20 : 4; this.domNode.style.left = (this.state.x + this.state.width - 56) + 'px'; this.domNode.style.top = (this.state.y + this.state.height + dy) + 'px'; } }; //删除元素 mxVertexToolHandler.prototype.destroy = function(sender, me) { mxVertexHandler.prototype.destroy.apply(this, arguments); if (this.domNode != null) { this.domNode.parentNode.removeChild(this.domNode); this.domNode = null; } }; // 程序在此方法中启动 function main(container) { // 检查浏览器支持 if (!mxClient.isBrowserSupported()) { mxUtils.error('Browser is not supported!', 200, false); } else { // 在容器中创建图形 var graph = new mxGraph(container); graph.setConnectable(true); graph.connectionHandler.createTarget = true; graph.createHandler = function(state) { if (state != null && this.model.isVertex(state.cell)) { return new mxVertexToolHandler(state); } return mxGraph.prototype.createHandler.apply(this, arguments); }; //还可以将图形设置成自适应大小 //graph.setResizeContainer(true); //允许弹性选项 //new mxRubberband(graph); // 在图形中创建默认组件 var parent = graph.getDefaultParent(); //开启模型的事务 graph.getModel().beginUpdate(); try { //在图形中插入组件 var v1 = graph.insertVertex(parent, null, 'Hello,', 20, 20, 80, 30); var v2 = graph.insertVertex(parent, null, 'World!', 200, 150, 80, 30); var e1 = graph.insertEdge(parent, null, '', v1, v2); } finally { //事务结束 graph.getModel().endUpdate(); } } }; </script> </head> <!-- 页面载入时启动程序 --> <body onload="main(document.getElementById('graphContainer'))"> <!-- 创建带网格壁纸和曲线的一个容器 --> <div id="graphContainer" style="overflow:hidden;width:321px;height:241px;background:url('editors/images/grid.gif');cursor:default;"> </div> </body> </html>
相关推荐
MXGRAPH..MXGRAPH..MXGRAPH..MXGRAPH..MXGRAPH..MXGRAPH..MXGRAPH..MXGRAPH..MXGRAPH..
资源:mxGraph;包含ie,Firefox两个版本;版本号都是1.4.0.0;只带了一个Hello World的示例,其他的例子请自己去官网找吧
mxgraph开发包
NULL 博文链接:https://chwshuang.iteye.com/blog/1797168
mxGraph里头包含源码,以及常用的一些实例,相关介绍可以查阅博客:http://www.cnblogs.com/shawWey/p/7115124.html
这个插件支持在HTML页面中插入流程图,画得很漂亮 :-)
mxgraph.js中文文档是一个官方的api,翻译来源于sunflower(github: https://github.com/SunInfoFE),提供给更多的开发者参考和共享源码资源!
带Webpack的typed-mxgraph演示 来自Webpack Typescript入门 如何使用 在本地克隆项目 git clone https://github.com/typed-mxgraph/typed-mxgraph-demo.git 切换到项目目录 cd typed-mxgraph-demo 确保使用节点10...
Based on the latest web technologies, mxGraph is the ultimate component for drawing diagrams in a browser. Using open standards, mxGraph does not depend on any third-party plugins and proprietary ...
前段实现mxgraph插件绘制流程图,后台实现保存的xml导出成图片格式,遇到图标没有引用,文字label位置不正确,label换行不识别 标签,linux服务器部署中文字体等问题
mxGraph1.8.0.3破解版mxclient,分IE ,FF 和chrome三个部分,不同浏览器加载不同的js文件,手动尝试过,1.8.0.5官方的例子都可以正常运行。
mxgraph-svg2shape 一套将SVG文件转换为mxGraph资源的工具。 该存储库基于: SVG to XML mxGraph stencil definition translation tool. ... 添加 :将XML mxGraph模具定义转换为一组相应JavaScript /
mxGraph 简单易用,只需要在HTML文件中加入JavaScript链接,就可立即使用最简洁最强大的基于浏览器自身的绘图工具。 HTML 5和全系列IE支持。 想像一下,整个应用都是基于Web。在浏览器中设计工作流,操纵有背景图...
web开发拓扑图插件 mxGraph - An open source JavaScript diagramming component, started in 2005, that works on all major browsers, including touch devices.
mxgraph-1_10_4_0 官方源码+文档+示例
mxGraph 是一个 JS 绘图组件适用于需要在网页中设计/编辑 Workflow/BPM 流 程图、图表、网络图和普通图形的 Web 应用程序。mxgraph 下载包中包括用 javescript 写的前端程序,也包括多个和后端程序(java/C#等等)...
mxgraph-demo-源码.rar
vue配合mxGraph 入门实例项目,
在线画图www.draw.io网站的源码,基于mxGraph开发
mxgraph-typescript-定义mxgraph库的打字稿定义。 有人需要吗? 对此加注星标或给我发电子邮件进行协作。 为模块定义的定义等于官方api文档的软件包: : - Each class has its "declare class mxEvent {}"- ...