2017-04-19 63 views
1

Planetary JS Earth plugin需要一個配置對象,該對象可以爲海洋,陸地和邊界定義填充和描邊顏色。不幸的是,文檔沒有提供任何關於可以傳遞到每個配置的信息。我想控制邊框的筆觸寬度,如下所示:自定義土地的筆觸寬度

const lightGray = 'rgb(222,224,223)'; 
const lightBlue = 'rgb(160,205,226)'; 
const blue = 'rgb(144,182,203)'; 
planet.loadPlugin(
    planetary.plugins.earth({ 
    topojson: {world: topojson}, 
    oceans: {fill: lightBlue}, 

    /* strokeWidth is ignored: */ 
    borders: {stroke: blue, strokeWidth: '5px'}, 

    land: {fill: lightGray, stroke: blue}, 
    }) 
); 

有沒有辦法做到這一點?

+0

這是'中風width',連字符和小寫字母W上。 –

+0

@GerardoFurtado我試過('邊界:{stroke:blue,'stroke-width':'5px'}'),但它也不起作用。無論是否有'px'單位。 – keithjgrant

+0

我剛剛閱讀文檔,他們不使用常規的CSS命名法,所以它可能實際上是'strokeWidth'。但是,文檔中沒有'strokeWidth' ...爲什麼不簡單地設置一個類並使用CSS(它是'stroke-width')來設置它的樣式? –

回答

0

根據documentation,它必須是lineWidth,並且該值必須是一個數字,沒有單位。

下面是一個例子:

planetaryjs.plugins.borders({ 
    stroke: '#008000', lineWidth: 0.25 
});