PDA

View Full Version : [Ext 4] Ext.draw.Component - add defaults for items



LesJ
26 Apr 2011, 6:58 AM
This is not a bug, but a feature request.

See the code below. I specified "fill" as a default item property, but the default was not effective.

It would be nice if it worked though :)


var drawComponent = Ext.create('Ext.draw.Component', {
viewBox: false,
defaults: {
fill: "red"
},
items: [{
type: 'rect',
x: 10,
y: 10,
width: 25,
height: 50,
group: "test",
stroke: "blue",
"stroke-width": 3
}, {
type: 'rect',
x: 50,
y: 25,
width: 20,
height: 60,
group: "test",
stroke: "blue",
"stroke-width": 5,
rotation: {
degrees: 45
}
}]
});

Ext.create('Ext.Window', {
width: 300,
height: 300,
layout: 'fit',
items: [drawComponent]
}).show();

steffenk
26 Apr 2011, 7:04 AM
i would call it "consistent", so i see it as bug :)

LesJ
17 Feb 2012, 6:37 AM
i would call it "consistent", so i see it as bug :)

After re-thinking, I'd also call it a bug. As an example, see the Tiger (http://docs.sencha.com/ext-js/4-0/extjs/examples/draw/Tiger.js) source code.

There's a lot of repetition in the items array, which should be specified in defaults.


defaults: {
type: "path"
}