Skip to content

Commit

Permalink
refactor: simplify the code by reusing the existing components
Browse files Browse the repository at this point in the history
  • Loading branch information
aradzie committed Mar 28, 2024
1 parent 836fc2b commit e7f65f7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 39 deletions.
14 changes: 10 additions & 4 deletions packages/keybr-keyboard/lib/keyboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { KeyCharacters } from "./keycharacters.ts";
import { KeyCombo } from "./keycombo.ts";
import { KeyModifier } from "./keymodifier.ts";
import { KeyShape } from "./keyshape.ts";
import { keyWeights } from "./keyweights.ts";
import { type Layout } from "./layout.ts";
import {
type CodePointDict,
Expand Down Expand Up @@ -101,9 +100,16 @@ export class Keyboard {
(!combo.alt || alt)
) {
list.push(combo.codePoint);
const weight = keyWeights.get(combo.id);
if (weight != null) {
weights.set(combo.codePoint, weight);
const shape = this.shapes.get(combo.id);
if (shape != null) {
switch (shape.row) {
case "home":
weights.set(combo.codePoint, 1);
break;
case "top":
weights.set(combo.codePoint, 2);
break;
}
}
}
}
Expand Down
35 changes: 0 additions & 35 deletions packages/keybr-keyboard/lib/keyweights.ts

This file was deleted.

0 comments on commit e7f65f7

Please sign in to comment.