Subclass fabric.Group
Show problem I'm having trying to subclass fabric.Group
by Vijay Gujar
HTML
<script src="https://rawgit.com/kangax/fabric.js/master/dist/fabric.js"></script>
<canvas id="c" width="300" height="300"></canvas><br/>
<button class="load_group_button">Load Group</button>
<button class="load_custom_group_button">Load Custom Group</button>
CSS
canvas {
border: 1px solid #999;
}
JavaScript
var canvas = new fabric.Canvas('c');
/*
NOTE: THIS IS WORKING NOW - By adding true to the end of the initialize
callSuper, it started working. Like this:
this.callSuper('initialize', objects, options, true);
The problem I'm having is that the color of the fabric.Rect in the subclassed group is getting changed to black.When I do it directly in fabric.Group it displays in red which is correct. When I do it fabric.CustomGroup it displays in black which is not what I want. The JSON is identical with the exception of the type being 'group' in one case and 'customGroup' in the other.
I've been playing with variations on fromObject but I can't seem to figure out what I'm doing wrong. The change seems to happen when I "enliven" the objects in the custom group.
Click on the "Load Group" button to see the red rect and the "Load Custom Group" button to see the black rect.
*/
const PARAM_TYPE = "#_type_#";
const PARAM_TYPE_GROUP = "group";
const PARAM_TYPE_CUSTOM_GROUP = "customGroup";
var json_template =...