NavigationHelpButtonViewModel.js 2.3 KB

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