-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dacbdf8
commit 092d337
Showing
14 changed files
with
388 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<template> | ||
<div | ||
:class="['rgb-text-btn', showRGBText ? 'active' : '']" | ||
:title="$t('hotkey.rgbText') + `\n${$t('hotkey.key')}: 'c'`" | ||
@click="toggleShowRGBText" | ||
> | ||
RGB | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { createNamespacedHelpers } from 'vuex' | ||
const { mapGetters, mapActions } = createNamespacedHelpers('preferenceStore') | ||
export default { | ||
computed: { | ||
...mapGetters(['preference']), | ||
showRGBText: { | ||
get() { | ||
return this.preference.showRGBText // false | ||
}, | ||
set(newVal) { | ||
this.setPreference({ showRGBText: newVal }) | ||
} | ||
} | ||
}, | ||
methods: { | ||
...mapActions(['setPreference']), | ||
toggleShowRGBText() { | ||
this.showRGBText = !this.showRGBText | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
@import '@/styles/variables.scss'; | ||
.rgb-text-btn { | ||
border: 1px solid #707078; | ||
border-radius: 5px; | ||
color: #707078; | ||
&:hover { | ||
cursor: pointer; | ||
} | ||
} | ||
.rgb-text-btn.active { | ||
border: 1px solid $primaryColor; | ||
color: $primaryColor; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { clamp } from "./index" | ||
|
||
export const DEFAULT_OVERLAP_RECT_OPTIONS = { padding: 0, round: false } | ||
function getOverlapRect(rect1, rect2, options = {}) { | ||
const { padding, round } = Object.assign({}, DEFAULT_OVERLAP_RECT_OPTIONS, options) | ||
let x1 = Math.max(rect1.x, rect2.x) | ||
let y1 = Math.max(rect1.y, rect2.y) | ||
let x2 = Math.min(rect1.x + rect1.width, rect2.x + rect2.width) | ||
let y2 = Math.min(rect1.y + rect1.height, rect2.y + rect2.height) | ||
|
||
if (round) { | ||
x1 = Math.ceil(x1) | ||
y1 = Math.ceil(y1) | ||
x2 = Math.floor(x2) | ||
y2 = Math.floor(y2) | ||
} | ||
|
||
if (padding !== 0) { | ||
x1 -= padding | ||
y1 -= padding | ||
x2 += padding | ||
y2 += padding | ||
} | ||
|
||
// if (round || padding !== 0) { | ||
// x1 = clamp(x1, Math.min()) | ||
// y1 = padding | ||
// x2 = padding | ||
// y2 = padding | ||
// } | ||
|
||
if (x2 > x1 && y2 > y1) { | ||
return { x: x1, y: y1, width: x2 - x1, height: y2 - y1 } | ||
} else { | ||
return null | ||
} | ||
} | ||
|
||
export { getOverlapRect } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.