File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -5,5 +5,9 @@ const url = new URL(window.location.href);
5
5
const uuid = url . searchParams . get ( 'uuid' ) ;
6
6
7
7
if ( uuid && uuid . length === 32 ) {
8
+ const w = Math . max ( document . documentElement . clientWidth , window . innerWidth || 0 ) ;
9
+ const h = Math . max ( document . documentElement . clientHeight , window . innerHeight || 0 ) ;
10
+ canvas . width = w ;
11
+ canvas . height = h ;
8
12
drawSkin3D ( canvas , uuid , true ) ;
9
13
}
Original file line number Diff line number Diff line change 11
11
</div >
12
12
</div >
13
13
<div class =" row" >
14
- <div class =" col-sm-12 col-md-3 col-lg-2" >
14
+ <div class =" col-sm-12 col-md-3 col-lg-2 skin-container " >
15
15
<div class =" panel panel-default" >
16
16
<div class =" panel-body" >
17
- <img :src =" `/static/data/${uuid}/body.png`" :alt =" `${player.data.playername}'s model`" class =" img-rounded" >
17
+ <img v-if =" !isCanvasSupported" :src =" `/static/data/${uuid}/body.png`" :alt =" `${player.data.playername}'s model`" class =" img-rounded" >
18
+ <iframe v-if =" isCanvasSupported" :src =" `/static/skin/index.html?uuid=${uuid}`" class =" skin" />
18
19
</div >
19
20
</div >
20
21
</div >
@@ -102,6 +103,12 @@ export default {
102
103
this .uuid = uuid;
103
104
},
104
105
},
106
+ computed: {
107
+ isCanvasSupported () {
108
+ const elem = document .createElement (' canvas' );
109
+ return !! (elem .getContext && elem .getContext (' 2d' ));
110
+ },
111
+ },
105
112
mounted () {
106
113
const timer = setInterval (() => {
107
114
this .progress += 20 ;
@@ -119,3 +126,14 @@ export default {
119
126
},
120
127
};
121
128
</script >
129
+
130
+ <style scoped>
131
+ .skin {
132
+ width : 100% ;
133
+ height : 285px ;
134
+ border : none ;
135
+ }
136
+ .panel-body {
137
+ padding : 0 ;
138
+ }
139
+ </style >
You can’t perform that action at this time.
0 commit comments