Mortise.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. MWF.xApplication.ScriptEditor.statement.Mortise = new Class({
  2. initialize: function(statement, node, types, input){
  3. this.statement = statement;
  4. this.types = types;
  5. this.node = node;
  6. this.area = this.statement.area;
  7. this.block = this.statement.block;
  8. this.editor = this.statement.editor;
  9. this.tenonStatement = null;
  10. this.input = input;
  11. this.load();
  12. },
  13. shine: function(){
  14. if (!this.shineNode){
  15. this.shineNode = new Element("div", {"styles": this.statement.css.mortiseShineNode}).inject(this.statement.areaNode);
  16. var size = this.input.getSize();
  17. var width = size.x-3;
  18. var height = size.y-3;
  19. this.shineNode.setStyles({
  20. "width": ""+width+"px",
  21. "height": ""+height+"px",
  22. "border-radius": ""+height/2+"px",
  23. "z-index": MWF.SES.zIndexPool.zIndex-2
  24. });
  25. this.shineNode.position({
  26. "relativeTo": this.input,
  27. "position": 'upperLeft',
  28. "edge": 'upperLeft',
  29. "offset": {"x": 0, "y": 0}
  30. });
  31. }
  32. },
  33. unshine: function(){
  34. if (this.shineNode) this.shineNode.destroy();
  35. this.shineNode = null;
  36. },
  37. tenon: function(){
  38. if (this.tenonStatement){
  39. if (this.input){
  40. this.inputDisplay = this.input.getStyle("display");
  41. this.input.setStyle("display", "none");
  42. }
  43. this.tenonStatement.node.inject(this.node);
  44. this.tenonStatement.node.setStyles({"position": "static", "top": "auto", "left": "auto"});
  45. }
  46. },
  47. split: function(){
  48. if (this.tenonStatement){
  49. if (this.input){
  50. this.input.setStyle("display", this.inputDisplay);
  51. }
  52. //var p = this.node.getPosition(this.tenonStatement.areaNode.getOffsetParent());
  53. var p = this.node.getPosition(this.tenonStatement.areaNode);
  54. //this.tenonStatement.node.setStyle("z-index", MWF.SES.zIndexPool.apply());
  55. this.tenonStatement.node.inject(this.tenonStatement.areaNode);
  56. this.tenonStatement.node.setStyles({
  57. "z-index": MWF.SES.zIndexPool.apply(),
  58. "position": "absolute",
  59. "left": ""+p.x+"px",
  60. "top": ""+p.y+"px"
  61. });
  62. this.tenonStatement = null;
  63. }
  64. },
  65. load :function(){
  66. }
  67. });