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.

43 lines
1.1 KiB

  1. 
  2. // Test SVG support
  3. FoodChain.supportSVG = !!document.createElementNS && !!document.createElementNS('http://www.w3.org/2000/svg', "svg").createSVGRect;
  4. // Button component with image and shadow
  5. enyo.kind({
  6. name: "ShadowButton",
  7. kind: enyo.Control,
  8. published: {
  9. img: ""
  10. },
  11. classes: "shadowbutton-container",
  12. components: [
  13. { name: "button", kind: "Image", classes: "shadowbutton shadowbutton-image", onenter: "showShadow", onleave: "hideShadow" },
  14. { name: "buttonshadow", kind: "Image", classes: "shadowbutton-shadow shadowbutton-image" }
  15. ],
  16. // Constructor
  17. create: function() {
  18. this.inherited(arguments);
  19. this.imgChanged();
  20. this.$.buttonshadow.hide();
  21. },
  22. // Image name changed set images src
  23. imgChanged: function() {
  24. var ext = FoodChain.supportSVG ? ".svg" : ".png";
  25. this.$.button.setAttribute("src", "images/"+this.img+ext);
  26. this.$.buttonshadow.setAttribute("src", "images/"+this.img+"_shadow"+ext);
  27. },
  28. // Cursor on image, show shadow
  29. showShadow: function() {
  30. this.$.buttonshadow.show();
  31. return false;
  32. },
  33. // Cursor out of image, hide shadow
  34. hideShadow: function() {
  35. this.$.buttonshadow.hide();
  36. return false;
  37. }
  38. });