Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

169
Vistas
FabricJS include all attributes in canvas.toObject()

When saving a canvas using canvas.toObject(), custom object attributes are skipped, but also some build in ones such as: borderColor. This can be quite annoying since saving the canvas using canvas.toObject() and loading it again using loadFromJson() can load something that is not the same.

Luckily there is a solution to define properties that should be included in canvas.toObject() which I found in a separate SO thread:

fabric.Object.prototype.toObject = (function (toObject) {
    return function (propertiesToInclude) {
        propertiesToInclude = (propertiesToInclude || []).concat(
          ['uuid','rt_attributes']
        );
        return toObject.apply(this, [propertiesToInclude]);
    };
})(fabric.Object.prototype.toObject);

But however, since in my use case there are a lot of properties to include, I am wondering if there is a way to just include all object attributes when running canvas.toObject(), or in other words, is it possible to disable this filter?

My side question is if anyone knows where I can find this list of attributes that gets ignored when running canvas.toObject()?

Thanks

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda