Skip to content

Commit

Permalink
fix(QrcodeStream): prefix CSS classes
Browse files Browse the repository at this point in the history
to reduce likelihood of CSS class naming conflicts.

Issue: #208
  • Loading branch information
gruhn committed Oct 19, 2020
1 parent 94b6631 commit 00df746
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions src/components/QrcodeStream.vue
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
<template lang="html">
<div class="wrapper">
<div class="qrcode-stream-wrapper">
<!--
Note that the order of DOM elements matters.
It defines the stacking order.
The first element is at the very bottom, the last element is on top.
This eliminates the need for `z-index`.
Note, the following DOM elements are not styled with z-index.
If z-index is not defined, elements are stacked in the order they appear in the DOM.
The first element is at the very bottom and subsequent elements are added on top.
-->
<video
ref="video"
v-show="shouldScan"
class="camera"
class="qrcode-stream-camera"
autoplay
muted
playsinline
></video>

<canvas ref="pauseFrame" v-show="!shouldScan" class="pause-frame"></canvas>
<canvas ref="pauseFrame" v-show="!shouldScan" class="qrcode-stream-camera"></canvas>

<canvas ref="trackingLayer" class="tracking-layer"></canvas>
<canvas ref="trackingLayer" class="qrcode-stream-overlay"></canvas>

<div class="overlay">
<div class="qrcode-stream-overlay">
<slot></slot>
</div>
</div>
Expand Down Expand Up @@ -285,27 +284,28 @@ export default {
</script>

<style lang="css" scoped>
.wrapper {
position: relative;
z-index: 0;
.qrcode-stream-wrapper {
width: 100%;
height: 100%;
position: relative;
z-index: 0;
}
.overlay,
.tracking-layer {
position: absolute;
.qrcode-stream-overlay {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
}
.camera,
.pause-frame {
display: block;
object-fit: cover;
.qrcode-stream-camera {
width: 100%;
height: 100%;
display: block;
object-fit: cover;
}
</style>

0 comments on commit 00df746

Please sign in to comment.