Comments (8)
@bingyuea 请问节点可以用图片吗?可不可以提供下资料,我这边刚好需要这个功能,麻烦了!
from x-flowchart-vue.
@bingyuea 请问节点可以用图片吗?可不可以提供下资料,我这边刚好需要这个功能,麻烦了!
可以的,但是图片拉伸有点问题
from x-flowchart-vue.
@bingyuea 可以给我一个图片节点的例子吗?万分感谢🙇
from x-flowchart-vue.
@AmySay 可以给我一个图片节点的例子吗?万分感谢🙇
from x-flowchart-vue.
Q:节点/边更新时,没有按照在 nodeDefinition 中自定义实现的 draw 或 drawShape 逻辑更新。例如,有些图形没有被更新,增加了没有在 draw 或 drawShape 方法中定义的图形等。
A:由于继承了 extendedTypeName,且在 nodeDefinition 中没有复写 update 方法,导致节点/边更新时执行了 extendedTypeName 中的 update 方法,从而与自定义的 draw 或 drawShape 有出入。可以通过复写 update 方法为 undefined 解决。当 update 方法为 undefined 时,节点/边的更新将会执行 draw 或 drawShape 进行重绘。
应该是的,现在都是写的draw
from x-flowchart-vue.
@bingyuea 可以给我一个图片节点的例子吗?万分感谢🙇
drawShape(cfg, group) {
const shapeType = this.shapeType
const style = this.getShapeStyle(cfg)
const shape = group.addShape(shapeType, {
attrs: style
})
this.shape = shape
this.group = group
this.drawIcon(cfg, group)
return shape
},
drawIcon(cfg, group) {
let width, height;
const size = this.getSize(cfg)
width = size[0]
height = size[1]
console.log(size, '----size')
if (this.options.icon) {
let attrs = {
x: this.options.iconStyle.left,
y: this.options.iconStyle.top,
width,
height
}
group.icon = group.addShape('image', {
attrs: {
img: this.options.icon,
...attrs
},
draggable: true,
name: 'image-shape',
})
}
},
from x-flowchart-vue.
@bingyuea 谢谢🙇
from x-flowchart-vue.
@bingyuea 可以给我一个图片节点的例子吗?万分感谢🙇
drawShape(cfg, group) {
const shapeType = this.shapeType
const style = this.getShapeStyle(cfg)
const shape = group.addShape(shapeType, {
attrs: style
})
this.shape = shape
this.group = group
this.drawIcon(cfg, group)
return shape
},
drawIcon(cfg, group) {
let width, height;
const size = this.getSize(cfg)
width = size[0]
height = size[1]
console.log(size, '----size')
if (this.options.icon) {
let attrs = {
x: this.options.iconStyle.left,
y: this.options.iconStyle.top,
width,
height
}
group.icon = group.addShape('image', {
attrs: {
img: this.options.icon,
...attrs
},
draggable: true,
name: 'image-shape',
})
}
},
update(cfg, node) { const group = node.getContainer(); // 获取容器 const style = { width:cfg.size[0], height:cfg.size[1], size:cfg.size }; group.icon.attr(style); },
from x-flowchart-vue.
Related Issues (20)
- 你好,有没有类似https://aiyinshua.tubangzhu.net/template/center 这样的设计工具 HOT 1
- 辅助网格错位 HOT 1
- 鼠标拖动 node 的速度如果太快,导致鼠标先离开了 node 区域,会导致拖动过程终止
- master分支版本 关于自定义图片迷惑的地方
- 有没有网络相关的item节点 HOT 1
- 曲线的角度是否能够自定义 HOT 1
- 大佬 啥时在更新一版啊 HOT 1
- 【v4.x讨论区】 HOT 4
- 编辑带文本的矩形,设置文本大小后没有起作用,且样式shadowColor自动变化 HOT 2
- 找了半天也不知道这是什么错误
- 找了半天也不知道是哪的语法错误 HOT 1
- 移动端支持节点拖拽吗
- 组件初始化导致el-table分页国际化出问题
- 导入文件后出现残影,请问这个怎么解决 HOT 1
- 流程图保存后再次回显样式丢失问题
- 缩放画布之后,双击文本编辑,光标仍在原本位置
- 缩放画布之后,双击文本编辑,光标仍在原本位置
- 通过右侧编辑文本、背景色等等参数后再次操作画布会很卡
- 关于引用报错的问题 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from x-flowchart-vue.