NavigationHelpButtonViewModel.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import defineProperties from '../../Core/defineProperties.js';
  2. import knockout from '../../ThirdParty/knockout.js';
  3. import createCommand from '../createCommand.js';
  4. /**
  5. * The view model for {@link NavigationHelpButton}.
  6. * @alias NavigationHelpButtonViewModel
  7. * @constructor
  8. */
  9. function NavigationHelpButtonViewModel() {
  10. /**
  11. * Gets or sets whether the instructions are currently shown. This property is observable.
  12. * @type {Boolean}
  13. * @default false
  14. */
  15. this.showInstructions = false;
  16. var that = this;
  17. this._command = createCommand(function() {
  18. that.showInstructions = !that.showInstructions;
  19. });
  20. this._showClick = createCommand(function() {
  21. that._touch = false;
  22. });
  23. this._showTouch = createCommand(function() {
  24. that._touch = true;
  25. });
  26. this._touch = false;
  27. /**
  28. * Gets or sets the tooltip. This property is observable.
  29. *
  30. * @type {String}
  31. */
  32. this.tooltip = 'Navigation Instructions';
  33. knockout.track(this, ['tooltip', 'showInstructions', '_touch']);
  34. }
  35. defineProperties(NavigationHelpButtonViewModel.prototype, {
  36. /**
  37. * Gets the Command that is executed when the button is clicked.
  38. * @memberof NavigationHelpButtonViewModel.prototype
  39. *
  40. * @type {Command}
  41. */
  42. command : {
  43. get : function() {
  44. return this._command;
  45. }
  46. },
  47. /**
  48. * Gets the Command that is executed when the mouse instructions should be shown.
  49. * @memberof NavigationHelpButtonViewModel.prototype
  50. *
  51. * @type {Command}
  52. */
  53. showClick : {
  54. get : function() {
  55. return this._showClick;
  56. }
  57. },
  58. /**
  59. * Gets the Command that is executed when the touch instructions should be shown.
  60. * @memberof NavigationHelpButtonViewModel.prototype
  61. *
  62. * @type {Command}
  63. */
  64. showTouch : {
  65. get: function() {
  66. return this._showTouch;
  67. }
  68. }
  69. });
  70. export default NavigationHelpButtonViewModel;