PDA

View Full Version : [DUP] [4.2.0] A Surface's getGroup method doesn't extract a group



Daniil
9 Apr 2013, 2:55 AM
REQUIRED INFORMATION

Ext version tested:

Ext 4.2.0

Browser versions tested against:

Chrome
IE9

DOCTYPE tested against:

<!DOCTYPE html>

Description:

A Surface's getGroup method doesn't extract a group.

Steps to reproduce the problem:

Click the Button

The result that was expected:

Animation occurs

The result that occurs instead:

Nothing occurs

Test Case:


<!DOCTYPE html>
<html>
<head>
<title>A Surface's getGroup method doesn't extract a group</title>

<link rel="stylesheet" href="../resources/css/ext-all.css" />

<script src="../ext-all-debug.js"></script>

<!-- A possible fix -->

<!--<script>
Ext.draw.Surface.override({
createGroup: function(id) {
var group = this.groups.get(id);
if (!group) {
group = new Ext.draw.CompositeSprite({
surface: this
});
group.id = id || Ext.id(null, 'ext-surface-group-');
this.groups.add(id, group);
}
return group;
}
});
</script>-->

<script>
Ext.onReady(function () {
Ext.create("Ext.button.Button", {
renderTo: Ext.getBody(),
text: "Animate circles",
handler: function () {
Ext.getCmp("Draw1").surface.getGroup("circles").animate({
duration: 1000,
to: {
translate: {
x: 150
}
}
});
}
});

Ext.create("Ext.draw.Component", {
id: "Draw1",
renderTo: Ext.getBody(),
height: 600,
width: 800,
items: [{
type: "circle",
fill: "#f00",
radius: 10,
x: 10,
y: 10,
group: "circles"
}, {
type: "circle",
fill: "#f00",
radius: 10,
x: 50,
y: 50,
group: "circles"
}, {
type: "circle",
fill: "#f00",
radius: 10,
x: 100,
y: 100,
group: [ "circles" ] // just to demonstrate that it doesn't work with an array as well
}
]
});
});
</script>
</head>
<body>

</body>
</html>


HELPFUL INFORMATION

Possible fix:


Ext.draw.Surface.override({
createGroup: function(id) {
var group = this.groups.get(id);
if (!group) {
group = new Ext.draw.CompositeSprite({
surface: this
});
group.id = id || Ext.id(null, 'ext-surface-group-');
this.groups.add(id, group);
}
return group;
}
});

evant
9 Apr 2013, 4:24 AM
Dupe: http://www.sencha.com/forum/showthread.php?259415