fingering.ts 668 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import flute from '/src/fingering/flute/index.json'
  2. import fluteFull from '/src/fingering/flute/full.png'
  3. const types: {
  4. [key: string]: any
  5. } = {
  6. flute: {
  7. json: flute,
  8. bg: fluteFull,
  9. relationship: {
  10. 70: [15, 18],
  11. },
  12. }
  13. }
  14. export default class Fingering {
  15. el = document.createElement('div')
  16. type = ''
  17. activeType: any = {}
  18. constructor(el: HTMLDivElement, type: string) {
  19. this.el = el
  20. this.type = type
  21. this.activeType = types[type]
  22. }
  23. show(fixedKey: number) {
  24. this.el.style.display = 'block'
  25. }
  26. hide() {
  27. this.el.style.display = 'none'
  28. }
  29. destroy() {
  30. this.el.innerHTML = ''
  31. this.hide()
  32. }
  33. }