css - 有没有办法在 Draw2D 驱动的画布上拥有 iframe 元素?
问题描述
我正在使用 Draw2D 构建自定义对象,并希望利用 Microsoft 提供的基于 CSS 的材料设计图标 ( https://cdn.materialdesignicons.com/3.6.95/ )。我认为我可以实现这一点的唯一方法是加载 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);
解决方案
在初始化形状时,我调用了这个函数来添加和定位插入的 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);
}
您看到的 css 类overlay
只是position: absolute
.
推荐阅读
- docker - docker 文件中的脚本未运行
- javascript - 如何有条件地链接两个反应组件的状态
- kotlin - 使用 PGP (BouncyGPG) 加密大文件并在 Kotlin 中通过 SFTP (JSch) 发送它
- sql-server - Sql Server - 执行一个存储过程,该过程从查询编辑器窗口获取 BigIntList 类型的输入参数
- maxima - 最大值数值积分语法
- c# - 当参数与给定模式不匹配时,如何让 NSubstitute 模拟失败?
- webpack - Css grid IE 11:Autoprefixeur online vs package npm
- javascript - Node JS GET by ID 抛出 404 但响应正确
- ruby - Ruby:如何按年查找日期
- java - 如何将数字加密为正确的字符串