-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Expand file tree
/
Copy pathindex.html
More file actions
91 lines (84 loc) · 2.35 KB
/
index.html
File metadata and controls
91 lines (84 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Blockly Demo: Minimap</title>
<script src="../../dist/blockly_compressed.js"></script>
<script src="../../dist/blocks_compressed.js"></script>
<script src="../../build/msg/en.js"></script>
<script src="minimap.js"></script>
<style>
body {
background-color: #fff;
font-family: sans-serif;
}
h1 {
font-weight: normal;
font-size: 140%;
}
</style>
</head>
<body>
<h1><a href="https://developers.google.com/blockly/">Blockly</a> >
<a href="../index.html">Demos</a> > Minimap</h1>
<p>This is a simple demo showing how a minimap can be implemented.</p>
<table width="100%">
<tr>
<td>
<div id="masterDiv" style="height: 480px; width: 900px;"></div>
</td>
<td>
<div id="mapDiv" style="height: 480px; width: 200px;"></div>
</td>
</tr>
</table>
<xml xmlns="https://developers.google.com/blockly/xml" id="toolbox" style="display: none">
<block type="controls_if"></block>
<block type="logic_compare"></block>
<block type="controls_repeat_ext"></block>
<block type="math_number">
<field name="NUM">123</field>
</block>
<block type="math_arithmetic"></block>
<block type="text"></block>
<block type="text_print"></block>
<block type="variables_get"><field name="VAR">i</field></block>
<block type="variables_get"><field name="VAR">j</field></block>
<block type="variables_get"><field name="VAR">k</field></block>
</xml>
<script>
// Inject master workspace.
var masterWorkspace = Blockly.inject('masterDiv', {
media: '../../media/',
scrollbars: true,
toolbox: document.getElementById('toolbox')
});
// Inject workspace for minimap.
var minimapWorkspace = Blockly.inject('mapDiv', {
media: '../../media/',
readOnly: true,
zoom: {
controls: false,
wheel: true,
startScale: 0.1, // Change this according to your needs.
maxScale: 0.1,
minScale: 0.01
}
});
// Initialize the minimap.
Minimap.init(masterWorkspace,minimapWorkspace);
</script>
<style>
.minimap{
position: absolute;
}
.mapDragger{
cursor: move;
fill: rgb(0,0,255);
stroke-width: .5;
stroke: rgb(0,0,0);
fill-opacity: .1;
}
</style>
</body>
</html>