PDA

View Full Version : Unable to drag sprite after setViewBox



wsi
10 Dec 2012, 12:55 PM
Setting an Ext.draw.Sprite to draggable and adding it to the surface allows you to drag the sprite around. However, after doing a surface.setViewBox to a smaller view, I am only able to drag the top left corner of the sprite and not anywhere else. If you run the following example with ExtJS 4.1.3 or 4.0.7, you should see this happen.



var drawComponent = Ext.create('Ext.draw.Component', {
viewBox: false
});


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


var circle = Ext.create( 'Ext.draw.Sprite', {
type: 'circle',
draggable: true,
fill: '#79BB3F',
radius: 20,
x: 25,
y: 25
});
drawComponent.surface.add( circle );


drawComponent.surface.setViewBox( 0, 0, 50, 50 );