Viewmode.js 780 B

12345678910111213141516171819202122232425262728293031323334353637
  1. var Viewmode = {
  2. PANORAMA: 'panorama',
  3. DOLLHOUSE: 'dollhouse',
  4. FLOORPLAN: 'floorplan',
  5. TRANSITIONING: 'transitioning'
  6. }
  7. Viewmode.toInt = function(mode) {
  8. switch (mode) {
  9. case this.PANORAMA:
  10. return 1
  11. case this.DOLLHOUSE:
  12. return 2
  13. case this.FLOORPLAN:
  14. return 3
  15. case this.TRANSITIONING:
  16. return -1
  17. }
  18. throw new Error('未知模式: ' + c)
  19. }
  20. Viewmode.fromInt = function(mode) {
  21. switch (mode) {
  22. case '1':
  23. case 1:
  24. return this.PANORAMA
  25. case '2':
  26. case 2:
  27. return this.DOLLHOUSE
  28. case '3':
  29. case 3:
  30. return this.FLOORPLAN
  31. }
  32. throw new Error('未知模式: ' + c)
  33. }
  34. export default Viewmode