node.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. this.initialize = function() {
  2. this.previousVisible = undefined;
  3. this.previousListening = undefined;
  4. }
  5. this.toggleVisibility = function() {
  6. // isVisible will take care of 'inherit', and
  7. // trace up through the scene graph to determine
  8. // if the current state is visible or not
  9. if ( this.isVisible ) {
  10. this.visible = this.previousVisible ? this.previousVisible : false;
  11. } else {
  12. this.visible = this.previousVisible ? this.previousVisible : true;
  13. }
  14. var viz = this.visible;
  15. if ( viz === 'inherit' ) {
  16. this.previousVisible = 'inherit';
  17. } else {
  18. this.previousVisible = undefined;
  19. }
  20. }
  21. this.toggleListening = function() {
  22. // isListening will take care of 'inherit', and
  23. // trace up through the scene graph to determine
  24. // if the current state is listening or not
  25. if ( this.isListening ) {
  26. this.listening = this.previousListening ? this.previousListening : false;
  27. } else {
  28. this.listening = this.previousListening ? this.previousListening : true;
  29. }
  30. var listen = this.listening;
  31. if ( listen === 'inherit' ) {
  32. this.previousListening = 'inherit';
  33. } else {
  34. this.previousListening = undefined;
  35. }
  36. }
  37. //@ sourceURL=kinetic_node.js