forked from rlottie/rlottie.github.io
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.html
212 lines (207 loc) · 7.13 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width height=device-height" />
<meta name="description" content="rlottie viewer" />
<meta name="keywords" content="lottie, rlottie, lottie viewer, rlottie viewer"/>
<meta name="author" content="Subhransu" />
<title>rlottie viewer</title>
<link rel="stylesheet" href="style.css" />
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script type="text/javascript" src="./js/main.js"></script>
<!-- External Library -->
<script type="text/javascript" src="./js/gif/gif.js"></script>
<script type="text/javascript" src="./js/dragresize/dragresize.js"></script>
<!-- Vue, Vuex -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.auto.js"></script>
<script src="https://unpkg.com/http-vue-loader"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vuex/3.5.1/vuex.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" rel="stylesheet"/>
<!-- Vuetify -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vuetify.js"></script>
<link href="https://cdn.jsdelivr.net/npm/@mdi/[email protected]/css/materialdesignicons.min.css" rel="stylesheet"/>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/vuetify.min.css" rel="stylesheet"/>
<!-- Font Awesome -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/all.min.css"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui"/>
</head>
<body>
<div id="app">
<v-app>
<v-main class="main-window">
<!-- upper bar -->
<upper-bar class="upper-bar"></upper-bar>
<!-- left bar component : navigation -->
<left-bar
:selectedmenu="selectedMenu"
@menuclicked="changeMenu"
class="left-bar"
></left-bar>
<!-- left detail component : manage detail properties -->
<left-bar-detail
:canvas-size="canvasSize"
:selectedmenu="selectedMenu"
class="left-bar-detail"
></left-bar-detail>
<!-- right bar component : manage key path -->
<right-bar></right-bar>
<!-- info bar component : show file name, manage redo and undo -->
<info-bar class="info-bar"></info-bar>
<!-- main canvas -->
<div
id="content"
class="content"
ref="content"
>
<div id="img-background"></div>
<!-- wrapper box for drag -->
<div
v-on:mouseover.left="changeSize"
id="canvas-box"
class="drsElement drsMoveHandle"
:style="{'left': initCanvasLeft+'px', 'top': initCanvasTop+'px', 'width': '550px', 'height': '550px', 'borderStyle':'none', 'background-color':'rgba(255,255,255,0)'}"
>
<canvas
id="myCanvas"
style="
width: 100%;
height: 100%;
background-color: rgba(255, 255, 255, 0);
"
>
</canvas>
</div>
</div>
<!-- loading bar component -->
<loading-bar
@pointer="setPointer"
class="loading-bar"
></loading-bar>
<!-- thumbnail component -->
<thumbnail-preview
v-show="activeThumbnail"
:pointx="pointX"
:pointy="pointY"
></thumbnail-preview>
</v-main>
</v-app>
</div>
<script>
Vue.use(httpVueLoader);
Vue.use(Vuex);
// Drag and Resize
var dragresize = new DragResize("dragresize", {
minWidth: 10,
minHeight: 10,
minLeft: 64,
minTop: 0,
maxLeft: 1912,
maxTop: 830,
});
dragresize.isElement = function (elm) {
if (elm.className && elm.className.indexOf("drsElement") > -1){
return true;
}
};
dragresize.isHandle = function (elm) {
if (elm.className && elm.className.indexOf("drsMoveHandle") > -1){
return true;
}
};
dragresize.apply(document);
// Import store
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "store/index.js";
document.head.appendChild(script);
//Import Vue
script.onload = (_) => {
new Vue({
el: "#app",
vuetify: new Vuetify(),
store,
components: {
"info-bar": "url:./components/layouts/InfoBar.vue",
"left-bar": "url:./components/layouts/LeftBar.vue",
"left-bar-detail": "url:./components/layouts/LeftBarDetail.vue",
"loading-bar": "url:./components/layouts/LoadingBar.vue",
"right-bar": "url:./components/layouts/RightBar.vue",
"thumbnail-preview": "url:./components/utils/ThumbnailPreview.vue",
"upper-bar": "url:./components/layouts/UpperBar.vue",
},
data() {
return {
selectedMenu: 0,
canvasSize: {
height: 550,
width: 550,
},
initialPosition: (window.innerWidth - 550) / 2,
initCanvasTop: 0,
initCanvasLeft: 0,
pointX: 0,
pointY: 0,
activeThumbnail: false,
};
},
methods: {
changeMenu(i) {
this.selectedMenu = i;
},
changeSize() {
this.canvasSize.height = Number(
document.getElementById("canvas-box").style.height.slice(0, -2)
);
this.canvasSize.width = Number(
document.getElementById("canvas-box").style.width.slice(0, -2)
);
},
setPointer(pointer) {
this.pointX = pointer.x - 75;
this.pointY = pointer.y - 180;
this.activeThumbnail = pointer.isThumbnail;
},
},
mounted() {
this.initCanvasLeft = (window.innerWidth - 550) / 2;
this.initCanvasTop = (window.innerHeight - 550) / 2;
},
});
};
</script>
</body>
<style>
.main-window {
width: 100%;
height: 100%;
}
#app {
overflow: hidden;
}
::-webkit-scrollbar {
width: 8px;
height: 8px;
border: 3px solid #fff;
}
::-webkit-scrollbar-button:start:decrement,
::-webkit-scrollbar-button:end:increment {
display: block;
height: 10px;
background: #efefef;
}
::-webkit-scrollbar-track {
background: #efefef;
-webkit-border-radius: 10px;
border-radius: 10px;
}
::-webkit-scrollbar-thumb {
height: 50px;
width: 50px;
background: rgb(41, 44, 49, 0.3);
-webkit-border-radius: 8px;
border-radius: 8px;
}
</style>
</html>