简体   繁体   English

构造对象构造函数未创建cacheCanvas

[英]fabric object constructor not creating cacheCanvas

Fabric js 2.2.4 fabric object constructor not creating cacheCanvas. Fabric js 2.2.4 Fabric对象构造函数未创建cacheCanvas。 where as in 1.7.8 there is a check for cacheCanvas and creating one. 如1.7.8所示,检查cacheCanvas并创建一个。

  initialize: function(options) {
        if (options) {
            this.setOptions(options);
           }
          },


    initialize: function(options) {
        options = options || { };
        if (options) {
           this.setOptions(options);
        }
        if (this.objectCaching) {
          this._createCacheCanvas();
          this.setupState({ propertySet: 'cacheProperties' });
        }
      }, 

Well i have been removing that. 好吧,我一直在删除那个。 The reason behind it is that you may want to create 300 objects and render 1, it does not make sense to create a canvas at initialization. 其背后的原因是您可能想要创建300个对象并渲染1,在初始化时创建画布没有意义。 The canvas will be created at the first render, when needed, or you can still call the function manually. 需要时,画布将在第一个渲染时创建,或者您仍然可以手动调用该函数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM