2012-11-29 53 views
0

我想在我的SVG行的開始/結束點有實線,但標記保持使用它們的形狀的值。有什麼辦法可以防止這種情況發生?如何防止SVG標記繼承其形狀的stroke-dasharray?

這是我目前的SVG:

<svg xmlns="http://www.w3.org/2000/svg" xmlns:oryx="http://www.b3mn.org/oryx" version="1.0" > 
    <defs> 
     <marker id="start" oryx:optional="yes" oryx:enabled="yes" refX="5" refY="5" markerUnits="userSpaceOnUse" markerWidth="10" markerHeight="10" orient="auto"> 
      <circle cx="5" cy="5" r="5" fill="none" stroke="black" /> 
     </marker> 
     <marker id="end" refX="10" refY="5" markerUnits="userSpaceOnUse" markerWidth="10" markerHeight="10" orient="auto"> 
      <path id="arrow" d="M 0 0 L 10 5 L 0 10 L 0 0" fill="none" stroke="black" /> 
     </marker> 
    </defs> 
    <g> 
     <path d="M10 50 L70 50" stroke="black" fill="none" stroke-width="0.75pt" stroke-dasharray="10,4" marker-start="url(#start)" marker-end="url(#end)" />  
    </g> 
</svg> 

我想要的圓圈和箭頭是固體。我試圖在圓圈和路徑上添加stroke-dasharray =「none」,但沒有成功。

回答

3

嗯,看起來像一個webkit的錯誤。根據規範,stroke-dasharray="none"應該是正確的屬性,但stroke-dasharray="0"適用於所有瀏覽器,並且它應該達到相同的結果(根據規格)。

0

Safari 6似乎忽略stroke-dasharray="0"屬性。我能找到的唯一解決方法是將stroke-dasharray設置爲大於markerWidth/markerHeight的值。

-1

stroke-dasharray="0"..="none"都不適用於我。
esad's answer啓發我。
但我認爲更好的做法是stroke-dasharray="100%"