Commit c78e6c7e authored by quentin.vrel's avatar quentin.vrel

tile rendering test

parent 77ea1853
<template> <template>
<div class="tile"> <div class="tile">
<button class="tile-symbol"> <button class="tile-symbol" :id="this.id">
<img class="tile-background" :src="this.background" :width="this.width" :height="this.height"/> <img class="tile-background" :src="this.background" :width="this.width" :height="this.height"/>
<img class="tile-front" :src="this.svg" :width="this.width" :height="this.height"/> <img class="tile-front" :src="this.svg" :width="this.width" :height="this.height"/>
</button> </button>
...@@ -18,8 +18,9 @@ export default { ...@@ -18,8 +18,9 @@ export default {
}, },
data(){ //data must be a function data(){ //data must be a function
return{ return{
tile: null, //our tile object tile: {type: Tile}, //our tile object
svg: null, svg: null,
background: null
} }
}, },
mounted(){ //hook on mounted, we init the object. It could have been done before. mounted(){ //hook on mounted, we init the object. It could have been done before.
...@@ -27,6 +28,7 @@ export default { ...@@ -27,6 +28,7 @@ export default {
this.tile = new Tile(this.id); this.tile = new Tile(this.id);
this.background = require("@/assets/img/mahjong-tiles/Black/Front.svg"); this.background = require("@/assets/img/mahjong-tiles/Black/Front.svg");
this.svg = require("@/assets/img/mahjong-tiles/Black/"+ this.tile.getSVG()); this.svg = require("@/assets/img/mahjong-tiles/Black/"+ this.tile.getSVG());
this.id = this.tile.idobject;
console.log(this.svg); console.log(this.svg);
} }
} }
...@@ -34,12 +36,20 @@ export default { ...@@ -34,12 +36,20 @@ export default {
<style> <style>
.tile-symbol{ .tile-symbol{
width: 50%;
border-radius: 10px; border-radius: 10px;
background: transparent; background: transparent;
border: none; border: none;
display: contents;
} }
.tile-front{ .tile-front{
position: relative; display: table-caption;
transform: translateX(-100%); transform: translateX(-100%);
-webkit-transform: translateX(-100%);
transform: translateY(-100%);
-webkit-transform: translateY(-100%);
} }
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment