Skip to content

Commit

Permalink
Merge pull request #37 from joaovbibiano/feat/border-color
Browse files Browse the repository at this point in the history
feat: Introduce border color to the configuration
  • Loading branch information
maykbrito authored Jun 8, 2021
2 parents e3daa8b + 4755bb9 commit 57550aa
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
4 changes: 4 additions & 0 deletions electron/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ const userPreferencesSchema: Schema<unknown> = {
zoom: {
type: JSONSchemaType.Number,
},
borderColorCss: {
type: JSONSchemaType.String,
},
}

export const userPreferences = new Store({
Expand Down Expand Up @@ -106,6 +109,7 @@ export const userPreferences = new Store({
rounded: true,
flipHorizontal: false,
zoom: 1.1,
borderColorCss: 'linear-gradient(to right, #988BC7, #FF79C6)',
},
})

Expand Down
14 changes: 9 additions & 5 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

<title>Mini Video Me</title>
<style>
:root {
--border-color: linear-gradient(to right, #988BC7, #FF79C6);
}

body, #video-grid {
-webkit-app-region: drag;
}
Expand All @@ -27,8 +31,8 @@
pointer-events: none;
background: #121214;
}
.flip {

.flip {
transform: rotateY(180deg);
}

Expand Down Expand Up @@ -57,7 +61,7 @@
z-index: -1;
margin: -5px;
border-radius: inherit;
background: linear-gradient(to right, #988BC7, #FF79C6);
background: var(--border-color);
}

.video-wrapper {
Expand All @@ -72,7 +76,7 @@
#wrapper.rounded {
border-radius: 50%;
/* fix border-radius on Mac Mojave */
height: calc(100vw - 1px);
height: calc(100vw - 1px);
}

#wrapper.rounded .video-wrapper {
Expand All @@ -82,7 +86,7 @@

<script>
const global = globalThis;
</script>
</script>
</head>
<body>
<div id="wrapper">
Expand Down
6 changes: 6 additions & 0 deletions src/cam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ export class CameraController {
private isFlipped: boolean
private isRounded: boolean
private position: Record<'x' | 'y' | 'z', number>
private root: HTMLElement

constructor() {
this.videoWrapper = document.getElementById('wrapper') as HTMLDivElement
this.videoElement = document.getElementById('video') as HTMLVideoElement
this.root = document.querySelector(':root') as HTMLElement

this.isFlipped = config.flipHorizontal
this.isRounded = config.rounded
Expand Down Expand Up @@ -84,5 +86,9 @@ export class CameraController {
this.videoElement.style.transform = transform.join(' ')
this.videoElement.className = classList.join(' ')
this.videoWrapper.className = this.isRounded ? 'rounded' : ''

if (config.borderColorCss) {
this.root.style.setProperty('--border-color', config.borderColorCss)
}
}
}
1 change: 1 addition & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const config = {
scale: Number(userPreferences.zoom ?? 1),
horizontal: Number(userPreferences.anchor.x ?? 0),
vertical: Number(userPreferences.anchor.y ?? 0),
borderColorCss: userPreferences.borderColorCss,
}

export { config }

0 comments on commit 57550aa

Please sign in to comment.