2011-09-23 55 views
0

我有以下的控制:煎茶触摸:问题与添加项动态

app.views.MapControl = Ext.extend(Ext.Panel, 
{ 
    style: { background:'white' }, 
    items: 
    [{ xtype: 'panel', 
     id: 'mapContainer', 
     width: 1700, 
     height: 1124, 
     html: "<img class='mapImg' style='width:100%; height:100%; 
       padding:0; margin:0' src='imagery/tube_map.gif'>" 
    }], 

控制的渲染后,我动态地添加一些项目像:

 var newPin = new app.views.Pushpin({x:pinPosX, y:pinPosY}); 
     this.theMap.add(newPin); 

图钉控制样子这样的:

app.views.Pushpin = Ext.extend(Ext.Panel, { 
      xtype: 'panel', 
     style: { background: 'url(imagery/pin.png)' }, 
     width: 50, 
     height: 50, 
     x: 0, 
     y: 0 

问题

当我不动态添加任何引脚,然后管图图像显示罚款。但是,如果我添加任何,那么对于我添加的每个引脚,管图上都会出现一个50像素的偏移量。

这是为什么?任何人都可以请建议任何解决方法?

预先感谢您。

回答

1

引脚仍占用空间。添加position: absolute;到他们的风格。

+0

你是天才的谢意! – nosuic

+1

我很荣幸:) – ilija139