Skip to content

Commit

Permalink
Merge pull request #13 from JunbaeJs/junbae-config
Browse files Browse the repository at this point in the history
Junbae config
  • Loading branch information
changchanghwang authored Feb 14, 2024
2 parents ddee025 + 655bc68 commit 4a249e0
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 21 deletions.
21 changes: 21 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,33 @@
"order": 1,
"properties": {
"junbae-mode.Mode": {
"order": 0,
"type": "string",
"default": "Walk",
"enum": [
"Walk"
],
"markdownDescription": "You can choose the mode of Junbae."
},
"junbae-mode.location": {
"order": 1,
"type": "string",
"default": "top",
"enum": [
"top",
"bottom"
],
"markdownDescription": "You can choose location of junbae on the screen."
},
"junbae-mode.timerColor": {
"order": 2,
"type": "string",
"default": "white",
"enum": [
"white",
"red"
],
"markdownDescription": "You can choose timer color."
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/@types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
type Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never };
type XOR<T, U> = T extends object ? Without<Exclude<U, T>> & T : T;
96 changes: 75 additions & 21 deletions src/core/modes/walk-mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ const motions = [
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAYAAAB5fY51AAAAAXNSR0IArs4c6QAAEtVJREFUeF7tndlyJLsNBaX//+hx2JoIt0JTrQOAAAEy/ejLBcwDpqpay3x+8D8IQAACQwh8DqmTMiEAAQh8ICyaAAIQGEMAYY2JikIhAAGERQ9AAAJjCCCsMVFRKAQggLDoAQhAYAwBhDUmKgqFAAQQFj0AAQiMIYCwxkRFoRCAAMKiByAAgTEEENaYqCgUAhBAWPQABCAwhgDCGhMVhUIAAgiLHoAABMYQQFhjoqJQCEAAYdEDEIDAGAIIa0xUFAoBCCAsegACEBhDAGGNiYpCIQABhEUPQAACYwggrDFRUSgEIICw6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CfYV0ZO4eGQE8CCKtnblQNgSsJIKwrY+fQEOhJAGH1zO3fqvkl28bhUbqJAMIyYasxCWHVyIEq8gggrDzWy3dCWMuRsmBxAgireEDvXv2epT9/yRaRNQiVEk0EEJYJW+4k5bcREFZuJuy2hwDC2sN9aleENYWLwQcTQFhFw131WrdqnaKYKOsyAgiraOCrRLNqnaKYKOsyAgiraOCrRLNqnaKYKOsyAgirUODRcolevxBKSjmUAMIqFGy0UKLXL4SSUg4lgLAKBRstlOj1C6GklEMJIKxDg/10rC7/s9VP5+Df7yKAsO7K+/+nRViXBt/82AireYDW8hGWlRzzdhJAWDvpszcEIDBFAGFN4WIwBCCwkwDC2kmfvSEAgSkCCGsKF4MhAIGdBBDWTvrsDQEITBFAWFO4GAwBCOwkMP0/Un3+obidhbM3BCBwHwGEdV/mnBgCbQkgrLbRUTgE7iPwQ1ij173ZP9F7H0ZODAEIZBBAWBmU2QMCEFhCAGEtwcgiEIBABgHXjzXwqpgREXtAAAL/I4Cw6AUIQKANAYTVJioKhQAEXMICHwQgAIFMAggrkzZ7QQACLgIIy4WPyRCAQCYBhJVJm70gAAEXAYTlwsdkCEAgkwDCyqTNXhCAgIsAwnLhYzIEIJBJAGFl0mYvCEDARQBhufAxGQIQyCSAsDJpsxcEIOAigLBc+JgMAQhkEkBYmbTZCwIQcBFAWC58TIYABDIJIKxM2uwFAQi4CCAsFz4mQwACmQQQViZt9oIABFwEEJYLH5MhAIFMAggrkzZ7QQACLgL/AEXkybci0Cc9AAAAAElFTkSuQmCC',
];

type Location = {
range: vscode.Range;
junbaeLocation: { 'font-size': string } & XOR<{ top: string }, { bottom: string }>;
timerLocation: XOR<{ top: string }, { bottom: string }>;
};

type TimerColor = {
timerColor: string;
timerShadowColor: string;
};

export class WalkMode implements Mode {
private combo = 0;

Expand Down Expand Up @@ -60,18 +72,21 @@ export class WalkMode implements Mode {
return;
}

const position = firstVisibleRange.start;
const range = new vscode.Range(position, position);
const { junbaeLocation, timerLocation, range } = this.getLocation(firstVisibleRange);

if (this.combo !== this.renderedComboCount || !range.isEqual(this.renderedRange!)) {
this.renderedComboCount = this.combo;
this.renderedRange = range;
this.createWalkMotionDecorator([range], editor);
this.createTimerDecoration([range], editor);
this.createWalkMotionDecorator([range], editor, junbaeLocation);
this.createTimerDecoration([range], editor, timerLocation);
}
}

private createWalkMotionDecorator = (ranges: vscode.Range[], editor: vscode.TextEditor) => {
private createWalkMotionDecorator = (
ranges: vscode.Range[],
editor: vscode.TextEditor,
junbaeLocation: Location['junbaeLocation'],
) => {
const timeLeft = this.expiredAt - new Date().getTime();

if (timeLeft <= 0) {
Expand All @@ -84,22 +99,21 @@ export class WalkMode implements Mode {
after: {
contentText: ``,
margin: '0.5em 0 0 0',
color: '#FFFFFF',
textDecoration: `none; ${objectToCssString({
width: '50px',
height: '50px',
'background-size': 'contain',
'background-repeat': 'no-repeat',
'background-image': `url("${motions[this.combo % motions.length]}")`,
position: 'absolute',
/**
* NOTE: Junbae go out of screen when horizontal scroll
* If you want to limit position of Junbae, use `%`
*/
right: '5vw',
top: '5%',
'font-size': '100px',
'font-family': 'monospace',
'font-weight': '900',
...junbaeLocation,
'z-index': 1,
'pointer-events': 'none',
'text-align': 'center',
})}`,
},
rangeBehavior: vscode.DecorationRangeBehavior.ClosedClosed,
Expand All @@ -114,7 +128,11 @@ export class WalkMode implements Mode {
clearTimeout(this.decorationTimer);
}

private createTimerDecoration(ranges: vscode.Range[], editor: vscode.TextEditor) {
private createTimerDecoration(
ranges: vscode.Range[],
editor: vscode.TextEditor,
timerLocation: Location['timerLocation'],
) {
if (this.decorationTimer) {
clearTimeout(this.decorationTimer);
}
Expand All @@ -127,28 +145,28 @@ export class WalkMode implements Mode {
return;
}

const timerWidth = (timeLeft / this.timerDuration) * 1.5;
const { timerColor, timerShadowColor } = this.getTimerColor();

const timerWidth = (timeLeft / this.timerDuration) * 4;
this.timerDecorator?.dispose();
this.timerDecorator = vscode.window.createTextEditorDecorationType({
before: {
contentText: '',
backgroundColor: 'white',
backgroundColor: `${timerColor}`,
width: `${timerWidth}em`,
color: 'white',
height: '8px',
margin: '0.25em 0 0 0',
textDecoration: `none; ${objectToCssString({
'box-shadow': `0px 0px 15px #015dee`,
'box-shadow': `0px 0px 15px ${timerShadowColor}`,
position: 'absolute',
/**
* NOTE: Junbae go out of screen when horizontal scroll
* If you want to limit position of Junbae, use `%`
*/
right: '5vw',
top: '5%',
'font-size': '40px',
'font-family': 'monospace',
'font-weight': '900',
...timerLocation,
'z-index': 1,
'pointer-events': 'none',
'text-align': 'center',
})}`,
},
rangeBehavior: vscode.DecorationRangeBehavior.ClosedClosed,
Expand All @@ -159,4 +177,40 @@ export class WalkMode implements Mode {

this.decorationTimer = setInterval(updateComboTimerDecoration, 50);
}

private getLocation(firstVisibleRange: vscode.Range): Location {
const location = vscode.workspace.getConfiguration('junbae-mode').get('location');

switch (location) {
case 'bottom':
return {
range: new vscode.Range(firstVisibleRange.end, firstVisibleRange.end),
junbaeLocation: { 'font-size': '100px', bottom: '10px' },
timerLocation: { bottom: '70px' },
};
default:
return {
range: new vscode.Range(firstVisibleRange.start, firstVisibleRange.start),
junbaeLocation: { top: '5%', 'font-size': '50px' },
timerLocation: { top: '5%' },
};
}
}

private getTimerColor(): TimerColor {
const timerColorName = vscode.workspace.getConfiguration('junbae-mode').get('timerColor');

switch (timerColorName) {
case 'red':
return {
timerColor: '#C54B65',
timerShadowColor: '#FFC0CB',
};
default:
return {
timerColor: 'white',
timerShadowColor: '#015dee',
};
}
}
}

0 comments on commit 4a249e0

Please sign in to comment.