LetterProps.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. function LetterProps(o, sw, sc, fc, m, p) {
  2. this.o = o;
  3. this.sw = sw;
  4. this.sc = sc;
  5. this.fc = fc;
  6. this.m = m;
  7. this.p = p;
  8. this._mdf = {
  9. o: true,
  10. sw: !!sw,
  11. sc: !!sc,
  12. fc: !!fc,
  13. m: true,
  14. p: true,
  15. };
  16. }
  17. LetterProps.prototype.update = function (o, sw, sc, fc, m, p) {
  18. this._mdf.o = false;
  19. this._mdf.sw = false;
  20. this._mdf.sc = false;
  21. this._mdf.fc = false;
  22. this._mdf.m = false;
  23. this._mdf.p = false;
  24. var updated = false;
  25. if (this.o !== o) {
  26. this.o = o;
  27. this._mdf.o = true;
  28. updated = true;
  29. }
  30. if (this.sw !== sw) {
  31. this.sw = sw;
  32. this._mdf.sw = true;
  33. updated = true;
  34. }
  35. if (this.sc !== sc) {
  36. this.sc = sc;
  37. this._mdf.sc = true;
  38. updated = true;
  39. }
  40. if (this.fc !== fc) {
  41. this.fc = fc;
  42. this._mdf.fc = true;
  43. updated = true;
  44. }
  45. if (this.m !== m) {
  46. this.m = m;
  47. this._mdf.m = true;
  48. updated = true;
  49. }
  50. if (p.length && (this.p[0] !== p[0] || this.p[1] !== p[1] || this.p[4] !== p[4] || this.p[5] !== p[5] || this.p[12] !== p[12] || this.p[13] !== p[13])) {
  51. this.p = p;
  52. this._mdf.p = true;
  53. updated = true;
  54. }
  55. return updated;
  56. };
  57. export default LetterProps;