-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
145 lines (125 loc) · 4.66 KB
/
index.html
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<script
src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
<script src="res/svg-pan-zoom.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/hammer.js/2.0.8/hammer.min.js" integrity="sha256-eVNjHw5UeU0jUqPPpZHAkU1z4U+QFBBY488WvueTm88=" crossorigin="anonymous"></script>
<title>Metroul din București</title>
<style type="text/css">
html {
position: relative;
min-height: 100%;
}
.container{
margin-bottom: 60px;
}
.footer {
position: fixed;
bottom: 0;
width: 100%;
height: 60px;
line-height: 60px;
background-color: #f5f5f5;
}
@font-face {
font-family: 'Cone';
src: URL('res/cone.ttf') format('truetype');
}
</style>
</head>
<body>
<br>
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header" role="tab" id="headingOne">
<h5 class="mb-0">
Schema rețelei
</h5>
</div>
<div id="collapseOne" class="collapse show" role="tabpanel" aria-labelledby="headingOne">
<div class="card-block">
<object id="schema" type="image/svg+xml" data="res/map.svg" style="width: 100%; height: 1000px;">Your browser does not support SVG</object>
</div>
</div>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<span class="text-muted">© Bodo Minea</span>
</div>
</footer>
<script type="text/javascript">
window.onload = function() {
var eventsHandler;
eventsHandler = {
haltEventListeners: ['touchstart', 'touchend', 'touchmove', 'touchleave', 'touchcancel']
, init: function(options) {
var instance = options.instance
, initialScale = 1
, pannedX = 0
, pannedY = 0
// Init Hammer
// Listen only for pointer and touch events
this.hammer = Hammer(options.svgElement, {
inputClass: Hammer.SUPPORT_POINTER_EVENTS ? Hammer.PointerEventInput : Hammer.TouchInput
})
// Enable pinch
this.hammer.get('pinch').set({enable: true})
// Handle double tap
this.hammer.on('doubletap', function(ev){
instance.zoomIn()
})
// Handle pan
this.hammer.on('panstart panmove', function(ev){
// On pan start reset panned variables
if (ev.type === 'panstart') {
pannedX = 0
pannedY = 0
}
// Pan only the difference
instance.panBy({x: ev.deltaX - pannedX, y: ev.deltaY - pannedY})
pannedX = ev.deltaX
pannedY = ev.deltaY
})
// Handle pinch
this.hammer.on('pinchstart pinchmove', function(ev){
// On pinch start remember initial zoom
if (ev.type === 'pinchstart') {
initialScale = instance.getZoom()
instance.zoomAtPoint(initialScale * ev.scale, {x: ev.center.x, y: ev.center.y})
}
instance.zoomAtPoint(initialScale * ev.scale, {x: ev.center.x, y: ev.center.y})
})
// Prevent moving the page on some devices when panning over SVG
options.svgElement.addEventListener('touchmove', function(e){ e.preventDefault(); });
}
, destroy: function(){
this.hammer.destroy()
}
}
// Expose to window namespace for testing purposes
window.panZoom = svgPanZoom('#schema', {
zoomEnabled: true
, controlIconsEnabled: true
, fit: 1
, center: 1
, customEventsHandler: eventsHandler
});
};
</script>
</body>
</html>