2016-02-22 18 views
2

我有下面的代碼:我可以更改<g>或者Firefox的大小和邊距嗎?

<html> 
    <head> 
     <title>example00</title> 
    </head> 
    <body> 
     aaaaaaaaaaaa 
     <div data-id="95" id="map"> 
         <style type="text/css"> 
       svg { 
        margin: 0; 
       } 
       g { 
        margin: 0; 
       } 
      </style> 
      <svg height="500px" width="100%" pointer-events="all" style="border: 2px solid red;" xmlns="http://www.w3.org/2000/svg"> 
       <g class="viewport" transform="translate(-1134.8008037565835,-465.99275413153373)scale(2.7132086548953445)"> 
        <g transform="translate(722.22 125)"><circle id="node_1" class="node" style="fill: rgb(50, 50, 128);" r="6"/></g> 
        <g transform="translate(572.22 158.33)"><circle id="node_2" class="node" style="fill: rgb(50, 50, 128);" r="6"/></g> 
        <g transform="translate(805.56 208.33)"><circle id="node_10" class="node" style="fill: rgb(50, 50, 128);" r="6"/></g> 
        <g transform="translate(722.22 241.67)"><circle id="node_11" class="node" style="fill: rgb(50, 50, 128);" r="6"/></g> 
        <g transform="translate(838.89 225)"><circle id="node_12" class="node" style="fill: rgb(50, 50, 128);" r="6"/></g> 
        </g> 
       </svg> 
     </div> 
    </body> 
</html> 

我認爲SVG組還沒有利潤和對齊。

並且在例如該組元素鉻(叉鉻)示於檢查員良好,因爲你在屏幕截圖看到:

chromium

但Firefox是示出具有邊緣和對準一個少數的權利,因爲你在截圖中看到:

firefox

它是一個錯誤嗎?還是我在代碼中錯過了它?

+0

對象位置是否真的變化了,還是工具的位置錯了?我懷疑後者。 –

回答

0

這是一個錯誤。我發現了一個小例子來測試:

<html> 
    <head> 
     <title>example00</title> 
    </head> 
    <body> 
     <b>The border is the trap!!!!</b> 
     <br /> 
     <svg height="200" width="200" style="border: 30px solid red;"> 
      <g class="first"> 
       <circle cx="20" cy="20" r="20" fill="green"></circle> 
       <circle cx="70" cy="70" r="20" fill="purple"></circle> 
      </g> 
      <g class="second"> 
       <rect x="110" y="110" height="30" width="30" fill="blue"></rect> 
       <rect x="160" y="160" height="30" width="30" fill="red"></rect> 
      </g> 
     </svg> 
     <br /> 
     <b>This is without border and some love.</b> 
     <br /> 
     <svg width="200" height="200"> 
      <g class="first"> 
       <circle cx="20" cy="20" r="20" fill="green"></circle> 
       <circle cx="70" cy="70" r="20" fill="purple"></circle> 
      </g> 
      <g class="second"> 
       <rect x="110" y="110" height="30" width="30" fill="blue"></rect> 
       <rect x="160" y="160" height="30" width="30" fill="red"></rect> 
      </g> 
     </svg> 
    </body> 
</html> 

的問題是邊境改變的<g>位置。

這些是在Firefox的漏洞截圖:

firefox_border_is_a_trap.jpg

firefox_without_border.jpg

而且這是在鉻的截圖(和它運行良好):

chromium_runs_fine.jpg

+0

是的,報告幾分鐘前:https://bugzilla.mozilla.org/show_bug.cgi?id = 1250143 –

+0

所以問題不在於繪圖錯誤,而在於工具報告錯誤的位置形狀? –

+0

不,檢查工具運行良好,因爲我的例子是使用svg和庫jquery庫tooltipster的項目的一小部分。這個庫不正確地提供了這個bug的工具提示。 –

相關問題