[英]Is there a way to have an iframe element on a Draw2D powered canvas?
I am building custom objects with Draw2D and would like to take advantage of the CSS based material design icons from Microsoft ( https://cdn.materialdesignicons.com/3.6.95/ ). 我正在使用Draw2D构建自定义对象,并希望利用Microsoft提供的基于CSS的材料设计图标( https://cdn.materialdesignicons.com/3.6.95/ )。 The only way I think I can achieve this is an internal frame to load the css class.
我认为我能实现这一目标的唯一方法是加载css类的内部框架。
this.img = new draw2d.shape.basic.Rectangle({
stroke: 2,
bgColor: "#ffffff",
color: "#343F48",
resizeable: true
});
//replace this with MDI css icons
/ var icon = new draw2d.shape.icon.Db({
/ height: 20,
/ width: 20
/ });
/ icon.setBackgroundColor("#e0ba23");
//
var centerLocator = new draw2d.layout.locator.CenterLocator();
this.img.add(icon, centerLocator);
On init of the shape I called this function to add and position an inserted DOM element. 在形状初始化时,我调用此函数来添加和定位插入的DOM元素。
positionIcon: function () {
this.img.overlay = $("<div class='mdi mdi-database overlay'></div>");
this.img.overlay.css({
"top": this.getY(),
"left": this.getX(),
"color": "#e0ba23",
"fontSize": 16,
"padding": 7
});
$("#canvas").append(this.img.overlay);
}
The css class overlay
that you see is just position: absolute
. 你看到的css类
overlay
只是position: absolute
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.