Nov 06, 2015, 6:37 AM
[OPEN] [#935] [2.5.3] Error when rendering Sprite
Hi,
I came across this issue while trying to create some graphics using the DrawComponent.
The Sprite class contains a Type config that can be assigned one of the options from the SpriteType enum.
The error occurs when using an enum option that is not "native" to ExtJS. In my case it happened with Triangle.
To reproduce the error, create a simple window or other component where DrawComponent can render to.
Thanks,
Carlos
I came across this issue while trying to create some graphics using the DrawComponent.
The Sprite class contains a Type config that can be assigned one of the options from the SpriteType enum.
The error occurs when using an enum option that is not "native" to ExtJS. In my case it happened with Triangle.
To reproduce the error, create a simple window or other component where DrawComponent can render to.
public myDrawing()
{
Items.Add(new Sprite()
{
Type = SpriteType.Triangle,
Fill = "green",
Stroke = "black"
});
}
When the component is being created ExtJS calls the getBBox() function. Within this function it tries to create a variable realPath by combining strings. See the following line of code:var realPath = this["getPath" + sprite.type](sprite);
Since ExtJS doesn't have a "getPathtriangle" function, the console throws the following error:Uncaught TypeError: this[("getPath" + sprite.type)] is not a function
The error does not occur when the enum uses one of the ExtJS sprite types ( 'circle', 'ellipse', 'path', 'rect', 'text', 'image')Thanks,
Carlos
Last edited by Daniil; Nov 16, 2015 at 1:38 PM.
Reason: [OPEN] [#935] [2.5.3]