2011-09-23 26 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