【问题标题】:Is there a way to have an iframe element on a Draw2D powered canvas?有没有办法在 Draw2D 驱动的画布上拥有 iframe 元素?
【发布时间】:2019-06-18 15:08:53
【问题描述】:

我正在使用 Draw2D 构建自定义对象,并希望利用 Microsoft (https://cdn.materialdesignicons.com/3.6.95/) 提供的基于 CSS 的材料设计图标。我认为我可以实现这一点的唯一方法是加载 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);

【问题讨论】:

    标签: css iframe draw2d


    【解决方案1】:

    在初始化形状时,我调用了这个函数来添加和定位插入的 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

    【讨论】:

      猜你喜欢
      • 2015-01-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-02
      • 1970-01-01
      • 2022-01-25
      • 2021-03-16
      相关资源
      最近更新 更多