微件:Map:修订间差异
跳转到导航
跳转到搜索
创建页面,内容为“<noinclude> {{#widget:sandbox|map=701}} </noinclude><includeonly><canvas id="map-<!--{$map|escape:'quotes'}-->" width='1024' height='576' style='background-image:url...” |
无编辑摘要 |
||
| 第1行: | 第1行: | ||
<noinclude> | <noinclude> | ||
{{#widget:sandbox|map=701}} | {{#widget:sandbox|map=701|size=396}} | ||
</noinclude><includeonly><canvas id="map-<!--{$map|escape:'quotes'}-->" width='1024' height='576' style='background-image:url(/wg_img/ccbResources/map/<!--{$map|escape:'url'}-->.jpg); background-position:center'></canvas><script src='https://cruiseliu.github.io/zjsnrwiki/data/pveData.js'></script><script> | </noinclude><includeonly><canvas id="map-<!--{$map|escape:'quotes'}-->" width='1024' height='576' style='background-image:url(/wg_img/ccbResources/map/<!--{$map|escape:'url'}-->.jpg); background-position:center'></canvas><script src='https://cruiseliu.github.io/zjsnrwiki/data/pveData.js'></script><script> | ||
var mapId = "<!--{$map|escape:'quotes'}-->"; | var mapId = "<!--{$map|escape:'quotes'}-->"; | ||
var h = parseInt("<!--{$size|escape:'quotes'}-->"); | |||
var w = h * 1024 / 576; | |||
var mapCanvas = document.getElementById('map-' + mapId); | |||
mapCanvas.style.height = h + 'px'; | |||
mapCanvas.style.width = w + 'px'; | |||
var nodes = [ ] | var nodes = [ ] | ||
| 第51行: | 第57行: | ||
function drawNode(img) { | function drawNode(img) { | ||
var map = | var map = mapCanvas.getContext('2d'); | ||
for (var node of nodes) | for (var node of nodes) | ||
if (node.type == img._type) { | if (node.type == img._type) { | ||
| 第78行: | 第84行: | ||
ctx.putImageData(imgData, 0, 0); | ctx.putImageData(imgData, 0, 0); | ||
var map = | var map = mapCanvas.getContext('2d'); | ||
map.save(); | map.save(); | ||
var node1 = nodes[img._path.start]; | var node1 = nodes[img._path.start]; | ||
| 第99行: | 第105行: | ||
if (drawnNodeCnt < nodeImgs.length || drawnPathCnt < paths.length) return; | if (drawnNodeCnt < nodeImgs.length || drawnPathCnt < paths.length) return; | ||
var map = | var map = mapCanvas.getContext('2d'); | ||
map.font = 'bold 24px monospace'; | map.font = 'bold 24px monospace'; | ||
map.textAlign = 'center'; | map.textAlign = 'center'; | ||
2016年10月7日 (五) 05:53的版本