Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Toolkit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
digital blueprint
Web Component Framework
Toolkit
Commits
514918ca
Commit
514918ca
authored
4 years ago
by
Steinwender, Tamara
Browse files
Options
Downloads
Patches
Plain Diff
Small Ui fixes in Qr-Code Scanner
parent
39176704
No related branches found
No related tags found
No related merge requests found
Pipeline
#13212
passed
4 years ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
packages/qr-code-scanner/rollup.config.js
+1
-0
1 addition, 0 deletions
packages/qr-code-scanner/rollup.config.js
packages/qr-code-scanner/src/qr-code-scanner.js
+24
-18
24 additions, 18 deletions
packages/qr-code-scanner/src/qr-code-scanner.js
with
25 additions
and
18 deletions
packages/qr-code-scanner/rollup.config.js
+
1
−
0
View file @
514918ca
...
@@ -64,6 +64,7 @@ export default (async () => {
...
@@ -64,6 +64,7 @@ export default (async () => {
targets
:
[
targets
:
[
{
src
:
'
assets/index.html
'
,
dest
:
'
dist
'
},
{
src
:
'
assets/index.html
'
,
dest
:
'
dist
'
},
{
src
:
'
assets/favicon.ico
'
,
dest
:
'
dist
'
},
{
src
:
'
assets/favicon.ico
'
,
dest
:
'
dist
'
},
{
src
:
await
getPackagePath
(
'
dbp-common
'
,
'
assets/icons/*.svg
'
),
dest
:
'
dist/local/dbp-common/icons
'
},
{
{
src
:
await
getPackagePath
(
'
qr-scanner
'
,
'
qr-scanner-worker.min.js
'
),
src
:
await
getPackagePath
(
'
qr-scanner
'
,
'
qr-scanner-worker.min.js
'
),
dest
:
'
dist/local/dbp-qr-scanner
'
dest
:
'
dist/local/dbp-qr-scanner
'
...
...
This diff is collapsed.
Click to expand it.
packages/qr-code-scanner/src/qr-code-scanner.js
+
24
−
18
View file @
514918ca
...
@@ -16,6 +16,7 @@ export class QrCodeScanner extends DBPLitElement {
...
@@ -16,6 +16,7 @@ export class QrCodeScanner extends DBPLitElement {
super
();
super
();
this
.
lang
=
'
de
'
;
this
.
lang
=
'
de
'
;
this
.
askPermission
=
false
;
this
.
videoRunning
=
false
;
this
.
videoRunning
=
false
;
this
.
notSupported
=
false
;
this
.
notSupported
=
false
;
...
@@ -36,6 +37,7 @@ export class QrCodeScanner extends DBPLitElement {
...
@@ -36,6 +37,7 @@ export class QrCodeScanner extends DBPLitElement {
static
get
properties
()
{
static
get
properties
()
{
return
{
return
{
lang
:
{
type
:
String
},
lang
:
{
type
:
String
},
askPermission
:
{
type
:
Boolean
,
attribute
:
false
},
videoRunning
:
{
type
:
Boolean
,
attribute
:
false
},
videoRunning
:
{
type
:
Boolean
,
attribute
:
false
},
notSupported
:
{
type
:
Boolean
,
attribute
:
false
},
notSupported
:
{
type
:
Boolean
,
attribute
:
false
},
scanIsOk
:
{
type
:
Boolean
,
attribute
:
true
}
scanIsOk
:
{
type
:
Boolean
,
attribute
:
true
}
...
@@ -96,6 +98,8 @@ export class QrCodeScanner extends DBPLitElement {
...
@@ -96,6 +98,8 @@ export class QrCodeScanner extends DBPLitElement {
}
}
qrCodeScannerInit
()
{
qrCodeScannerInit
()
{
this
.
askPermission
=
true
;
let
video
=
document
.
createElement
(
"
video
"
);
let
video
=
document
.
createElement
(
"
video
"
);
let
canvasElement
=
this
.
_
(
"
#canvas
"
);
let
canvasElement
=
this
.
_
(
"
#canvas
"
);
let
canvas
=
canvasElement
.
getContext
(
"
2d
"
);
let
canvas
=
canvasElement
.
getContext
(
"
2d
"
);
...
@@ -104,6 +108,8 @@ export class QrCodeScanner extends DBPLitElement {
...
@@ -104,6 +108,8 @@ export class QrCodeScanner extends DBPLitElement {
let
outputMessage
=
this
.
_
(
"
#outputMessage
"
);
let
outputMessage
=
this
.
_
(
"
#outputMessage
"
);
let
outputData
=
this
.
_
(
"
#outputData
"
);
let
outputData
=
this
.
_
(
"
#outputData
"
);
//TODO
let
color
=
this
.
scanIsOk
?
getComputedStyle
(
document
.
documentElement
)
let
color
=
this
.
scanIsOk
?
getComputedStyle
(
document
.
documentElement
)
.
getPropertyValue
(
'
--dbp-success-bg-color
'
)
:
getComputedStyle
(
document
.
documentElement
)
.
getPropertyValue
(
'
--dbp-success-bg-color
'
)
:
getComputedStyle
(
document
.
documentElement
)
.
getPropertyValue
(
'
--dbp-danger-bg-color
'
);
.
getPropertyValue
(
'
--dbp-danger-bg-color
'
);
...
@@ -134,7 +140,7 @@ export class QrCodeScanner extends DBPLitElement {
...
@@ -134,7 +140,7 @@ export class QrCodeScanner extends DBPLitElement {
// Do something with the track such as using the Image Capture API.
// Do something with the track such as using the Image Capture API.
})
})
});
}).
catch
((
e
)
=>
{
console
.
log
(
e
);
that
.
askPermission
=
true
;
});
function
tick
()
{
function
tick
()
{
if
(
that
.
videoRunning
===
false
)
{
if
(
that
.
videoRunning
===
false
)
{
...
@@ -181,6 +187,7 @@ export class QrCodeScanner extends DBPLitElement {
...
@@ -181,6 +187,7 @@ export class QrCodeScanner extends DBPLitElement {
}
}
stopScanning
()
{
stopScanning
()
{
this
.
askPermission
=
false
;
this
.
videoRunning
=
false
;
this
.
videoRunning
=
false
;
}
}
...
@@ -195,6 +202,7 @@ export class QrCodeScanner extends DBPLitElement {
...
@@ -195,6 +202,7 @@ export class QrCodeScanner extends DBPLitElement {
return
css
`
return
css
`
${
commonStyles
.
getThemeCSS
()}
${
commonStyles
.
getThemeCSS
()}
${
commonStyles
.
getGeneralCSS
()}
${
commonStyles
.
getGeneralCSS
()}
${
commonStyles
.
getSelect2CSS
()}
body {
body {
font-family: 'Ropa Sans', sans-serif;
font-family: 'Ropa Sans', sans-serif;
...
@@ -228,24 +236,16 @@ export class QrCodeScanner extends DBPLitElement {
...
@@ -228,24 +236,16 @@ export class QrCodeScanner extends DBPLitElement {
#noQRFound {
#noQRFound {
text-align: center;
text-align: center;
}
}
.border{
border-bottom: 1px solid black;
}
`
;
`
;
}
}
//doku
//doku
//demo
//demo
//check obs geht: function hasGetUserMedia() {
// // Note: Opera builds are unprefixed.
// return !!(navigator.getUserMedia || navigator.webkitGetUserMedia ||
// navigator.mozGetUserMedia || navigator.msGetUserMedia);
// }
//
// if (hasGetUserMedia()) {
// // Good to go!
// } else {
// alert('getUserMedia() is not supported in your browser');
// }
render
()
{
render
()
{
return
html
`
return
html
`
<div class="columns">
<div class="columns">
...
@@ -253,12 +253,18 @@ export class QrCodeScanner extends DBPLitElement {
...
@@ -253,12 +253,18 @@ export class QrCodeScanner extends DBPLitElement {
<div class="
${
classMap
({
hidden
:
this
.
notSupported
})}
">
<div class="
${
classMap
({
hidden
:
this
.
notSupported
})}
">
<div id="loadingMessage">🎥 Unable to access video stream (please make sure you have a webcam enabled)</div>
<button id="switch">On / Off</button>
<div class="button-wrapper border">
<span class="select">
<select id="videoSource"></select>
</span>
<button class="start button is-primary
${
classMap
({
hidden
:
this
.
videoRunning
})}
" @click="
${()
=>
this
.
qrCodeScannerInit
()}
">start scanning</button>
<button class="stop button is-primary
${
classMap
({
hidden
:
!
this
.
videoRunning
})}
" @click="
${()
=>
this
.
stopScanning
()}
">stop scanning</button>
</div>
<div id="loadingMessage" class="
${
classMap
({
hidden
:
!
this
.
askPermission
})}
">🎥 Unable to access video stream (please make sure you have a webcam enabled)</div>
<canvas id="canvas" hidden></canvas>
<canvas id="canvas" hidden></canvas>
<select id="videoSource"></select>
<button class="start
${
classMap
({
hidden
:
this
.
videoRunning
})}
" @click="
${()
=>
this
.
qrCodeScannerInit
()}
">start scanning</button>
<button class="stop
${
classMap
({
hidden
:
!
this
.
videoRunning
})}
" @click="
${()
=>
this
.
stopScanning
()}
">stop scanning</button>
<div id="output" hidden>
<div id="output" hidden>
<div id="outputMessage">No QR code detected.</div>
<div id="outputMessage">No QR code detected.</div>
<div hidden><b>Data:</b> <span id="outputData"></span></div>
<div hidden><b>Data:</b> <span id="outputData"></span></div>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment