not really known
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.7 KiB

  1. /**
  2. _enyo.CardSlideInArranger_ is an <a href="#enyo.Arranger">enyo.Arranger</a>
  3. that displays only one active control. The non-active controls are hidden
  4. with _setShowing(false)_. Transitions between arrangements are handled by
  5. sliding the new control over the current one.
  6. Note that CardSlideInArranger always slides controls in from the right. If
  7. you want an arranger that slides to the right and left, try
  8. <a href="#enyo.LeftRightArranger">enyo.LeftRightArranger</a>.
  9. */
  10. enyo.kind({
  11. name: "enyo.CardSlideInArranger",
  12. kind: "CardArranger",
  13. start: function() {
  14. var c$ = this.container.getPanels();
  15. for (var i=0, c; c=c$[i]; i++) {
  16. var wasShowing=c.showing;
  17. c.setShowing(i == this.container.fromIndex || i == (this.container.toIndex));
  18. if (c.showing && !wasShowing) {
  19. c.resized();
  20. }
  21. }
  22. var l = this.container.fromIndex;
  23. var i = this.container.toIndex;
  24. this.container.transitionPoints = [
  25. i + "." + l + ".s",
  26. i + "." + l + ".f"
  27. ];
  28. },
  29. finish: function() {
  30. this.inherited(arguments);
  31. var c$ = this.container.getPanels();
  32. for (var i=0, c; c=c$[i]; i++) {
  33. c.setShowing(i == this.container.toIndex);
  34. }
  35. },
  36. arrange: function(inC, inName) {
  37. var p = inName.split(".");
  38. var f = p[0], s= p[1], starting = (p[2] == "s");
  39. var b = this.containerBounds.width;
  40. for (var i=0, c$=this.container.getPanels(), c, v; c=c$[i]; i++) {
  41. v = b;
  42. if (s == i) {
  43. v = starting ? 0 : -b;
  44. }
  45. if (f == i) {
  46. v = starting ? b : 0;
  47. }
  48. if (s == i && s == f) {
  49. v = 0;
  50. }
  51. this.arrangeControl(c, {left: v});
  52. }
  53. },
  54. destroy: function() {
  55. var c$ = this.container.getPanels();
  56. for (var i=0, c; c=c$[i]; i++) {
  57. enyo.Arranger.positionControl(c, {left: null});
  58. }
  59. this.inherited(arguments);
  60. }
  61. });