diff --git a/build/dd-drop/dd-drop-coverage.js b/build/dd-drop/dd-drop-coverage.js index d78c1afb81a..b332fdc67ea 100644 --- a/build/dd-drop/dd-drop-coverage.js +++ b/build/dd-drop/dd-drop-coverage.js @@ -1,6 +1,6 @@ if (typeof __coverage__ === 'undefined') { __coverage__ = {}; } if (!__coverage__['build/dd-drop/dd-drop.js']) { - __coverage__['build/dd-drop/dd-drop.js'] = {"path":"build/dd-drop/dd-drop.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0,"106":0,"107":0,"108":0,"109":0,"110":0,"111":0,"112":0,"113":0,"114":0,"115":0,"116":0,"117":0,"118":0,"119":0,"120":0,"121":0,"122":0,"123":0,"124":0,"125":0,"126":0,"127":0,"128":0,"129":0,"130":0,"131":0,"132":0,"133":0,"134":0,"135":0,"136":0,"137":0,"138":0,"139":0,"140":0,"141":0,"142":0,"143":0,"144":0,"145":0,"146":0,"147":0,"148":0,"149":0,"150":0},"b":{"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0],"8":[0,0],"9":[0,0],"10":[0,0],"11":[0,0],"12":[0,0],"13":[0,0],"14":[0,0],"15":[0,0],"16":[0,0],"17":[0,0],"18":[0,0],"19":[0,0],"20":[0,0],"21":[0,0],"22":[0,0],"23":[0,0],"24":[0,0],"25":[0,0],"26":[0,0],"27":[0,0],"28":[0,0],"29":[0,0],"30":[0,0],"31":[0,0]},"f":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":38}}},"2":{"name":"(anonymous_2)","line":68,"loc":{"start":{"line":68,"column":11},"end":{"line":68,"column":22}}},"3":{"name":"(anonymous_3)","line":74,"loc":{"start":{"line":74,"column":32},"end":{"line":74,"column":43}}},"4":{"name":"(anonymous_4)","line":97,"loc":{"start":{"line":97,"column":20},"end":{"line":97,"column":35}}},"5":{"name":"(anonymous_5)","line":112,"loc":{"start":{"line":112,"column":20},"end":{"line":112,"column":31}}},"6":{"name":"(anonymous_6)","line":120,"loc":{"start":{"line":120,"column":20},"end":{"line":120,"column":32}}},"7":{"name":"(anonymous_7)","line":132,"loc":{"start":{"line":132,"column":20},"end":{"line":132,"column":32}}},"8":{"name":"(anonymous_8)","line":143,"loc":{"start":{"line":143,"column":20},"end":{"line":143,"column":35}}},"9":{"name":"(anonymous_9)","line":160,"loc":{"start":{"line":160,"column":20},"end":{"line":160,"column":32}}},"10":{"name":"(anonymous_10)","line":173,"loc":{"start":{"line":173,"column":20},"end":{"line":173,"column":32}}},"11":{"name":"(anonymous_11)","line":193,"loc":{"start":{"line":193,"column":20},"end":{"line":193,"column":32}}},"12":{"name":"(anonymous_12)","line":203,"loc":{"start":{"line":203,"column":25},"end":{"line":203,"column":37}}},"13":{"name":"(anonymous_13)","line":212,"loc":{"start":{"line":212,"column":23},"end":{"line":212,"column":34}}},"14":{"name":"(anonymous_14)","line":221,"loc":{"start":{"line":221,"column":29},"end":{"line":221,"column":41}}},"15":{"name":"(anonymous_15)","line":270,"loc":{"start":{"line":270,"column":17},"end":{"line":270,"column":34}}},"16":{"name":"(anonymous_16)","line":273,"loc":{"start":{"line":273,"column":33},"end":{"line":273,"column":45}}},"17":{"name":"(anonymous_17)","line":286,"loc":{"start":{"line":286,"column":21},"end":{"line":286,"column":32}}},"18":{"name":"(anonymous_18)","line":303,"loc":{"start":{"line":303,"column":20},"end":{"line":303,"column":31}}},"19":{"name":"(anonymous_19)","line":318,"loc":{"start":{"line":318,"column":25},"end":{"line":318,"column":36}}},"20":{"name":"(anonymous_20)","line":340,"loc":{"start":{"line":340,"column":23},"end":{"line":340,"column":34}}},"21":{"name":"(anonymous_21)","line":373,"loc":{"start":{"line":373,"column":18},"end":{"line":373,"column":29}}},"22":{"name":"(anonymous_22)","line":442,"loc":{"start":{"line":442,"column":21},"end":{"line":442,"column":32}}},"23":{"name":"(anonymous_23)","line":482,"loc":{"start":{"line":482,"column":27},"end":{"line":482,"column":38}}},"24":{"name":"(anonymous_24)","line":510,"loc":{"start":{"line":510,"column":26},"end":{"line":510,"column":37}}},"25":{"name":"(anonymous_25)","line":519,"loc":{"start":{"line":519,"column":25},"end":{"line":519,"column":36}}},"26":{"name":"(anonymous_26)","line":528,"loc":{"start":{"line":528,"column":20},"end":{"line":528,"column":36}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":552,"column":58}},"2":{"start":{"line":17,"column":4},"end":{"line":86,"column":6}},"3":{"start":{"line":69,"column":8},"end":{"line":69,"column":35}},"4":{"start":{"line":70,"column":8},"end":{"line":70,"column":59}},"5":{"start":{"line":74,"column":8},"end":{"line":76,"column":18}},"6":{"start":{"line":75,"column":12},"end":{"line":75,"column":49}},"7":{"start":{"line":77,"column":8},"end":{"line":77,"column":29}},"8":{"start":{"line":88,"column":4},"end":{"line":88,"column":23}},"9":{"start":{"line":90,"column":4},"end":{"line":178,"column":6}},"10":{"start":{"line":98,"column":16},"end":{"line":98,"column":36}},"11":{"start":{"line":99,"column":16},"end":{"line":101,"column":17}},"12":{"start":{"line":100,"column":20},"end":{"line":100,"column":68}},"13":{"start":{"line":102,"column":16},"end":{"line":102,"column":25}},"14":{"start":{"line":113,"column":16},"end":{"line":116,"column":17}},"15":{"start":{"line":114,"column":20},"end":{"line":114,"column":38}},"16":{"start":{"line":115,"column":20},"end":{"line":115,"column":30}},"17":{"start":{"line":118,"column":16},"end":{"line":118,"column":51}},"18":{"start":{"line":121,"column":16},"end":{"line":121,"column":47}},"19":{"start":{"line":122,"column":16},"end":{"line":122,"column":25}},"20":{"start":{"line":133,"column":16},"end":{"line":133,"column":47}},"21":{"start":{"line":144,"column":16},"end":{"line":148,"column":17}},"22":{"start":{"line":145,"column":20},"end":{"line":145,"column":77}},"23":{"start":{"line":147,"column":20},"end":{"line":147,"column":80}},"24":{"start":{"line":149,"column":16},"end":{"line":149,"column":28}},"25":{"start":{"line":161,"column":16},"end":{"line":161,"column":34}},"26":{"start":{"line":162,"column":16},"end":{"line":162,"column":25}},"27":{"start":{"line":174,"column":16},"end":{"line":174,"column":38}},"28":{"start":{"line":175,"column":16},"end":{"line":175,"column":25}},"29":{"start":{"line":180,"column":4},"end":{"line":545,"column":7}},"30":{"start":{"line":194,"column":12},"end":{"line":194,"column":35}},"31":{"start":{"line":195,"column":12},"end":{"line":195,"column":24}},"32":{"start":{"line":204,"column":12},"end":{"line":204,"column":35}},"33":{"start":{"line":205,"column":12},"end":{"line":205,"column":24}},"34":{"start":{"line":214,"column":12},"end":{"line":219,"column":14}},"35":{"start":{"line":221,"column":12},"end":{"line":230,"column":21}},"36":{"start":{"line":222,"column":16},"end":{"line":229,"column":19}},"37":{"start":{"line":271,"column":12},"end":{"line":271,"column":32}},"38":{"start":{"line":272,"column":12},"end":{"line":272,"column":28}},"39":{"start":{"line":273,"column":12},"end":{"line":278,"column":21}},"40":{"start":{"line":274,"column":16},"end":{"line":277,"column":17}},"41":{"start":{"line":275,"column":20},"end":{"line":275,"column":31}},"42":{"start":{"line":276,"column":20},"end":{"line":276,"column":39}},"43":{"start":{"line":279,"column":12},"end":{"line":279,"column":23}},"44":{"start":{"line":287,"column":12},"end":{"line":287,"column":51}},"45":{"start":{"line":289,"column":12},"end":{"line":289,"column":42}},"46":{"start":{"line":290,"column":12},"end":{"line":293,"column":13}},"47":{"start":{"line":291,"column":16},"end":{"line":291,"column":35}},"48":{"start":{"line":292,"column":16},"end":{"line":292,"column":35}},"49":{"start":{"line":294,"column":12},"end":{"line":294,"column":52}},"50":{"start":{"line":296,"column":12},"end":{"line":296,"column":51}},"51":{"start":{"line":304,"column":12},"end":{"line":304,"column":35}},"52":{"start":{"line":305,"column":12},"end":{"line":309,"column":13}},"53":{"start":{"line":306,"column":16},"end":{"line":306,"column":38}},"54":{"start":{"line":307,"column":16},"end":{"line":307,"column":35}},"55":{"start":{"line":308,"column":16},"end":{"line":308,"column":33}},"56":{"start":{"line":310,"column":12},"end":{"line":310,"column":65}},"57":{"start":{"line":311,"column":12},"end":{"line":311,"column":29}},"58":{"start":{"line":319,"column":12},"end":{"line":321,"column":13}},"59":{"start":{"line":320,"column":16},"end":{"line":320,"column":29}},"60":{"start":{"line":322,"column":12},"end":{"line":322,"column":78}},"61":{"start":{"line":323,"column":12},"end":{"line":323,"column":80}},"62":{"start":{"line":324,"column":12},"end":{"line":324,"column":70}},"63":{"start":{"line":326,"column":12},"end":{"line":332,"column":13}},"64":{"start":{"line":327,"column":16},"end":{"line":331,"column":19}},"65":{"start":{"line":333,"column":12},"end":{"line":333,"column":36}},"66":{"start":{"line":341,"column":12},"end":{"line":343,"column":13}},"67":{"start":{"line":342,"column":16},"end":{"line":342,"column":29}},"68":{"start":{"line":344,"column":12},"end":{"line":346,"column":13}},"69":{"start":{"line":345,"column":16},"end":{"line":345,"column":29}},"70":{"start":{"line":347,"column":12},"end":{"line":349,"column":13}},"71":{"start":{"line":348,"column":16},"end":{"line":348,"column":29}},"72":{"start":{"line":350,"column":12},"end":{"line":350,"column":38}},"73":{"start":{"line":353,"column":12},"end":{"line":366,"column":13}},"74":{"start":{"line":354,"column":16},"end":{"line":354,"column":74}},"75":{"start":{"line":355,"column":16},"end":{"line":355,"column":69}},"76":{"start":{"line":356,"column":16},"end":{"line":356,"column":36}},"77":{"start":{"line":357,"column":16},"end":{"line":357,"column":40}},"78":{"start":{"line":358,"column":16},"end":{"line":360,"column":17}},"79":{"start":{"line":359,"column":20},"end":{"line":359,"column":47}},"80":{"start":{"line":361,"column":16},"end":{"line":361,"column":32}},"81":{"start":{"line":363,"column":16},"end":{"line":363,"column":39}},"82":{"start":{"line":364,"column":16},"end":{"line":364,"column":72}},"83":{"start":{"line":365,"column":16},"end":{"line":365,"column":71}},"84":{"start":{"line":374,"column":12},"end":{"line":376,"column":13}},"85":{"start":{"line":375,"column":16},"end":{"line":375,"column":29}},"86":{"start":{"line":377,"column":12},"end":{"line":379,"column":13}},"87":{"start":{"line":378,"column":16},"end":{"line":378,"column":29}},"88":{"start":{"line":381,"column":12},"end":{"line":383,"column":13}},"89":{"start":{"line":382,"column":16},"end":{"line":382,"column":29}},"90":{"start":{"line":384,"column":12},"end":{"line":387,"column":13}},"91":{"start":{"line":385,"column":16},"end":{"line":385,"column":50}},"92":{"start":{"line":386,"column":16},"end":{"line":386,"column":29}},"93":{"start":{"line":388,"column":12},"end":{"line":393,"column":27}},"94":{"start":{"line":397,"column":12},"end":{"line":397,"column":39}},"95":{"start":{"line":398,"column":12},"end":{"line":398,"column":39}},"96":{"start":{"line":399,"column":12},"end":{"line":399,"column":35}},"97":{"start":{"line":400,"column":12},"end":{"line":400,"column":34}},"98":{"start":{"line":403,"column":12},"end":{"line":414,"column":13}},"99":{"start":{"line":405,"column":16},"end":{"line":405,"column":36}},"100":{"start":{"line":406,"column":16},"end":{"line":406,"column":53}},"101":{"start":{"line":407,"column":16},"end":{"line":407,"column":52}},"102":{"start":{"line":409,"column":16},"end":{"line":409,"column":31}},"103":{"start":{"line":410,"column":16},"end":{"line":410,"column":31}},"104":{"start":{"line":411,"column":16},"end":{"line":411,"column":53}},"105":{"start":{"line":412,"column":16},"end":{"line":412,"column":53}},"106":{"start":{"line":416,"column":12},"end":{"line":424,"column":13}},"107":{"start":{"line":418,"column":16},"end":{"line":423,"column":19}},"108":{"start":{"line":427,"column":12},"end":{"line":435,"column":14}},"109":{"start":{"line":444,"column":12},"end":{"line":447,"column":13}},"110":{"start":{"line":445,"column":16},"end":{"line":445,"column":52}},"111":{"start":{"line":446,"column":16},"end":{"line":446,"column":23}},"112":{"start":{"line":449,"column":12},"end":{"line":451,"column":13}},"113":{"start":{"line":450,"column":16},"end":{"line":450,"column":23}},"114":{"start":{"line":452,"column":12},"end":{"line":452,"column":37}},"115":{"start":{"line":454,"column":12},"end":{"line":472,"column":13}},"116":{"start":{"line":455,"column":16},"end":{"line":455,"column":92}},"117":{"start":{"line":456,"column":16},"end":{"line":466,"column":19}},"118":{"start":{"line":468,"column":16},"end":{"line":468,"column":39}},"119":{"start":{"line":470,"column":16},"end":{"line":470,"column":71}},"120":{"start":{"line":471,"column":16},"end":{"line":471,"column":69}},"121":{"start":{"line":475,"column":12},"end":{"line":475,"column":26}},"122":{"start":{"line":483,"column":12},"end":{"line":503,"column":13}},"123":{"start":{"line":484,"column":16},"end":{"line":484,"column":71}},"124":{"start":{"line":485,"column":16},"end":{"line":485,"column":38}},"125":{"start":{"line":486,"column":16},"end":{"line":486,"column":44}},"126":{"start":{"line":487,"column":16},"end":{"line":500,"column":17}},"127":{"start":{"line":488,"column":20},"end":{"line":488,"column":91}},"128":{"start":{"line":489,"column":20},"end":{"line":489,"column":82}},"129":{"start":{"line":492,"column":20},"end":{"line":499,"column":21}},"130":{"start":{"line":493,"column":24},"end":{"line":493,"column":47}},"131":{"start":{"line":494,"column":24},"end":{"line":494,"column":87}},"132":{"start":{"line":495,"column":24},"end":{"line":495,"column":96}},"133":{"start":{"line":496,"column":24},"end":{"line":496,"column":89}},"134":{"start":{"line":502,"column":16},"end":{"line":502,"column":34}},"135":{"start":{"line":511,"column":12},"end":{"line":511,"column":48}},"136":{"start":{"line":512,"column":12},"end":{"line":512,"column":37}},"137":{"start":{"line":520,"column":12},"end":{"line":520,"column":46}},"138":{"start":{"line":521,"column":12},"end":{"line":521,"column":40}},"139":{"start":{"line":529,"column":12},"end":{"line":543,"column":13}},"140":{"start":{"line":530,"column":16},"end":{"line":542,"column":17}},"141":{"start":{"line":531,"column":20},"end":{"line":531,"column":44}},"142":{"start":{"line":532,"column":20},"end":{"line":534,"column":21}},"143":{"start":{"line":533,"column":24},"end":{"line":533,"column":52}},"144":{"start":{"line":535,"column":20},"end":{"line":541,"column":21}},"145":{"start":{"line":536,"column":24},"end":{"line":536,"column":82}},"146":{"start":{"line":537,"column":24},"end":{"line":537,"column":92}},"147":{"start":{"line":538,"column":24},"end":{"line":538,"column":86}},"148":{"start":{"line":539,"column":24},"end":{"line":539,"column":95}},"149":{"start":{"line":540,"column":24},"end":{"line":540,"column":52}},"150":{"start":{"line":547,"column":4},"end":{"line":547,"column":21}}},"branchMap":{"1":{"line":99,"type":"if","locations":[{"start":{"line":99,"column":16},"end":{"line":99,"column":16}},{"start":{"line":99,"column":16},"end":{"line":99,"column":16}}]},"2":{"line":113,"type":"if","locations":[{"start":{"line":113,"column":16},"end":{"line":113,"column":16}},{"start":{"line":113,"column":16},"end":{"line":113,"column":16}}]},"3":{"line":144,"type":"if","locations":[{"start":{"line":144,"column":16},"end":{"line":144,"column":16}},{"start":{"line":144,"column":16},"end":{"line":144,"column":16}}]},"4":{"line":274,"type":"if","locations":[{"start":{"line":274,"column":16},"end":{"line":274,"column":16}},{"start":{"line":274,"column":16},"end":{"line":274,"column":16}}]},"5":{"line":290,"type":"if","locations":[{"start":{"line":290,"column":12},"end":{"line":290,"column":12}},{"start":{"line":290,"column":12},"end":{"line":290,"column":12}}]},"6":{"line":305,"type":"if","locations":[{"start":{"line":305,"column":12},"end":{"line":305,"column":12}},{"start":{"line":305,"column":12},"end":{"line":305,"column":12}}]},"7":{"line":305,"type":"binary-expr","locations":[{"start":{"line":305,"column":16},"end":{"line":305,"column":25}},{"start":{"line":305,"column":30},"end":{"line":305,"column":58}}]},"8":{"line":319,"type":"if","locations":[{"start":{"line":319,"column":12},"end":{"line":319,"column":12}},{"start":{"line":319,"column":12},"end":{"line":319,"column":12}}]},"9":{"line":326,"type":"if","locations":[{"start":{"line":326,"column":12},"end":{"line":326,"column":12}},{"start":{"line":326,"column":12},"end":{"line":326,"column":12}}]},"10":{"line":341,"type":"if","locations":[{"start":{"line":341,"column":12},"end":{"line":341,"column":12}},{"start":{"line":341,"column":12},"end":{"line":341,"column":12}}]},"11":{"line":344,"type":"if","locations":[{"start":{"line":344,"column":12},"end":{"line":344,"column":12}},{"start":{"line":344,"column":12},"end":{"line":344,"column":12}}]},"12":{"line":347,"type":"if","locations":[{"start":{"line":347,"column":12},"end":{"line":347,"column":12}},{"start":{"line":347,"column":12},"end":{"line":347,"column":12}}]},"13":{"line":353,"type":"if","locations":[{"start":{"line":353,"column":12},"end":{"line":353,"column":12}},{"start":{"line":353,"column":12},"end":{"line":353,"column":12}}]},"14":{"line":358,"type":"if","locations":[{"start":{"line":358,"column":16},"end":{"line":358,"column":16}},{"start":{"line":358,"column":16},"end":{"line":358,"column":16}}]},"15":{"line":374,"type":"if","locations":[{"start":{"line":374,"column":12},"end":{"line":374,"column":12}},{"start":{"line":374,"column":12},"end":{"line":374,"column":12}}]},"16":{"line":377,"type":"if","locations":[{"start":{"line":377,"column":12},"end":{"line":377,"column":12}},{"start":{"line":377,"column":12},"end":{"line":377,"column":12}}]},"17":{"line":381,"type":"if","locations":[{"start":{"line":381,"column":12},"end":{"line":381,"column":12}},{"start":{"line":381,"column":12},"end":{"line":381,"column":12}}]},"18":{"line":384,"type":"if","locations":[{"start":{"line":384,"column":12},"end":{"line":384,"column":12}},{"start":{"line":384,"column":12},"end":{"line":384,"column":12}}]},"19":{"line":403,"type":"if","locations":[{"start":{"line":403,"column":12},"end":{"line":403,"column":12}},{"start":{"line":403,"column":12},"end":{"line":403,"column":12}}]},"20":{"line":416,"type":"if","locations":[{"start":{"line":416,"column":12},"end":{"line":416,"column":12}},{"start":{"line":416,"column":12},"end":{"line":416,"column":12}}]},"21":{"line":444,"type":"if","locations":[{"start":{"line":444,"column":12},"end":{"line":444,"column":12}},{"start":{"line":444,"column":12},"end":{"line":444,"column":12}}]},"22":{"line":449,"type":"if","locations":[{"start":{"line":449,"column":12},"end":{"line":449,"column":12}},{"start":{"line":449,"column":12},"end":{"line":449,"column":12}}]},"23":{"line":454,"type":"if","locations":[{"start":{"line":454,"column":12},"end":{"line":454,"column":12}},{"start":{"line":454,"column":12},"end":{"line":454,"column":12}}]},"24":{"line":483,"type":"if","locations":[{"start":{"line":483,"column":12},"end":{"line":483,"column":12}},{"start":{"line":483,"column":12},"end":{"line":483,"column":12}}]},"25":{"line":487,"type":"if","locations":[{"start":{"line":487,"column":16},"end":{"line":487,"column":16}},{"start":{"line":487,"column":16},"end":{"line":487,"column":16}}]},"26":{"line":492,"type":"if","locations":[{"start":{"line":492,"column":20},"end":{"line":492,"column":20}},{"start":{"line":492,"column":20},"end":{"line":492,"column":20}}]},"27":{"line":529,"type":"if","locations":[{"start":{"line":529,"column":12},"end":{"line":529,"column":12}},{"start":{"line":529,"column":12},"end":{"line":529,"column":12}}]},"28":{"line":529,"type":"binary-expr","locations":[{"start":{"line":529,"column":16},"end":{"line":529,"column":39}},{"start":{"line":529,"column":43},"end":{"line":529,"column":48}}]},"29":{"line":530,"type":"if","locations":[{"start":{"line":530,"column":16},"end":{"line":530,"column":16}},{"start":{"line":530,"column":16},"end":{"line":530,"column":16}}]},"30":{"line":532,"type":"if","locations":[{"start":{"line":532,"column":20},"end":{"line":532,"column":20}},{"start":{"line":532,"column":20},"end":{"line":532,"column":20}}]},"31":{"line":535,"type":"if","locations":[{"start":{"line":535,"column":20},"end":{"line":535,"column":20}},{"start":{"line":535,"column":20},"end":{"line":535,"column":20}}]}},"code":["(function () { YUI.add('dd-drop', function (Y, NAME) {","",""," /**"," * Provides the ability to create a Drop Target."," * @module dd"," * @submodule dd-drop"," */"," /**"," * Provides the ability to create a Drop Target."," * @class Drop"," * @extends Base"," * @constructor"," * @namespace DD"," */",""," var NODE = 'node',"," DDM = Y.DD.DDM,"," OFFSET_HEIGHT = 'offsetHeight',"," OFFSET_WIDTH = 'offsetWidth',"," /**"," * Fires when a drag element is over this target."," * @event drop:over"," * @param {EventFacade} event An Event Facade object with the following specific property added:"," *
"," *
drop
The drop object at the time of the event.
"," *
drag
The drag object at the time of the event.
"," *
"," * @bubbles DDM"," * @type {CustomEvent}"," */"," EV_DROP_OVER = 'drop:over',"," /**"," * Fires when a drag element enters this target."," * @event drop:enter"," * @param {EventFacade} event An Event Facade object with the following specific property added:"," *
"," *
drop
The drop object at the time of the event.
"," *
drag
The drag object at the time of the event.
"," *
"," * @bubbles DDM"," * @type {CustomEvent}"," */"," EV_DROP_ENTER = 'drop:enter',"," /**"," * Fires when a drag element exits this target."," * @event drop:exit"," * @param {EventFacade} event An Event Facade object"," * @bubbles DDM"," * @type {CustomEvent}"," */"," EV_DROP_EXIT = 'drop:exit',",""," /**"," * Fires when a draggable node is dropped on this Drop Target. (Fired from dd-ddm-drop)"," * @event drop:hit"," * @param {EventFacade} event An Event Facade object with the following specific property added:"," *
"," *
drop
The best guess on what was dropped on.
"," *
drag
The drag object at the time of the event.
"," *
others
An array of all the other drop targets that was dropped on.
"," *
"," * @bubbles DDM"," * @type {CustomEvent}"," */","",""," Drop = function() {"," this._lazyAddAttrs = false;"," Drop.superclass.constructor.apply(this, arguments);","",""," //DD init speed up."," Y.on('domready', Y.bind(function() {"," Y.later(100, this, this._createShim);"," }, this));"," DDM._regTarget(this);",""," /* TODO"," if (Dom.getStyle(this.el, 'position') == 'fixed') {"," Event.on(window, 'scroll', function() {"," this.activateShim();"," }, this, true);"," }"," */"," };",""," Drop.NAME = 'drop';",""," Drop.ATTRS = {"," /**"," * Y.Node instance to use as the element to make a Drop Target"," * @attribute node"," * @type Node"," */"," node: {"," setter: function(node) {"," var n = Y.one(node);"," if (!n) {"," Y.error('DD.Drop: Invalid Node Given: ' + node);"," }"," return n;"," }"," },"," /**"," * Array of groups to add this drop into."," * @attribute groups"," * @type Array"," */"," groups: {"," value: ['default'],"," getter: function() {"," if (!this._groups) {"," this._groups = {};"," return [];"," }",""," return Y.Object.keys(this._groups);"," },"," setter: function(g) {"," this._groups = Y.Array.hash(g);"," return g;"," }"," },"," /**"," * CSS style padding to make the Drop Target bigger than the node."," * @attribute padding"," * @type String"," */"," padding: {"," value: '0',"," setter: function(p) {"," return DDM.cssSizestoObject(p);"," }"," },"," /**"," * Set to lock this drop element."," * @attribute lock"," * @type Boolean"," */"," lock: {"," value: false,"," setter: function(lock) {"," if (lock) {"," this.get(NODE).addClass(DDM.CSS_PREFIX + '-drop-locked');"," } else {"," this.get(NODE).removeClass(DDM.CSS_PREFIX + '-drop-locked');"," }"," return lock;"," }"," },"," /**"," * Controls the default bubble parent for this Drop instance. Default: Y.DD.DDM. Set to false to disable bubbling."," * Use bubbleTargets in config."," * @deprecated"," * @attribute bubbles"," * @type Object"," */"," bubbles: {"," setter: function(t) {"," this.addTarget(t);"," return t;"," }"," },"," /**"," * Use the Drop shim. Default: true"," * @deprecated"," * @attribute useShim"," * @type Boolean"," */"," useShim: {"," value: true,"," setter: function(v) {"," Y.DD.DDM._noShim = !v;"," return v;"," }"," }"," };",""," Y.extend(Drop, Y.Base, {"," /**"," * The default bubbleTarget for this object. Default: Y.DD.DDM"," * @private"," * @property _bubbleTargets"," */"," _bubbleTargets: Y.DD.DDM,"," /**"," * Add this Drop instance to a group, this should be used for on-the-fly group additions."," * @method addToGroup"," * @param {String} g The group to add this Drop Instance to."," * @chainable"," */"," addToGroup: function(g) {"," this._groups[g] = true;"," return this;"," },"," /**"," * Remove this Drop instance from a group, this should be used for on-the-fly group removals."," * @method removeFromGroup"," * @param {String} g The group to remove this Drop Instance from."," * @chainable"," */"," removeFromGroup: function(g) {"," delete this._groups[g];"," return this;"," },"," /**"," * This method creates all the events for this Event Target and publishes them so we get Event Bubbling."," * @private"," * @method _createEvents"," */"," _createEvents: function() {",""," var ev = ["," EV_DROP_OVER,"," EV_DROP_ENTER,"," EV_DROP_EXIT,"," 'drop:hit'"," ];",""," Y.Array.each(ev, function(v) {"," this.publish(v, {"," type: v,"," emitFacade: true,"," preventable: false,"," bubbles: true,"," queuable: false,"," prefix: 'drop'"," });"," }, this);"," },"," /**"," * Flag for determining if the target is valid in this operation."," * @private"," * @property _valid"," * @type Boolean"," */"," _valid: null,"," /**"," * The groups this target belongs to."," * @private"," * @property _groups"," * @type Array"," */"," _groups: null,"," /**"," * Node reference to the targets shim"," * @property shim"," * @type {Object}"," */"," shim: null,"," /**"," * A region object associated with this target, used for checking regions while dragging."," * @property region"," * @type Object"," */"," region: null,"," /**"," * This flag is tripped when a drag element is over this target."," * @property overTarget"," * @type Boolean"," */"," overTarget: null,"," /**"," * Check if this target is in one of the supplied groups."," * @method inGroup"," * @param {Array} groups The groups to check against"," * @return Boolean"," */"," inGroup: function(groups) {"," this._valid = false;"," var ret = false;"," Y.Array.each(groups, function(v) {"," if (this._groups[v]) {"," ret = true;"," this._valid = true;"," }"," }, this);"," return ret;"," },"," /**"," * Private lifecycle method"," * @private"," * @method initializer"," */"," initializer: function() {"," Y.later(100, this, this._createEvents);",""," var node = this.get(NODE), id;"," if (!node.get('id')) {"," id = Y.stamp(node);"," node.set('id', id);"," }"," node.addClass(DDM.CSS_PREFIX + '-drop');"," //Shouldn't have to do this.."," this.set('groups', this.get('groups'));"," },"," /**"," * Lifecycle destructor, unreg the drag from the DDM and remove listeners"," * @private"," * @method destructor"," */"," destructor: function() {"," DDM._unregTarget(this);"," if (this.shim && (this.shim !== this.get(NODE))) {"," this.shim.detachAll();"," this.shim.remove();"," this.shim = null;"," }"," this.get(NODE).removeClass(DDM.CSS_PREFIX + '-drop');"," this.detachAll();"," },"," /**"," * Removes classes from the target, resets some flags and sets the shims deactive position [-999, -999]"," * @private"," * @method _deactivateShim"," */"," _deactivateShim: function() {"," if (!this.shim) {"," return false;"," }"," this.get(NODE).removeClass(DDM.CSS_PREFIX + '-drop-active-valid');"," this.get(NODE).removeClass(DDM.CSS_PREFIX + '-drop-active-invalid');"," this.get(NODE).removeClass(DDM.CSS_PREFIX + '-drop-over');",""," if (this.get('useShim')) {"," this.shim.setStyles({"," top: '-999px',"," left: '-999px',"," zIndex: '1'"," });"," }"," this.overTarget = false;"," },"," /**"," * Activates the shim and adds some interaction CSS classes"," * @private"," * @method _activateShim"," */"," _activateShim: function() {"," if (!DDM.activeDrag) {"," return false; //Nothing is dragging, no reason to activate."," }"," if (this.get(NODE) === DDM.activeDrag.get(NODE)) {"," return false;"," }"," if (this.get('lock')) {"," return false;"," }"," var node = this.get(NODE);"," //TODO Visibility Check.."," //if (this.inGroup(DDM.activeDrag.get('groups')) && this.get(NODE).isVisible()) {"," if (this.inGroup(DDM.activeDrag.get('groups'))) {"," node.removeClass(DDM.CSS_PREFIX + '-drop-active-invalid');"," node.addClass(DDM.CSS_PREFIX + '-drop-active-valid');"," DDM._addValid(this);"," this.overTarget = false;"," if (!this.get('useShim')) {"," this.shim = this.get(NODE);"," }"," this.sizeShim();"," } else {"," DDM._removeValid(this);"," node.removeClass(DDM.CSS_PREFIX + '-drop-active-valid');"," node.addClass(DDM.CSS_PREFIX + '-drop-active-invalid');"," }"," },"," /**"," * Positions and sizes the shim with the raw data from the node,"," * this can be used to programatically adjust the Targets shim for Animation.."," * @method sizeShim"," */"," sizeShim: function() {"," if (!DDM.activeDrag) {"," return false; //Nothing is dragging, no reason to activate."," }"," if (this.get(NODE) === DDM.activeDrag.get(NODE)) {"," return false;"," }"," //if (this.get('lock') || !this.get('useShim')) {"," if (this.get('lock')) {"," return false;"," }"," if (!this.shim) {"," Y.later(100, this, this.sizeShim);"," return false;"," }"," var node = this.get(NODE),"," nh = node.get(OFFSET_HEIGHT),"," nw = node.get(OFFSET_WIDTH),"," xy = node.getXY(),"," p = this.get('padding'),"," dd, dH, dW;","",""," //Apply padding"," nw = nw + p.left + p.right;"," nh = nh + p.top + p.bottom;"," xy[0] = xy[0] - p.left;"," xy[1] = xy[1] - p.top;","",""," if (DDM.activeDrag.get('dragMode') === DDM.INTERSECT) {"," //Intersect Mode, make the shim bigger"," dd = DDM.activeDrag;"," dH = dd.get(NODE).get(OFFSET_HEIGHT);"," dW = dd.get(NODE).get(OFFSET_WIDTH);",""," nh = (nh + dH);"," nw = (nw + dW);"," xy[0] = xy[0] - (dW - dd.deltaXY[0]);"," xy[1] = xy[1] - (dH - dd.deltaXY[1]);",""," }",""," if (this.get('useShim')) {"," //Set the style on the shim"," this.shim.setStyles({"," height: nh + 'px',"," width: nw + 'px',"," top: xy[1] + 'px',"," left: xy[0] + 'px'"," });"," }",""," //Create the region to be used by intersect when a drag node is over us."," this.region = {"," '0': xy[0],"," '1': xy[1],"," area: 0,"," top: xy[1],"," right: xy[0] + nw,"," bottom: xy[1] + nh,"," left: xy[0]"," };"," },"," /**"," * Creates the Target shim and adds it to the DDM's playground.."," * @private"," * @method _createShim"," */"," _createShim: function() {"," //No playground, defer"," if (!DDM._pg) {"," Y.later(10, this, this._createShim);"," return;"," }"," //Shim already here, cancel"," if (this.shim) {"," return;"," }"," var s = this.get('node');",""," if (this.get('useShim')) {"," s = Y.Node.create('
');"," s.setStyles({"," height: this.get(NODE).get(OFFSET_HEIGHT) + 'px',"," width: this.get(NODE).get(OFFSET_WIDTH) + 'px',"," backgroundColor: 'yellow',"," opacity: '.5',"," zIndex: '1',"," overflow: 'hidden',"," top: '-900px',"," left: '-900px',"," position: 'absolute'"," });",""," DDM._pg.appendChild(s);",""," s.on('mouseover', Y.bind(this._handleOverEvent, this));"," s.on('mouseout', Y.bind(this._handleOutEvent, this));"," }","",""," this.shim = s;"," },"," /**"," * This handles the over target call made from this object or from the DDM"," * @private"," * @method _handleOverTarget"," */"," _handleTargetOver: function() {"," if (DDM.isOverTarget(this)) {"," this.get(NODE).addClass(DDM.CSS_PREFIX + '-drop-over');"," DDM.activeDrop = this;"," DDM.otherDrops[this] = this;"," if (this.overTarget) {"," DDM.activeDrag.fire('drag:over', { drop: this, drag: DDM.activeDrag });"," this.fire(EV_DROP_OVER, { drop: this, drag: DDM.activeDrag });"," } else {"," //Prevent an enter before a start.."," if (DDM.activeDrag.get('dragging')) {"," this.overTarget = true;"," this.fire(EV_DROP_ENTER, { drop: this, drag: DDM.activeDrag });"," DDM.activeDrag.fire('drag:enter', { drop: this, drag: DDM.activeDrag });"," DDM.activeDrag.get(NODE).addClass(DDM.CSS_PREFIX + '-drag-over');"," //TODO - Is this needed??"," //DDM._handleTargetOver();"," }"," }"," } else {"," this._handleOut();"," }"," },"," /**"," * Handles the mouseover DOM event on the Target Shim"," * @private"," * @method _handleOverEvent"," */"," _handleOverEvent: function() {"," this.shim.setStyle('zIndex', '999');"," DDM._addActiveShim(this);"," },"," /**"," * Handles the mouseout DOM event on the Target Shim"," * @private"," * @method _handleOutEvent"," */"," _handleOutEvent: function() {"," this.shim.setStyle('zIndex', '1');"," DDM._removeActiveShim(this);"," },"," /**"," * Handles out of target calls/checks"," * @private"," * @method _handleOut"," */"," _handleOut: function(force) {"," if (!DDM.isOverTarget(this) || force) {"," if (this.overTarget) {"," this.overTarget = false;"," if (!force) {"," DDM._removeActiveShim(this);"," }"," if (DDM.activeDrag) {"," this.get(NODE).removeClass(DDM.CSS_PREFIX + '-drop-over');"," DDM.activeDrag.get(NODE).removeClass(DDM.CSS_PREFIX + '-drag-over');"," this.fire(EV_DROP_EXIT, { drop: this, drag: DDM.activeDrag });"," DDM.activeDrag.fire('drag:exit', { drop: this, drag: DDM.activeDrag });"," delete DDM.otherDrops[this];"," }"," }"," }"," }"," });",""," Y.DD.Drop = Drop;","","","","","}, '@VERSION@', {\"requires\": [\"dd-drag\", \"dd-ddm-drop\"]});","","}());"]}; + __coverage__['build/dd-drop/dd-drop.js'] = {"path":"build/dd-drop/dd-drop.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0,"106":0,"107":0,"108":0,"109":0,"110":0,"111":0,"112":0,"113":0,"114":0,"115":0,"116":0,"117":0,"118":0,"119":0,"120":0,"121":0,"122":0,"123":0,"124":0,"125":0,"126":0,"127":0,"128":0,"129":0,"130":0,"131":0,"132":0,"133":0,"134":0,"135":0,"136":0,"137":0,"138":0,"139":0,"140":0,"141":0,"142":0,"143":0,"144":0,"145":0,"146":0,"147":0,"148":0,"149":0,"150":0,"151":0,"152":0,"153":0,"154":0,"155":0,"156":0,"157":0,"158":0,"159":0,"160":0},"b":{"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0],"8":[0,0],"9":[0,0],"10":[0,0],"11":[0,0],"12":[0,0],"13":[0,0],"14":[0,0],"15":[0,0],"16":[0,0],"17":[0,0],"18":[0,0],"19":[0,0],"20":[0,0],"21":[0,0],"22":[0,0],"23":[0,0],"24":[0,0],"25":[0,0],"26":[0,0],"27":[0,0],"28":[0,0],"29":[0,0],"30":[0,0],"31":[0,0]},"f":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":38}}},"2":{"name":"(anonymous_2)","line":68,"loc":{"start":{"line":68,"column":11},"end":{"line":68,"column":22}}},"3":{"name":"(anonymous_3)","line":79,"loc":{"start":{"line":79,"column":32},"end":{"line":79,"column":43}}},"4":{"name":"(anonymous_4)","line":102,"loc":{"start":{"line":102,"column":20},"end":{"line":102,"column":35}}},"5":{"name":"(anonymous_5)","line":117,"loc":{"start":{"line":117,"column":20},"end":{"line":117,"column":31}}},"6":{"name":"(anonymous_6)","line":125,"loc":{"start":{"line":125,"column":20},"end":{"line":125,"column":32}}},"7":{"name":"(anonymous_7)","line":137,"loc":{"start":{"line":137,"column":20},"end":{"line":137,"column":32}}},"8":{"name":"(anonymous_8)","line":148,"loc":{"start":{"line":148,"column":20},"end":{"line":148,"column":35}}},"9":{"name":"(anonymous_9)","line":165,"loc":{"start":{"line":165,"column":20},"end":{"line":165,"column":32}}},"10":{"name":"(anonymous_10)","line":178,"loc":{"start":{"line":178,"column":20},"end":{"line":178,"column":32}}},"11":{"name":"Drop_createShim","line":185,"loc":{"start":{"line":185,"column":4},"end":{"line":185,"column":31}}},"12":{"name":"createShimNode","line":202,"loc":{"start":{"line":202,"column":4},"end":{"line":202,"column":37}}},"13":{"name":"(anonymous_13)","line":247,"loc":{"start":{"line":247,"column":20},"end":{"line":247,"column":32}}},"14":{"name":"(anonymous_14)","line":257,"loc":{"start":{"line":257,"column":25},"end":{"line":257,"column":37}}},"15":{"name":"(anonymous_15)","line":266,"loc":{"start":{"line":266,"column":23},"end":{"line":266,"column":34}}},"16":{"name":"(anonymous_16)","line":275,"loc":{"start":{"line":275,"column":29},"end":{"line":275,"column":41}}},"17":{"name":"(anonymous_17)","line":324,"loc":{"start":{"line":324,"column":17},"end":{"line":324,"column":34}}},"18":{"name":"(anonymous_18)","line":327,"loc":{"start":{"line":327,"column":33},"end":{"line":327,"column":45}}},"19":{"name":"(anonymous_19)","line":340,"loc":{"start":{"line":340,"column":21},"end":{"line":340,"column":32}}},"20":{"name":"(anonymous_20)","line":357,"loc":{"start":{"line":357,"column":20},"end":{"line":357,"column":31}}},"21":{"name":"(anonymous_21)","line":372,"loc":{"start":{"line":372,"column":25},"end":{"line":372,"column":36}}},"22":{"name":"(anonymous_22)","line":394,"loc":{"start":{"line":394,"column":23},"end":{"line":394,"column":34}}},"23":{"name":"(anonymous_23)","line":427,"loc":{"start":{"line":427,"column":18},"end":{"line":427,"column":29}}},"24":{"name":"(anonymous_24)","line":497,"loc":{"start":{"line":497,"column":27},"end":{"line":497,"column":38}}},"25":{"name":"(anonymous_25)","line":525,"loc":{"start":{"line":525,"column":26},"end":{"line":525,"column":37}}},"26":{"name":"(anonymous_26)","line":534,"loc":{"start":{"line":534,"column":25},"end":{"line":534,"column":36}}},"27":{"name":"(anonymous_27)","line":543,"loc":{"start":{"line":543,"column":20},"end":{"line":543,"column":36}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":567,"column":58}},"2":{"start":{"line":17,"column":4},"end":{"line":91,"column":6}},"3":{"start":{"line":69,"column":8},"end":{"line":69,"column":35}},"4":{"start":{"line":70,"column":8},"end":{"line":70,"column":59}},"5":{"start":{"line":79,"column":8},"end":{"line":81,"column":18}},"6":{"start":{"line":80,"column":12},"end":{"line":80,"column":48}},"7":{"start":{"line":82,"column":8},"end":{"line":82,"column":29}},"8":{"start":{"line":93,"column":4},"end":{"line":93,"column":23}},"9":{"start":{"line":95,"column":4},"end":{"line":183,"column":6}},"10":{"start":{"line":103,"column":16},"end":{"line":103,"column":36}},"11":{"start":{"line":104,"column":16},"end":{"line":106,"column":17}},"12":{"start":{"line":105,"column":20},"end":{"line":105,"column":68}},"13":{"start":{"line":107,"column":16},"end":{"line":107,"column":25}},"14":{"start":{"line":118,"column":16},"end":{"line":121,"column":17}},"15":{"start":{"line":119,"column":20},"end":{"line":119,"column":38}},"16":{"start":{"line":120,"column":20},"end":{"line":120,"column":30}},"17":{"start":{"line":123,"column":16},"end":{"line":123,"column":51}},"18":{"start":{"line":126,"column":16},"end":{"line":126,"column":47}},"19":{"start":{"line":127,"column":16},"end":{"line":127,"column":25}},"20":{"start":{"line":138,"column":16},"end":{"line":138,"column":47}},"21":{"start":{"line":149,"column":16},"end":{"line":153,"column":17}},"22":{"start":{"line":150,"column":20},"end":{"line":150,"column":77}},"23":{"start":{"line":152,"column":20},"end":{"line":152,"column":80}},"24":{"start":{"line":154,"column":16},"end":{"line":154,"column":28}},"25":{"start":{"line":166,"column":16},"end":{"line":166,"column":34}},"26":{"start":{"line":167,"column":16},"end":{"line":167,"column":25}},"27":{"start":{"line":179,"column":16},"end":{"line":179,"column":38}},"28":{"start":{"line":180,"column":16},"end":{"line":180,"column":25}},"29":{"start":{"line":185,"column":4},"end":{"line":200,"column":5}},"30":{"start":{"line":187,"column":8},"end":{"line":190,"column":9}},"31":{"start":{"line":188,"column":12},"end":{"line":188,"column":47}},"32":{"start":{"line":189,"column":12},"end":{"line":189,"column":19}},"33":{"start":{"line":191,"column":8},"end":{"line":191,"column":30}},"34":{"start":{"line":191,"column":23},"end":{"line":191,"column":30}},"35":{"start":{"line":193,"column":8},"end":{"line":193,"column":33}},"36":{"start":{"line":195,"column":8},"end":{"line":199,"column":9}},"37":{"start":{"line":196,"column":12},"end":{"line":196,"column":36}},"38":{"start":{"line":198,"column":12},"end":{"line":198,"column":26}},"39":{"start":{"line":202,"column":4},"end":{"line":232,"column":5}},"40":{"start":{"line":203,"column":8},"end":{"line":203,"column":18}},"41":{"start":{"line":204,"column":8},"end":{"line":211,"column":9}},"42":{"start":{"line":205,"column":12},"end":{"line":205,"column":29}},"43":{"start":{"line":210,"column":12},"end":{"line":210,"column":21}},"44":{"start":{"line":213,"column":8},"end":{"line":213,"column":71}},"45":{"start":{"line":214,"column":8},"end":{"line":224,"column":11}},"46":{"start":{"line":225,"column":8},"end":{"line":225,"column":31}},"47":{"start":{"line":227,"column":8},"end":{"line":227,"column":63}},"48":{"start":{"line":228,"column":8},"end":{"line":228,"column":61}},"49":{"start":{"line":229,"column":8},"end":{"line":229,"column":22}},"50":{"start":{"line":230,"column":8},"end":{"line":230,"column":58}},"51":{"start":{"line":231,"column":8},"end":{"line":231,"column":17}},"52":{"start":{"line":234,"column":4},"end":{"line":560,"column":7}},"53":{"start":{"line":248,"column":12},"end":{"line":248,"column":35}},"54":{"start":{"line":249,"column":12},"end":{"line":249,"column":24}},"55":{"start":{"line":258,"column":12},"end":{"line":258,"column":35}},"56":{"start":{"line":259,"column":12},"end":{"line":259,"column":24}},"57":{"start":{"line":268,"column":12},"end":{"line":273,"column":14}},"58":{"start":{"line":275,"column":12},"end":{"line":284,"column":21}},"59":{"start":{"line":276,"column":16},"end":{"line":283,"column":19}},"60":{"start":{"line":325,"column":12},"end":{"line":325,"column":32}},"61":{"start":{"line":326,"column":12},"end":{"line":326,"column":28}},"62":{"start":{"line":327,"column":12},"end":{"line":332,"column":21}},"63":{"start":{"line":328,"column":16},"end":{"line":331,"column":17}},"64":{"start":{"line":329,"column":20},"end":{"line":329,"column":31}},"65":{"start":{"line":330,"column":20},"end":{"line":330,"column":39}},"66":{"start":{"line":333,"column":12},"end":{"line":333,"column":23}},"67":{"start":{"line":341,"column":12},"end":{"line":341,"column":51}},"68":{"start":{"line":343,"column":12},"end":{"line":343,"column":42}},"69":{"start":{"line":344,"column":12},"end":{"line":347,"column":13}},"70":{"start":{"line":345,"column":16},"end":{"line":345,"column":35}},"71":{"start":{"line":346,"column":16},"end":{"line":346,"column":35}},"72":{"start":{"line":348,"column":12},"end":{"line":348,"column":52}},"73":{"start":{"line":350,"column":12},"end":{"line":350,"column":51}},"74":{"start":{"line":358,"column":12},"end":{"line":358,"column":35}},"75":{"start":{"line":359,"column":12},"end":{"line":363,"column":13}},"76":{"start":{"line":360,"column":16},"end":{"line":360,"column":38}},"77":{"start":{"line":361,"column":16},"end":{"line":361,"column":35}},"78":{"start":{"line":362,"column":16},"end":{"line":362,"column":33}},"79":{"start":{"line":364,"column":12},"end":{"line":364,"column":65}},"80":{"start":{"line":365,"column":12},"end":{"line":365,"column":29}},"81":{"start":{"line":373,"column":12},"end":{"line":375,"column":13}},"82":{"start":{"line":374,"column":16},"end":{"line":374,"column":29}},"83":{"start":{"line":376,"column":12},"end":{"line":376,"column":78}},"84":{"start":{"line":377,"column":12},"end":{"line":377,"column":80}},"85":{"start":{"line":378,"column":12},"end":{"line":378,"column":70}},"86":{"start":{"line":380,"column":12},"end":{"line":386,"column":13}},"87":{"start":{"line":381,"column":16},"end":{"line":385,"column":19}},"88":{"start":{"line":387,"column":12},"end":{"line":387,"column":36}},"89":{"start":{"line":395,"column":12},"end":{"line":397,"column":13}},"90":{"start":{"line":396,"column":16},"end":{"line":396,"column":29}},"91":{"start":{"line":398,"column":12},"end":{"line":400,"column":13}},"92":{"start":{"line":399,"column":16},"end":{"line":399,"column":29}},"93":{"start":{"line":401,"column":12},"end":{"line":403,"column":13}},"94":{"start":{"line":402,"column":16},"end":{"line":402,"column":29}},"95":{"start":{"line":404,"column":12},"end":{"line":404,"column":38}},"96":{"start":{"line":407,"column":12},"end":{"line":420,"column":13}},"97":{"start":{"line":408,"column":16},"end":{"line":408,"column":74}},"98":{"start":{"line":409,"column":16},"end":{"line":409,"column":69}},"99":{"start":{"line":410,"column":16},"end":{"line":410,"column":36}},"100":{"start":{"line":411,"column":16},"end":{"line":411,"column":40}},"101":{"start":{"line":412,"column":16},"end":{"line":414,"column":17}},"102":{"start":{"line":413,"column":20},"end":{"line":413,"column":47}},"103":{"start":{"line":415,"column":16},"end":{"line":415,"column":32}},"104":{"start":{"line":417,"column":16},"end":{"line":417,"column":39}},"105":{"start":{"line":418,"column":16},"end":{"line":418,"column":72}},"106":{"start":{"line":419,"column":16},"end":{"line":419,"column":71}},"107":{"start":{"line":428,"column":12},"end":{"line":430,"column":13}},"108":{"start":{"line":429,"column":16},"end":{"line":429,"column":29}},"109":{"start":{"line":431,"column":12},"end":{"line":433,"column":13}},"110":{"start":{"line":432,"column":16},"end":{"line":432,"column":29}},"111":{"start":{"line":435,"column":12},"end":{"line":437,"column":13}},"112":{"start":{"line":436,"column":16},"end":{"line":436,"column":29}},"113":{"start":{"line":438,"column":12},"end":{"line":441,"column":13}},"114":{"start":{"line":439,"column":16},"end":{"line":439,"column":50}},"115":{"start":{"line":440,"column":16},"end":{"line":440,"column":29}},"116":{"start":{"line":442,"column":12},"end":{"line":447,"column":27}},"117":{"start":{"line":451,"column":12},"end":{"line":451,"column":39}},"118":{"start":{"line":452,"column":12},"end":{"line":452,"column":39}},"119":{"start":{"line":453,"column":12},"end":{"line":453,"column":35}},"120":{"start":{"line":454,"column":12},"end":{"line":454,"column":34}},"121":{"start":{"line":457,"column":12},"end":{"line":468,"column":13}},"122":{"start":{"line":459,"column":16},"end":{"line":459,"column":36}},"123":{"start":{"line":460,"column":16},"end":{"line":460,"column":53}},"124":{"start":{"line":461,"column":16},"end":{"line":461,"column":52}},"125":{"start":{"line":463,"column":16},"end":{"line":463,"column":31}},"126":{"start":{"line":464,"column":16},"end":{"line":464,"column":31}},"127":{"start":{"line":465,"column":16},"end":{"line":465,"column":53}},"128":{"start":{"line":466,"column":16},"end":{"line":466,"column":53}},"129":{"start":{"line":470,"column":12},"end":{"line":478,"column":13}},"130":{"start":{"line":472,"column":16},"end":{"line":477,"column":19}},"131":{"start":{"line":481,"column":12},"end":{"line":489,"column":14}},"132":{"start":{"line":498,"column":12},"end":{"line":518,"column":13}},"133":{"start":{"line":499,"column":16},"end":{"line":499,"column":71}},"134":{"start":{"line":500,"column":16},"end":{"line":500,"column":38}},"135":{"start":{"line":501,"column":16},"end":{"line":501,"column":44}},"136":{"start":{"line":502,"column":16},"end":{"line":515,"column":17}},"137":{"start":{"line":503,"column":20},"end":{"line":503,"column":91}},"138":{"start":{"line":504,"column":20},"end":{"line":504,"column":82}},"139":{"start":{"line":507,"column":20},"end":{"line":514,"column":21}},"140":{"start":{"line":508,"column":24},"end":{"line":508,"column":47}},"141":{"start":{"line":509,"column":24},"end":{"line":509,"column":87}},"142":{"start":{"line":510,"column":24},"end":{"line":510,"column":96}},"143":{"start":{"line":511,"column":24},"end":{"line":511,"column":89}},"144":{"start":{"line":517,"column":16},"end":{"line":517,"column":34}},"145":{"start":{"line":526,"column":12},"end":{"line":526,"column":48}},"146":{"start":{"line":527,"column":12},"end":{"line":527,"column":37}},"147":{"start":{"line":535,"column":12},"end":{"line":535,"column":46}},"148":{"start":{"line":536,"column":12},"end":{"line":536,"column":40}},"149":{"start":{"line":544,"column":12},"end":{"line":558,"column":13}},"150":{"start":{"line":545,"column":16},"end":{"line":557,"column":17}},"151":{"start":{"line":546,"column":20},"end":{"line":546,"column":44}},"152":{"start":{"line":547,"column":20},"end":{"line":549,"column":21}},"153":{"start":{"line":548,"column":24},"end":{"line":548,"column":52}},"154":{"start":{"line":550,"column":20},"end":{"line":556,"column":21}},"155":{"start":{"line":551,"column":24},"end":{"line":551,"column":82}},"156":{"start":{"line":552,"column":24},"end":{"line":552,"column":92}},"157":{"start":{"line":553,"column":24},"end":{"line":553,"column":86}},"158":{"start":{"line":554,"column":24},"end":{"line":554,"column":95}},"159":{"start":{"line":555,"column":24},"end":{"line":555,"column":52}},"160":{"start":{"line":562,"column":4},"end":{"line":562,"column":21}}},"branchMap":{"1":{"line":104,"type":"if","locations":[{"start":{"line":104,"column":16},"end":{"line":104,"column":16}},{"start":{"line":104,"column":16},"end":{"line":104,"column":16}}]},"2":{"line":118,"type":"if","locations":[{"start":{"line":118,"column":16},"end":{"line":118,"column":16}},{"start":{"line":118,"column":16},"end":{"line":118,"column":16}}]},"3":{"line":149,"type":"if","locations":[{"start":{"line":149,"column":16},"end":{"line":149,"column":16}},{"start":{"line":149,"column":16},"end":{"line":149,"column":16}}]},"4":{"line":187,"type":"if","locations":[{"start":{"line":187,"column":8},"end":{"line":187,"column":8}},{"start":{"line":187,"column":8},"end":{"line":187,"column":8}}]},"5":{"line":191,"type":"if","locations":[{"start":{"line":191,"column":8},"end":{"line":191,"column":8}},{"start":{"line":191,"column":8},"end":{"line":191,"column":8}}]},"6":{"line":195,"type":"if","locations":[{"start":{"line":195,"column":8},"end":{"line":195,"column":8}},{"start":{"line":195,"column":8},"end":{"line":195,"column":8}}]},"7":{"line":328,"type":"if","locations":[{"start":{"line":328,"column":16},"end":{"line":328,"column":16}},{"start":{"line":328,"column":16},"end":{"line":328,"column":16}}]},"8":{"line":344,"type":"if","locations":[{"start":{"line":344,"column":12},"end":{"line":344,"column":12}},{"start":{"line":344,"column":12},"end":{"line":344,"column":12}}]},"9":{"line":359,"type":"if","locations":[{"start":{"line":359,"column":12},"end":{"line":359,"column":12}},{"start":{"line":359,"column":12},"end":{"line":359,"column":12}}]},"10":{"line":359,"type":"binary-expr","locations":[{"start":{"line":359,"column":16},"end":{"line":359,"column":25}},{"start":{"line":359,"column":30},"end":{"line":359,"column":58}}]},"11":{"line":373,"type":"if","locations":[{"start":{"line":373,"column":12},"end":{"line":373,"column":12}},{"start":{"line":373,"column":12},"end":{"line":373,"column":12}}]},"12":{"line":380,"type":"if","locations":[{"start":{"line":380,"column":12},"end":{"line":380,"column":12}},{"start":{"line":380,"column":12},"end":{"line":380,"column":12}}]},"13":{"line":395,"type":"if","locations":[{"start":{"line":395,"column":12},"end":{"line":395,"column":12}},{"start":{"line":395,"column":12},"end":{"line":395,"column":12}}]},"14":{"line":398,"type":"if","locations":[{"start":{"line":398,"column":12},"end":{"line":398,"column":12}},{"start":{"line":398,"column":12},"end":{"line":398,"column":12}}]},"15":{"line":401,"type":"if","locations":[{"start":{"line":401,"column":12},"end":{"line":401,"column":12}},{"start":{"line":401,"column":12},"end":{"line":401,"column":12}}]},"16":{"line":407,"type":"if","locations":[{"start":{"line":407,"column":12},"end":{"line":407,"column":12}},{"start":{"line":407,"column":12},"end":{"line":407,"column":12}}]},"17":{"line":412,"type":"if","locations":[{"start":{"line":412,"column":16},"end":{"line":412,"column":16}},{"start":{"line":412,"column":16},"end":{"line":412,"column":16}}]},"18":{"line":428,"type":"if","locations":[{"start":{"line":428,"column":12},"end":{"line":428,"column":12}},{"start":{"line":428,"column":12},"end":{"line":428,"column":12}}]},"19":{"line":431,"type":"if","locations":[{"start":{"line":431,"column":12},"end":{"line":431,"column":12}},{"start":{"line":431,"column":12},"end":{"line":431,"column":12}}]},"20":{"line":435,"type":"if","locations":[{"start":{"line":435,"column":12},"end":{"line":435,"column":12}},{"start":{"line":435,"column":12},"end":{"line":435,"column":12}}]},"21":{"line":438,"type":"if","locations":[{"start":{"line":438,"column":12},"end":{"line":438,"column":12}},{"start":{"line":438,"column":12},"end":{"line":438,"column":12}}]},"22":{"line":457,"type":"if","locations":[{"start":{"line":457,"column":12},"end":{"line":457,"column":12}},{"start":{"line":457,"column":12},"end":{"line":457,"column":12}}]},"23":{"line":470,"type":"if","locations":[{"start":{"line":470,"column":12},"end":{"line":470,"column":12}},{"start":{"line":470,"column":12},"end":{"line":470,"column":12}}]},"24":{"line":498,"type":"if","locations":[{"start":{"line":498,"column":12},"end":{"line":498,"column":12}},{"start":{"line":498,"column":12},"end":{"line":498,"column":12}}]},"25":{"line":502,"type":"if","locations":[{"start":{"line":502,"column":16},"end":{"line":502,"column":16}},{"start":{"line":502,"column":16},"end":{"line":502,"column":16}}]},"26":{"line":507,"type":"if","locations":[{"start":{"line":507,"column":20},"end":{"line":507,"column":20}},{"start":{"line":507,"column":20},"end":{"line":507,"column":20}}]},"27":{"line":544,"type":"if","locations":[{"start":{"line":544,"column":12},"end":{"line":544,"column":12}},{"start":{"line":544,"column":12},"end":{"line":544,"column":12}}]},"28":{"line":544,"type":"binary-expr","locations":[{"start":{"line":544,"column":16},"end":{"line":544,"column":39}},{"start":{"line":544,"column":43},"end":{"line":544,"column":48}}]},"29":{"line":545,"type":"if","locations":[{"start":{"line":545,"column":16},"end":{"line":545,"column":16}},{"start":{"line":545,"column":16},"end":{"line":545,"column":16}}]},"30":{"line":547,"type":"if","locations":[{"start":{"line":547,"column":20},"end":{"line":547,"column":20}},{"start":{"line":547,"column":20},"end":{"line":547,"column":20}}]},"31":{"line":550,"type":"if","locations":[{"start":{"line":550,"column":20},"end":{"line":550,"column":20}},{"start":{"line":550,"column":20},"end":{"line":550,"column":20}}]}},"code":["(function () { YUI.add('dd-drop', function (Y, NAME) {","",""," /**"," * Provides the ability to create a Drop Target."," * @module dd"," * @submodule dd-drop"," */"," /**"," * Provides the ability to create a Drop Target."," * @class Drop"," * @extends Base"," * @constructor"," * @namespace DD"," */",""," var NODE = 'node',"," DDM = Y.DD.DDM,"," OFFSET_HEIGHT = 'offsetHeight',"," OFFSET_WIDTH = 'offsetWidth',"," /**"," * Fires when a drag element is over this target."," * @event drop:over"," * @param {EventFacade} event An Event Facade object with the following specific property added:"," *
"," *
drop
The drop object at the time of the event.
"," *
drag
The drag object at the time of the event.
"," *
"," * @bubbles DDM"," * @type {CustomEvent}"," */"," EV_DROP_OVER = 'drop:over',"," /**"," * Fires when a drag element enters this target."," * @event drop:enter"," * @param {EventFacade} event An Event Facade object with the following specific property added:"," *
"," *
drop
The drop object at the time of the event.
"," *
drag
The drag object at the time of the event.
"," *
"," * @bubbles DDM"," * @type {CustomEvent}"," */"," EV_DROP_ENTER = 'drop:enter',"," /**"," * Fires when a drag element exits this target."," * @event drop:exit"," * @param {EventFacade} event An Event Facade object"," * @bubbles DDM"," * @type {CustomEvent}"," */"," EV_DROP_EXIT = 'drop:exit',",""," /**"," * Fires when a draggable node is dropped on this Drop Target. (Fired from dd-ddm-drop)"," * @event drop:hit"," * @param {EventFacade} event An Event Facade object with the following specific property added:"," *
"," *
drop
The best guess on what was dropped on.
"," *
drag
The drag object at the time of the event.
"," *
others
An array of all the other drop targets that was dropped on.
"," *
"," * @bubbles DDM"," * @type {CustomEvent}"," */","",""," Drop = function() {"," this._lazyAddAttrs = false;"," Drop.superclass.constructor.apply(this, arguments);","",""," //DD init speed up."," // (GS) Causes errors."," // (GS) See: http://yuilibrary.com/trac-archive/tickets/2532985.html"," // (GS) However, changing from async to sync "," // (GS) will cause change propagation, so leave it alone "," // (GS) until further investigation and thorough testing."," Y.on('domready', Y.bind(function() {"," Y.later(100, this, Drop_createShim);"," }, this));"," DDM._regTarget(this);",""," /* TODO"," if (Dom.getStyle(this.el, 'position') == 'fixed') {"," Event.on(window, 'scroll', function() {"," this.activateShim();"," }, this, true);"," }"," */"," };",""," Drop.NAME = 'drop';",""," Drop.ATTRS = {"," /**"," * Y.Node instance to use as the element to make a Drop Target"," * @attribute node"," * @type Node"," */"," node: {"," setter: function(node) {"," var n = Y.one(node);"," if (!n) {"," Y.error('DD.Drop: Invalid Node Given: ' + node);"," }"," return n;"," }"," },"," /**"," * Array of groups to add this drop into."," * @attribute groups"," * @type Array"," */"," groups: {"," value: ['default'],"," getter: function() {"," if (!this._groups) {"," this._groups = {};"," return [];"," }",""," return Y.Object.keys(this._groups);"," },"," setter: function(g) {"," this._groups = Y.Array.hash(g);"," return g;"," }"," },"," /**"," * CSS style padding to make the Drop Target bigger than the node."," * @attribute padding"," * @type String"," */"," padding: {"," value: '0',"," setter: function(p) {"," return DDM.cssSizestoObject(p);"," }"," },"," /**"," * Set to lock this drop element."," * @attribute lock"," * @type Boolean"," */"," lock: {"," value: false,"," setter: function(lock) {"," if (lock) {"," this.get(NODE).addClass(DDM.CSS_PREFIX + '-drop-locked');"," } else {"," this.get(NODE).removeClass(DDM.CSS_PREFIX + '-drop-locked');"," }"," return lock;"," }"," },"," /**"," * Controls the default bubble parent for this Drop instance. Default: Y.DD.DDM. Set to false to disable bubbling."," * Use bubbleTargets in config."," * @deprecated"," * @attribute bubbles"," * @type Object"," */"," bubbles: {"," setter: function(t) {"," this.addTarget(t);"," return t;"," }"," },"," /**"," * Use the Drop shim. Default: true"," * @deprecated"," * @attribute useShim"," * @type Boolean"," */"," useShim: {"," value: true,"," setter: function(v) {"," Y.DD.DDM._noShim = !v;"," return v;"," }"," }"," };",""," function Drop_createShim() {"," //No playground, defer"," if (!DDM._pg) {"," Y.later(10, this, Drop_createShim);"," return;"," }"," if (this.shim) return;",""," var s = this.get('node');",""," if (this.get('useShim')) {"," createShimNode(this, s);"," } else {"," this.shim = s;"," }"," }",""," function createShimNode(drop, s) {"," var s, id;"," try {"," id = s.get(\"id\");"," } catch(ex) {"," // _stateProxy is null, TypeError thrown getting"," // _stateProxy[id]. "," // See: http://yuilibrary.com/trac-archive/tickets/2532985.html"," return s;"," }",""," s = Y.Node.create('
');"," s.setStyles({"," height: drop.get(NODE).get(OFFSET_HEIGHT) + 'px',"," width: drop.get(NODE).get(OFFSET_WIDTH) + 'px',"," backgroundColor: 'yellow',"," opacity: '.5',"," zIndex: '1',"," overflow: 'hidden',"," top: '-900px',"," left: '-900px',"," position: 'absolute'"," });"," DDM._pg.appendChild(s);",""," s.on('mouseover', Y.bind(drop._handleOverEvent, drop));"," s.on('mouseout', Y.bind(drop._handleOutEvent, drop));"," drop.shim = s;"," drop.fire(\"shimCreated\", {drag: DDM.activeDrag });"," return s;"," }",""," Y.extend(Drop, Y.Base, {"," /**"," * The default bubbleTarget for this object. Default: Y.DD.DDM"," * @private"," * @property _bubbleTargets"," */"," _bubbleTargets: Y.DD.DDM,"," /**"," * Add this Drop instance to a group, this should be used for on-the-fly group additions."," * @method addToGroup"," * @param {String} g The group to add this Drop Instance to."," * @chainable"," */"," addToGroup: function(g) {"," this._groups[g] = true;"," return this;"," },"," /**"," * Remove this Drop instance from a group, this should be used for on-the-fly group removals."," * @method removeFromGroup"," * @param {String} g The group to remove this Drop Instance from."," * @chainable"," */"," removeFromGroup: function(g) {"," delete this._groups[g];"," return this;"," },"," /**"," * This method creates all the events for this Event Target and publishes them so we get Event Bubbling."," * @private"," * @method _createEvents"," */"," _createEvents: function() {",""," var ev = ["," EV_DROP_OVER,"," EV_DROP_ENTER,"," EV_DROP_EXIT,"," 'drop:hit'"," ];",""," Y.Array.each(ev, function(v) {"," this.publish(v, {"," type: v,"," emitFacade: true,"," preventable: false,"," bubbles: true,"," queuable: false,"," prefix: 'drop'"," });"," }, this);"," },"," /**"," * Flag for determining if the target is valid in this operation."," * @private"," * @property _valid"," * @type Boolean"," */"," _valid: null,"," /**"," * The groups this target belongs to."," * @private"," * @property _groups"," * @type Array"," */"," _groups: null,"," /**"," * Node reference to the targets shim"," * @property shim"," * @type {Object}"," */"," shim: null,"," /**"," * A region object associated with this target, used for checking regions while dragging."," * @property region"," * @type Object"," */"," region: null,"," /**"," * This flag is tripped when a drag element is over this target."," * @property overTarget"," * @type Boolean"," */"," overTarget: null,"," /**"," * Check if this target is in one of the supplied groups."," * @method inGroup"," * @param {Array} groups The groups to check against"," * @return Boolean"," */"," inGroup: function(groups) {"," this._valid = false;"," var ret = false;"," Y.Array.each(groups, function(v) {"," if (this._groups[v]) {"," ret = true;"," this._valid = true;"," }"," }, this);"," return ret;"," },"," /**"," * Private lifecycle method"," * @private"," * @method initializer"," */"," initializer: function() {"," Y.later(100, this, this._createEvents);",""," var node = this.get(NODE), id;"," if (!node.get('id')) {"," id = Y.stamp(node);"," node.set('id', id);"," }"," node.addClass(DDM.CSS_PREFIX + '-drop');"," //Shouldn't have to do this.."," this.set('groups', this.get('groups'));"," },"," /**"," * Lifecycle destructor, unreg the drag from the DDM and remove listeners"," * @private"," * @method destructor"," */"," destructor: function() {"," DDM._unregTarget(this);"," if (this.shim && (this.shim !== this.get(NODE))) {"," this.shim.detachAll();"," this.shim.remove();"," this.shim = null;"," }"," this.get(NODE).removeClass(DDM.CSS_PREFIX + '-drop');"," this.detachAll();"," },"," /**"," * Removes classes from the target, resets some flags and sets the shims deactive position [-999, -999]"," * @private"," * @method _deactivateShim"," */"," _deactivateShim: function() {"," if (!this.shim) {"," return false;"," }"," this.get(NODE).removeClass(DDM.CSS_PREFIX + '-drop-active-valid');"," this.get(NODE).removeClass(DDM.CSS_PREFIX + '-drop-active-invalid');"," this.get(NODE).removeClass(DDM.CSS_PREFIX + '-drop-over');",""," if (this.get('useShim')) {"," this.shim.setStyles({"," top: '-999px',"," left: '-999px',"," zIndex: '1'"," });"," }"," this.overTarget = false;"," },"," /**"," * Activates the shim and adds some interaction CSS classes"," * @private"," * @method _activateShim"," */"," _activateShim: function() {"," if (!DDM.activeDrag) {"," return false; //Nothing is dragging, no reason to activate."," }"," if (this.get(NODE) === DDM.activeDrag.get(NODE)) {"," return false;"," }"," if (this.get('lock')) {"," return false;"," }"," var node = this.get(NODE);"," //TODO Visibility Check.."," //if (this.inGroup(DDM.activeDrag.get('groups')) && this.get(NODE).isVisible()) {"," if (this.inGroup(DDM.activeDrag.get('groups'))) {"," node.removeClass(DDM.CSS_PREFIX + '-drop-active-invalid');"," node.addClass(DDM.CSS_PREFIX + '-drop-active-valid');"," DDM._addValid(this);"," this.overTarget = false;"," if (!this.get('useShim')) {"," this.shim = this.get(NODE);"," }"," this.sizeShim();"," } else {"," DDM._removeValid(this);"," node.removeClass(DDM.CSS_PREFIX + '-drop-active-valid');"," node.addClass(DDM.CSS_PREFIX + '-drop-active-invalid');"," }"," },"," /**"," * Positions and sizes the shim with the raw data from the node,"," * this can be used to programatically adjust the Targets shim for Animation.."," * @method sizeShim"," */"," sizeShim: function() {"," if (!DDM.activeDrag) {"," return false; //Nothing is dragging, no reason to activate."," }"," if (this.get(NODE) === DDM.activeDrag.get(NODE)) {"," return false;"," }"," //if (this.get('lock') || !this.get('useShim')) {"," if (this.get('lock')) {"," return false;"," }"," if (!this.shim) {"," Y.later(100, this, this.sizeShim);"," return false;"," }"," var node = this.get(NODE),"," nh = node.get(OFFSET_HEIGHT),"," nw = node.get(OFFSET_WIDTH),"," xy = node.getXY(),"," p = this.get('padding'),"," dd, dH, dW;","",""," //Apply padding"," nw = nw + p.left + p.right;"," nh = nh + p.top + p.bottom;"," xy[0] = xy[0] - p.left;"," xy[1] = xy[1] - p.top;","",""," if (DDM.activeDrag.get('dragMode') === DDM.INTERSECT) {"," //Intersect Mode, make the shim bigger"," dd = DDM.activeDrag;"," dH = dd.get(NODE).get(OFFSET_HEIGHT);"," dW = dd.get(NODE).get(OFFSET_WIDTH);",""," nh = (nh + dH);"," nw = (nw + dW);"," xy[0] = xy[0] - (dW - dd.deltaXY[0]);"," xy[1] = xy[1] - (dH - dd.deltaXY[1]);",""," }",""," if (this.get('useShim')) {"," //Set the style on the shim"," this.shim.setStyles({"," height: nh + 'px',"," width: nw + 'px',"," top: xy[1] + 'px',"," left: xy[0] + 'px'"," });"," }",""," //Create the region to be used by intersect when a drag node is over us."," this.region = {"," '0': xy[0],"," '1': xy[1],"," area: 0,"," top: xy[1],"," right: xy[0] + nw,"," bottom: xy[1] + nh,"," left: xy[0]"," };"," },",""," /**"," * This handles the over target call made from this object or from the DDM"," * @private"," * @method _handleOverTarget"," */"," _handleTargetOver: function() {"," if (DDM.isOverTarget(this)) {"," this.get(NODE).addClass(DDM.CSS_PREFIX + '-drop-over');"," DDM.activeDrop = this;"," DDM.otherDrops[this] = this;"," if (this.overTarget) {"," DDM.activeDrag.fire('drag:over', { drop: this, drag: DDM.activeDrag });"," this.fire(EV_DROP_OVER, { drop: this, drag: DDM.activeDrag });"," } else {"," //Prevent an enter before a start.."," if (DDM.activeDrag.get('dragging')) {"," this.overTarget = true;"," this.fire(EV_DROP_ENTER, { drop: this, drag: DDM.activeDrag });"," DDM.activeDrag.fire('drag:enter', { drop: this, drag: DDM.activeDrag });"," DDM.activeDrag.get(NODE).addClass(DDM.CSS_PREFIX + '-drag-over');"," //TODO - Is this needed??"," //DDM._handleTargetOver();"," }"," }"," } else {"," this._handleOut();"," }"," },"," /**"," * Handles the mouseover DOM event on the Target Shim"," * @private"," * @method _handleOverEvent"," */"," _handleOverEvent: function() {"," this.shim.setStyle('zIndex', '999');"," DDM._addActiveShim(this);"," },"," /**"," * Handles the mouseout DOM event on the Target Shim"," * @private"," * @method _handleOutEvent"," */"," _handleOutEvent: function() {"," this.shim.setStyle('zIndex', '1');"," DDM._removeActiveShim(this);"," },"," /**"," * Handles out of target calls/checks"," * @private"," * @method _handleOut"," */"," _handleOut: function(force) {"," if (!DDM.isOverTarget(this) || force) {"," if (this.overTarget) {"," this.overTarget = false;"," if (!force) {"," DDM._removeActiveShim(this);"," }"," if (DDM.activeDrag) {"," this.get(NODE).removeClass(DDM.CSS_PREFIX + '-drop-over');"," DDM.activeDrag.get(NODE).removeClass(DDM.CSS_PREFIX + '-drag-over');"," this.fire(EV_DROP_EXIT, { drop: this, drag: DDM.activeDrag });"," DDM.activeDrag.fire('drag:exit', { drop: this, drag: DDM.activeDrag });"," delete DDM.otherDrops[this];"," }"," }"," }"," }"," });",""," Y.DD.Drop = Drop;","","","","","}, '@VERSION@', {\"requires\": [\"dd-drag\", \"dd-ddm-drop\"]});","","}());"]}; } var __cov_3eiEp1iCAUM1okIweRgSmw = __coverage__['build/dd-drop/dd-drop.js']; -__cov_3eiEp1iCAUM1okIweRgSmw.s['1']++;YUI.add('dd-drop',function(Y,NAME){__cov_3eiEp1iCAUM1okIweRgSmw.f['1']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['2']++;var NODE='node',DDM=Y.DD.DDM,OFFSET_HEIGHT='offsetHeight',OFFSET_WIDTH='offsetWidth',EV_DROP_OVER='drop:over',EV_DROP_ENTER='drop:enter',EV_DROP_EXIT='drop:exit',Drop=function(){__cov_3eiEp1iCAUM1okIweRgSmw.f['2']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['3']++;this._lazyAddAttrs=false;__cov_3eiEp1iCAUM1okIweRgSmw.s['4']++;Drop.superclass.constructor.apply(this,arguments);__cov_3eiEp1iCAUM1okIweRgSmw.s['5']++;Y.on('domready',Y.bind(function(){__cov_3eiEp1iCAUM1okIweRgSmw.f['3']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['6']++;Y.later(100,this,this._createShim);},this));__cov_3eiEp1iCAUM1okIweRgSmw.s['7']++;DDM._regTarget(this);};__cov_3eiEp1iCAUM1okIweRgSmw.s['8']++;Drop.NAME='drop';__cov_3eiEp1iCAUM1okIweRgSmw.s['9']++;Drop.ATTRS={node:{setter:function(node){__cov_3eiEp1iCAUM1okIweRgSmw.f['4']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['10']++;var n=Y.one(node);__cov_3eiEp1iCAUM1okIweRgSmw.s['11']++;if(!n){__cov_3eiEp1iCAUM1okIweRgSmw.b['1'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['12']++;Y.error('DD.Drop: Invalid Node Given: '+node);}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['1'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['13']++;return n;}},groups:{value:['default'],getter:function(){__cov_3eiEp1iCAUM1okIweRgSmw.f['5']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['14']++;if(!this._groups){__cov_3eiEp1iCAUM1okIweRgSmw.b['2'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['15']++;this._groups={};__cov_3eiEp1iCAUM1okIweRgSmw.s['16']++;return[];}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['2'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['17']++;return Y.Object.keys(this._groups);},setter:function(g){__cov_3eiEp1iCAUM1okIweRgSmw.f['6']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['18']++;this._groups=Y.Array.hash(g);__cov_3eiEp1iCAUM1okIweRgSmw.s['19']++;return g;}},padding:{value:'0',setter:function(p){__cov_3eiEp1iCAUM1okIweRgSmw.f['7']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['20']++;return DDM.cssSizestoObject(p);}},lock:{value:false,setter:function(lock){__cov_3eiEp1iCAUM1okIweRgSmw.f['8']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['21']++;if(lock){__cov_3eiEp1iCAUM1okIweRgSmw.b['3'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['22']++;this.get(NODE).addClass(DDM.CSS_PREFIX+'-drop-locked');}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['3'][1]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['23']++;this.get(NODE).removeClass(DDM.CSS_PREFIX+'-drop-locked');}__cov_3eiEp1iCAUM1okIweRgSmw.s['24']++;return lock;}},bubbles:{setter:function(t){__cov_3eiEp1iCAUM1okIweRgSmw.f['9']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['25']++;this.addTarget(t);__cov_3eiEp1iCAUM1okIweRgSmw.s['26']++;return t;}},useShim:{value:true,setter:function(v){__cov_3eiEp1iCAUM1okIweRgSmw.f['10']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['27']++;Y.DD.DDM._noShim=!v;__cov_3eiEp1iCAUM1okIweRgSmw.s['28']++;return v;}}};__cov_3eiEp1iCAUM1okIweRgSmw.s['29']++;Y.extend(Drop,Y.Base,{_bubbleTargets:Y.DD.DDM,addToGroup:function(g){__cov_3eiEp1iCAUM1okIweRgSmw.f['11']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['30']++;this._groups[g]=true;__cov_3eiEp1iCAUM1okIweRgSmw.s['31']++;return this;},removeFromGroup:function(g){__cov_3eiEp1iCAUM1okIweRgSmw.f['12']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['32']++;delete this._groups[g];__cov_3eiEp1iCAUM1okIweRgSmw.s['33']++;return this;},_createEvents:function(){__cov_3eiEp1iCAUM1okIweRgSmw.f['13']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['34']++;var ev=[EV_DROP_OVER,EV_DROP_ENTER,EV_DROP_EXIT,'drop:hit'];__cov_3eiEp1iCAUM1okIweRgSmw.s['35']++;Y.Array.each(ev,function(v){__cov_3eiEp1iCAUM1okIweRgSmw.f['14']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['36']++;this.publish(v,{type:v,emitFacade:true,preventable:false,bubbles:true,queuable:false,prefix:'drop'});},this);},_valid:null,_groups:null,shim:null,region:null,overTarget:null,inGroup:function(groups){__cov_3eiEp1iCAUM1okIweRgSmw.f['15']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['37']++;this._valid=false;__cov_3eiEp1iCAUM1okIweRgSmw.s['38']++;var ret=false;__cov_3eiEp1iCAUM1okIweRgSmw.s['39']++;Y.Array.each(groups,function(v){__cov_3eiEp1iCAUM1okIweRgSmw.f['16']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['40']++;if(this._groups[v]){__cov_3eiEp1iCAUM1okIweRgSmw.b['4'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['41']++;ret=true;__cov_3eiEp1iCAUM1okIweRgSmw.s['42']++;this._valid=true;}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['4'][1]++;}},this);__cov_3eiEp1iCAUM1okIweRgSmw.s['43']++;return ret;},initializer:function(){__cov_3eiEp1iCAUM1okIweRgSmw.f['17']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['44']++;Y.later(100,this,this._createEvents);__cov_3eiEp1iCAUM1okIweRgSmw.s['45']++;var node=this.get(NODE),id;__cov_3eiEp1iCAUM1okIweRgSmw.s['46']++;if(!node.get('id')){__cov_3eiEp1iCAUM1okIweRgSmw.b['5'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['47']++;id=Y.stamp(node);__cov_3eiEp1iCAUM1okIweRgSmw.s['48']++;node.set('id',id);}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['5'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['49']++;node.addClass(DDM.CSS_PREFIX+'-drop');__cov_3eiEp1iCAUM1okIweRgSmw.s['50']++;this.set('groups',this.get('groups'));},destructor:function(){__cov_3eiEp1iCAUM1okIweRgSmw.f['18']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['51']++;DDM._unregTarget(this);__cov_3eiEp1iCAUM1okIweRgSmw.s['52']++;if((__cov_3eiEp1iCAUM1okIweRgSmw.b['7'][0]++,this.shim)&&(__cov_3eiEp1iCAUM1okIweRgSmw.b['7'][1]++,this.shim!==this.get(NODE))){__cov_3eiEp1iCAUM1okIweRgSmw.b['6'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['53']++;this.shim.detachAll();__cov_3eiEp1iCAUM1okIweRgSmw.s['54']++;this.shim.remove();__cov_3eiEp1iCAUM1okIweRgSmw.s['55']++;this.shim=null;}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['6'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['56']++;this.get(NODE).removeClass(DDM.CSS_PREFIX+'-drop');__cov_3eiEp1iCAUM1okIweRgSmw.s['57']++;this.detachAll();},_deactivateShim:function(){__cov_3eiEp1iCAUM1okIweRgSmw.f['19']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['58']++;if(!this.shim){__cov_3eiEp1iCAUM1okIweRgSmw.b['8'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['59']++;return false;}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['8'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['60']++;this.get(NODE).removeClass(DDM.CSS_PREFIX+'-drop-active-valid');__cov_3eiEp1iCAUM1okIweRgSmw.s['61']++;this.get(NODE).removeClass(DDM.CSS_PREFIX+'-drop-active-invalid');__cov_3eiEp1iCAUM1okIweRgSmw.s['62']++;this.get(NODE).removeClass(DDM.CSS_PREFIX+'-drop-over');__cov_3eiEp1iCAUM1okIweRgSmw.s['63']++;if(this.get('useShim')){__cov_3eiEp1iCAUM1okIweRgSmw.b['9'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['64']++;this.shim.setStyles({top:'-999px',left:'-999px',zIndex:'1'});}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['9'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['65']++;this.overTarget=false;},_activateShim:function(){__cov_3eiEp1iCAUM1okIweRgSmw.f['20']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['66']++;if(!DDM.activeDrag){__cov_3eiEp1iCAUM1okIweRgSmw.b['10'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['67']++;return false;}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['10'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['68']++;if(this.get(NODE)===DDM.activeDrag.get(NODE)){__cov_3eiEp1iCAUM1okIweRgSmw.b['11'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['69']++;return false;}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['11'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['70']++;if(this.get('lock')){__cov_3eiEp1iCAUM1okIweRgSmw.b['12'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['71']++;return false;}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['12'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['72']++;var node=this.get(NODE);__cov_3eiEp1iCAUM1okIweRgSmw.s['73']++;if(this.inGroup(DDM.activeDrag.get('groups'))){__cov_3eiEp1iCAUM1okIweRgSmw.b['13'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['74']++;node.removeClass(DDM.CSS_PREFIX+'-drop-active-invalid');__cov_3eiEp1iCAUM1okIweRgSmw.s['75']++;node.addClass(DDM.CSS_PREFIX+'-drop-active-valid');__cov_3eiEp1iCAUM1okIweRgSmw.s['76']++;DDM._addValid(this);__cov_3eiEp1iCAUM1okIweRgSmw.s['77']++;this.overTarget=false;__cov_3eiEp1iCAUM1okIweRgSmw.s['78']++;if(!this.get('useShim')){__cov_3eiEp1iCAUM1okIweRgSmw.b['14'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['79']++;this.shim=this.get(NODE);}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['14'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['80']++;this.sizeShim();}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['13'][1]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['81']++;DDM._removeValid(this);__cov_3eiEp1iCAUM1okIweRgSmw.s['82']++;node.removeClass(DDM.CSS_PREFIX+'-drop-active-valid');__cov_3eiEp1iCAUM1okIweRgSmw.s['83']++;node.addClass(DDM.CSS_PREFIX+'-drop-active-invalid');}},sizeShim:function(){__cov_3eiEp1iCAUM1okIweRgSmw.f['21']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['84']++;if(!DDM.activeDrag){__cov_3eiEp1iCAUM1okIweRgSmw.b['15'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['85']++;return false;}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['15'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['86']++;if(this.get(NODE)===DDM.activeDrag.get(NODE)){__cov_3eiEp1iCAUM1okIweRgSmw.b['16'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['87']++;return false;}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['16'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['88']++;if(this.get('lock')){__cov_3eiEp1iCAUM1okIweRgSmw.b['17'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['89']++;return false;}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['17'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['90']++;if(!this.shim){__cov_3eiEp1iCAUM1okIweRgSmw.b['18'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['91']++;Y.later(100,this,this.sizeShim);__cov_3eiEp1iCAUM1okIweRgSmw.s['92']++;return false;}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['18'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['93']++;var node=this.get(NODE),nh=node.get(OFFSET_HEIGHT),nw=node.get(OFFSET_WIDTH),xy=node.getXY(),p=this.get('padding'),dd,dH,dW;__cov_3eiEp1iCAUM1okIweRgSmw.s['94']++;nw=nw+p.left+p.right;__cov_3eiEp1iCAUM1okIweRgSmw.s['95']++;nh=nh+p.top+p.bottom;__cov_3eiEp1iCAUM1okIweRgSmw.s['96']++;xy[0]=xy[0]-p.left;__cov_3eiEp1iCAUM1okIweRgSmw.s['97']++;xy[1]=xy[1]-p.top;__cov_3eiEp1iCAUM1okIweRgSmw.s['98']++;if(DDM.activeDrag.get('dragMode')===DDM.INTERSECT){__cov_3eiEp1iCAUM1okIweRgSmw.b['19'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['99']++;dd=DDM.activeDrag;__cov_3eiEp1iCAUM1okIweRgSmw.s['100']++;dH=dd.get(NODE).get(OFFSET_HEIGHT);__cov_3eiEp1iCAUM1okIweRgSmw.s['101']++;dW=dd.get(NODE).get(OFFSET_WIDTH);__cov_3eiEp1iCAUM1okIweRgSmw.s['102']++;nh=nh+dH;__cov_3eiEp1iCAUM1okIweRgSmw.s['103']++;nw=nw+dW;__cov_3eiEp1iCAUM1okIweRgSmw.s['104']++;xy[0]=xy[0]-(dW-dd.deltaXY[0]);__cov_3eiEp1iCAUM1okIweRgSmw.s['105']++;xy[1]=xy[1]-(dH-dd.deltaXY[1]);}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['19'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['106']++;if(this.get('useShim')){__cov_3eiEp1iCAUM1okIweRgSmw.b['20'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['107']++;this.shim.setStyles({height:nh+'px',width:nw+'px',top:xy[1]+'px',left:xy[0]+'px'});}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['20'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['108']++;this.region={'0':xy[0],'1':xy[1],area:0,top:xy[1],right:xy[0]+nw,bottom:xy[1]+nh,left:xy[0]};},_createShim:function(){__cov_3eiEp1iCAUM1okIweRgSmw.f['22']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['109']++;if(!DDM._pg){__cov_3eiEp1iCAUM1okIweRgSmw.b['21'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['110']++;Y.later(10,this,this._createShim);__cov_3eiEp1iCAUM1okIweRgSmw.s['111']++;return;}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['21'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['112']++;if(this.shim){__cov_3eiEp1iCAUM1okIweRgSmw.b['22'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['113']++;return;}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['22'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['114']++;var s=this.get('node');__cov_3eiEp1iCAUM1okIweRgSmw.s['115']++;if(this.get('useShim')){__cov_3eiEp1iCAUM1okIweRgSmw.b['23'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['116']++;s=Y.Node.create('
');__cov_3eiEp1iCAUM1okIweRgSmw.s['117']++;s.setStyles({height:this.get(NODE).get(OFFSET_HEIGHT)+'px',width:this.get(NODE).get(OFFSET_WIDTH)+'px',backgroundColor:'yellow',opacity:'.5',zIndex:'1',overflow:'hidden',top:'-900px',left:'-900px',position:'absolute'});__cov_3eiEp1iCAUM1okIweRgSmw.s['118']++;DDM._pg.appendChild(s);__cov_3eiEp1iCAUM1okIweRgSmw.s['119']++;s.on('mouseover',Y.bind(this._handleOverEvent,this));__cov_3eiEp1iCAUM1okIweRgSmw.s['120']++;s.on('mouseout',Y.bind(this._handleOutEvent,this));}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['23'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['121']++;this.shim=s;},_handleTargetOver:function(){__cov_3eiEp1iCAUM1okIweRgSmw.f['23']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['122']++;if(DDM.isOverTarget(this)){__cov_3eiEp1iCAUM1okIweRgSmw.b['24'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['123']++;this.get(NODE).addClass(DDM.CSS_PREFIX+'-drop-over');__cov_3eiEp1iCAUM1okIweRgSmw.s['124']++;DDM.activeDrop=this;__cov_3eiEp1iCAUM1okIweRgSmw.s['125']++;DDM.otherDrops[this]=this;__cov_3eiEp1iCAUM1okIweRgSmw.s['126']++;if(this.overTarget){__cov_3eiEp1iCAUM1okIweRgSmw.b['25'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['127']++;DDM.activeDrag.fire('drag:over',{drop:this,drag:DDM.activeDrag});__cov_3eiEp1iCAUM1okIweRgSmw.s['128']++;this.fire(EV_DROP_OVER,{drop:this,drag:DDM.activeDrag});}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['25'][1]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['129']++;if(DDM.activeDrag.get('dragging')){__cov_3eiEp1iCAUM1okIweRgSmw.b['26'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['130']++;this.overTarget=true;__cov_3eiEp1iCAUM1okIweRgSmw.s['131']++;this.fire(EV_DROP_ENTER,{drop:this,drag:DDM.activeDrag});__cov_3eiEp1iCAUM1okIweRgSmw.s['132']++;DDM.activeDrag.fire('drag:enter',{drop:this,drag:DDM.activeDrag});__cov_3eiEp1iCAUM1okIweRgSmw.s['133']++;DDM.activeDrag.get(NODE).addClass(DDM.CSS_PREFIX+'-drag-over');}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['26'][1]++;}}}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['24'][1]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['134']++;this._handleOut();}},_handleOverEvent:function(){__cov_3eiEp1iCAUM1okIweRgSmw.f['24']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['135']++;this.shim.setStyle('zIndex','999');__cov_3eiEp1iCAUM1okIweRgSmw.s['136']++;DDM._addActiveShim(this);},_handleOutEvent:function(){__cov_3eiEp1iCAUM1okIweRgSmw.f['25']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['137']++;this.shim.setStyle('zIndex','1');__cov_3eiEp1iCAUM1okIweRgSmw.s['138']++;DDM._removeActiveShim(this);},_handleOut:function(force){__cov_3eiEp1iCAUM1okIweRgSmw.f['26']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['139']++;if((__cov_3eiEp1iCAUM1okIweRgSmw.b['28'][0]++,!DDM.isOverTarget(this))||(__cov_3eiEp1iCAUM1okIweRgSmw.b['28'][1]++,force)){__cov_3eiEp1iCAUM1okIweRgSmw.b['27'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['140']++;if(this.overTarget){__cov_3eiEp1iCAUM1okIweRgSmw.b['29'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['141']++;this.overTarget=false;__cov_3eiEp1iCAUM1okIweRgSmw.s['142']++;if(!force){__cov_3eiEp1iCAUM1okIweRgSmw.b['30'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['143']++;DDM._removeActiveShim(this);}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['30'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['144']++;if(DDM.activeDrag){__cov_3eiEp1iCAUM1okIweRgSmw.b['31'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['145']++;this.get(NODE).removeClass(DDM.CSS_PREFIX+'-drop-over');__cov_3eiEp1iCAUM1okIweRgSmw.s['146']++;DDM.activeDrag.get(NODE).removeClass(DDM.CSS_PREFIX+'-drag-over');__cov_3eiEp1iCAUM1okIweRgSmw.s['147']++;this.fire(EV_DROP_EXIT,{drop:this,drag:DDM.activeDrag});__cov_3eiEp1iCAUM1okIweRgSmw.s['148']++;DDM.activeDrag.fire('drag:exit',{drop:this,drag:DDM.activeDrag});__cov_3eiEp1iCAUM1okIweRgSmw.s['149']++;delete DDM.otherDrops[this];}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['31'][1]++;}}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['29'][1]++;}}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['27'][1]++;}}});__cov_3eiEp1iCAUM1okIweRgSmw.s['150']++;Y.DD.Drop=Drop;},'@VERSION@',{'requires':['dd-drag','dd-ddm-drop']}); +__cov_3eiEp1iCAUM1okIweRgSmw.s['1']++;YUI.add('dd-drop',function(Y,NAME){__cov_3eiEp1iCAUM1okIweRgSmw.f['1']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['2']++;var NODE='node',DDM=Y.DD.DDM,OFFSET_HEIGHT='offsetHeight',OFFSET_WIDTH='offsetWidth',EV_DROP_OVER='drop:over',EV_DROP_ENTER='drop:enter',EV_DROP_EXIT='drop:exit',Drop=function(){__cov_3eiEp1iCAUM1okIweRgSmw.f['2']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['3']++;this._lazyAddAttrs=false;__cov_3eiEp1iCAUM1okIweRgSmw.s['4']++;Drop.superclass.constructor.apply(this,arguments);__cov_3eiEp1iCAUM1okIweRgSmw.s['5']++;Y.on('domready',Y.bind(function(){__cov_3eiEp1iCAUM1okIweRgSmw.f['3']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['6']++;Y.later(100,this,Drop_createShim);},this));__cov_3eiEp1iCAUM1okIweRgSmw.s['7']++;DDM._regTarget(this);};__cov_3eiEp1iCAUM1okIweRgSmw.s['8']++;Drop.NAME='drop';__cov_3eiEp1iCAUM1okIweRgSmw.s['9']++;Drop.ATTRS={node:{setter:function(node){__cov_3eiEp1iCAUM1okIweRgSmw.f['4']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['10']++;var n=Y.one(node);__cov_3eiEp1iCAUM1okIweRgSmw.s['11']++;if(!n){__cov_3eiEp1iCAUM1okIweRgSmw.b['1'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['12']++;Y.error('DD.Drop: Invalid Node Given: '+node);}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['1'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['13']++;return n;}},groups:{value:['default'],getter:function(){__cov_3eiEp1iCAUM1okIweRgSmw.f['5']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['14']++;if(!this._groups){__cov_3eiEp1iCAUM1okIweRgSmw.b['2'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['15']++;this._groups={};__cov_3eiEp1iCAUM1okIweRgSmw.s['16']++;return[];}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['2'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['17']++;return Y.Object.keys(this._groups);},setter:function(g){__cov_3eiEp1iCAUM1okIweRgSmw.f['6']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['18']++;this._groups=Y.Array.hash(g);__cov_3eiEp1iCAUM1okIweRgSmw.s['19']++;return g;}},padding:{value:'0',setter:function(p){__cov_3eiEp1iCAUM1okIweRgSmw.f['7']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['20']++;return DDM.cssSizestoObject(p);}},lock:{value:false,setter:function(lock){__cov_3eiEp1iCAUM1okIweRgSmw.f['8']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['21']++;if(lock){__cov_3eiEp1iCAUM1okIweRgSmw.b['3'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['22']++;this.get(NODE).addClass(DDM.CSS_PREFIX+'-drop-locked');}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['3'][1]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['23']++;this.get(NODE).removeClass(DDM.CSS_PREFIX+'-drop-locked');}__cov_3eiEp1iCAUM1okIweRgSmw.s['24']++;return lock;}},bubbles:{setter:function(t){__cov_3eiEp1iCAUM1okIweRgSmw.f['9']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['25']++;this.addTarget(t);__cov_3eiEp1iCAUM1okIweRgSmw.s['26']++;return t;}},useShim:{value:true,setter:function(v){__cov_3eiEp1iCAUM1okIweRgSmw.f['10']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['27']++;Y.DD.DDM._noShim=!v;__cov_3eiEp1iCAUM1okIweRgSmw.s['28']++;return v;}}};__cov_3eiEp1iCAUM1okIweRgSmw.s['29']++;function Drop_createShim(){__cov_3eiEp1iCAUM1okIweRgSmw.f['11']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['30']++;if(!DDM._pg){__cov_3eiEp1iCAUM1okIweRgSmw.b['4'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['31']++;Y.later(10,this,Drop_createShim);__cov_3eiEp1iCAUM1okIweRgSmw.s['32']++;return;}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['4'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['33']++;if(this.shim){__cov_3eiEp1iCAUM1okIweRgSmw.b['5'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['34']++;return;}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['5'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['35']++;var s=this.get('node');__cov_3eiEp1iCAUM1okIweRgSmw.s['36']++;if(this.get('useShim')){__cov_3eiEp1iCAUM1okIweRgSmw.b['6'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['37']++;createShimNode(this,s);}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['6'][1]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['38']++;this.shim=s;}}__cov_3eiEp1iCAUM1okIweRgSmw.s['39']++;function createShimNode(drop,s){__cov_3eiEp1iCAUM1okIweRgSmw.f['12']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['40']++;var s,id;__cov_3eiEp1iCAUM1okIweRgSmw.s['41']++;try{__cov_3eiEp1iCAUM1okIweRgSmw.s['42']++;id=s.get('id');}catch(ex){__cov_3eiEp1iCAUM1okIweRgSmw.s['43']++;return s;}__cov_3eiEp1iCAUM1okIweRgSmw.s['44']++;s=Y.Node.create('
');__cov_3eiEp1iCAUM1okIweRgSmw.s['45']++;s.setStyles({height:drop.get(NODE).get(OFFSET_HEIGHT)+'px',width:drop.get(NODE).get(OFFSET_WIDTH)+'px',backgroundColor:'yellow',opacity:'.5',zIndex:'1',overflow:'hidden',top:'-900px',left:'-900px',position:'absolute'});__cov_3eiEp1iCAUM1okIweRgSmw.s['46']++;DDM._pg.appendChild(s);__cov_3eiEp1iCAUM1okIweRgSmw.s['47']++;s.on('mouseover',Y.bind(drop._handleOverEvent,drop));__cov_3eiEp1iCAUM1okIweRgSmw.s['48']++;s.on('mouseout',Y.bind(drop._handleOutEvent,drop));__cov_3eiEp1iCAUM1okIweRgSmw.s['49']++;drop.shim=s;__cov_3eiEp1iCAUM1okIweRgSmw.s['50']++;drop.fire('shimCreated',{drag:DDM.activeDrag});__cov_3eiEp1iCAUM1okIweRgSmw.s['51']++;return s;}__cov_3eiEp1iCAUM1okIweRgSmw.s['52']++;Y.extend(Drop,Y.Base,{_bubbleTargets:Y.DD.DDM,addToGroup:function(g){__cov_3eiEp1iCAUM1okIweRgSmw.f['13']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['53']++;this._groups[g]=true;__cov_3eiEp1iCAUM1okIweRgSmw.s['54']++;return this;},removeFromGroup:function(g){__cov_3eiEp1iCAUM1okIweRgSmw.f['14']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['55']++;delete this._groups[g];__cov_3eiEp1iCAUM1okIweRgSmw.s['56']++;return this;},_createEvents:function(){__cov_3eiEp1iCAUM1okIweRgSmw.f['15']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['57']++;var ev=[EV_DROP_OVER,EV_DROP_ENTER,EV_DROP_EXIT,'drop:hit'];__cov_3eiEp1iCAUM1okIweRgSmw.s['58']++;Y.Array.each(ev,function(v){__cov_3eiEp1iCAUM1okIweRgSmw.f['16']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['59']++;this.publish(v,{type:v,emitFacade:true,preventable:false,bubbles:true,queuable:false,prefix:'drop'});},this);},_valid:null,_groups:null,shim:null,region:null,overTarget:null,inGroup:function(groups){__cov_3eiEp1iCAUM1okIweRgSmw.f['17']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['60']++;this._valid=false;__cov_3eiEp1iCAUM1okIweRgSmw.s['61']++;var ret=false;__cov_3eiEp1iCAUM1okIweRgSmw.s['62']++;Y.Array.each(groups,function(v){__cov_3eiEp1iCAUM1okIweRgSmw.f['18']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['63']++;if(this._groups[v]){__cov_3eiEp1iCAUM1okIweRgSmw.b['7'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['64']++;ret=true;__cov_3eiEp1iCAUM1okIweRgSmw.s['65']++;this._valid=true;}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['7'][1]++;}},this);__cov_3eiEp1iCAUM1okIweRgSmw.s['66']++;return ret;},initializer:function(){__cov_3eiEp1iCAUM1okIweRgSmw.f['19']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['67']++;Y.later(100,this,this._createEvents);__cov_3eiEp1iCAUM1okIweRgSmw.s['68']++;var node=this.get(NODE),id;__cov_3eiEp1iCAUM1okIweRgSmw.s['69']++;if(!node.get('id')){__cov_3eiEp1iCAUM1okIweRgSmw.b['8'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['70']++;id=Y.stamp(node);__cov_3eiEp1iCAUM1okIweRgSmw.s['71']++;node.set('id',id);}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['8'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['72']++;node.addClass(DDM.CSS_PREFIX+'-drop');__cov_3eiEp1iCAUM1okIweRgSmw.s['73']++;this.set('groups',this.get('groups'));},destructor:function(){__cov_3eiEp1iCAUM1okIweRgSmw.f['20']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['74']++;DDM._unregTarget(this);__cov_3eiEp1iCAUM1okIweRgSmw.s['75']++;if((__cov_3eiEp1iCAUM1okIweRgSmw.b['10'][0]++,this.shim)&&(__cov_3eiEp1iCAUM1okIweRgSmw.b['10'][1]++,this.shim!==this.get(NODE))){__cov_3eiEp1iCAUM1okIweRgSmw.b['9'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['76']++;this.shim.detachAll();__cov_3eiEp1iCAUM1okIweRgSmw.s['77']++;this.shim.remove();__cov_3eiEp1iCAUM1okIweRgSmw.s['78']++;this.shim=null;}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['9'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['79']++;this.get(NODE).removeClass(DDM.CSS_PREFIX+'-drop');__cov_3eiEp1iCAUM1okIweRgSmw.s['80']++;this.detachAll();},_deactivateShim:function(){__cov_3eiEp1iCAUM1okIweRgSmw.f['21']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['81']++;if(!this.shim){__cov_3eiEp1iCAUM1okIweRgSmw.b['11'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['82']++;return false;}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['11'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['83']++;this.get(NODE).removeClass(DDM.CSS_PREFIX+'-drop-active-valid');__cov_3eiEp1iCAUM1okIweRgSmw.s['84']++;this.get(NODE).removeClass(DDM.CSS_PREFIX+'-drop-active-invalid');__cov_3eiEp1iCAUM1okIweRgSmw.s['85']++;this.get(NODE).removeClass(DDM.CSS_PREFIX+'-drop-over');__cov_3eiEp1iCAUM1okIweRgSmw.s['86']++;if(this.get('useShim')){__cov_3eiEp1iCAUM1okIweRgSmw.b['12'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['87']++;this.shim.setStyles({top:'-999px',left:'-999px',zIndex:'1'});}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['12'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['88']++;this.overTarget=false;},_activateShim:function(){__cov_3eiEp1iCAUM1okIweRgSmw.f['22']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['89']++;if(!DDM.activeDrag){__cov_3eiEp1iCAUM1okIweRgSmw.b['13'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['90']++;return false;}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['13'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['91']++;if(this.get(NODE)===DDM.activeDrag.get(NODE)){__cov_3eiEp1iCAUM1okIweRgSmw.b['14'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['92']++;return false;}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['14'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['93']++;if(this.get('lock')){__cov_3eiEp1iCAUM1okIweRgSmw.b['15'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['94']++;return false;}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['15'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['95']++;var node=this.get(NODE);__cov_3eiEp1iCAUM1okIweRgSmw.s['96']++;if(this.inGroup(DDM.activeDrag.get('groups'))){__cov_3eiEp1iCAUM1okIweRgSmw.b['16'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['97']++;node.removeClass(DDM.CSS_PREFIX+'-drop-active-invalid');__cov_3eiEp1iCAUM1okIweRgSmw.s['98']++;node.addClass(DDM.CSS_PREFIX+'-drop-active-valid');__cov_3eiEp1iCAUM1okIweRgSmw.s['99']++;DDM._addValid(this);__cov_3eiEp1iCAUM1okIweRgSmw.s['100']++;this.overTarget=false;__cov_3eiEp1iCAUM1okIweRgSmw.s['101']++;if(!this.get('useShim')){__cov_3eiEp1iCAUM1okIweRgSmw.b['17'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['102']++;this.shim=this.get(NODE);}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['17'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['103']++;this.sizeShim();}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['16'][1]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['104']++;DDM._removeValid(this);__cov_3eiEp1iCAUM1okIweRgSmw.s['105']++;node.removeClass(DDM.CSS_PREFIX+'-drop-active-valid');__cov_3eiEp1iCAUM1okIweRgSmw.s['106']++;node.addClass(DDM.CSS_PREFIX+'-drop-active-invalid');}},sizeShim:function(){__cov_3eiEp1iCAUM1okIweRgSmw.f['23']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['107']++;if(!DDM.activeDrag){__cov_3eiEp1iCAUM1okIweRgSmw.b['18'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['108']++;return false;}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['18'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['109']++;if(this.get(NODE)===DDM.activeDrag.get(NODE)){__cov_3eiEp1iCAUM1okIweRgSmw.b['19'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['110']++;return false;}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['19'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['111']++;if(this.get('lock')){__cov_3eiEp1iCAUM1okIweRgSmw.b['20'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['112']++;return false;}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['20'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['113']++;if(!this.shim){__cov_3eiEp1iCAUM1okIweRgSmw.b['21'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['114']++;Y.later(100,this,this.sizeShim);__cov_3eiEp1iCAUM1okIweRgSmw.s['115']++;return false;}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['21'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['116']++;var node=this.get(NODE),nh=node.get(OFFSET_HEIGHT),nw=node.get(OFFSET_WIDTH),xy=node.getXY(),p=this.get('padding'),dd,dH,dW;__cov_3eiEp1iCAUM1okIweRgSmw.s['117']++;nw=nw+p.left+p.right;__cov_3eiEp1iCAUM1okIweRgSmw.s['118']++;nh=nh+p.top+p.bottom;__cov_3eiEp1iCAUM1okIweRgSmw.s['119']++;xy[0]=xy[0]-p.left;__cov_3eiEp1iCAUM1okIweRgSmw.s['120']++;xy[1]=xy[1]-p.top;__cov_3eiEp1iCAUM1okIweRgSmw.s['121']++;if(DDM.activeDrag.get('dragMode')===DDM.INTERSECT){__cov_3eiEp1iCAUM1okIweRgSmw.b['22'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['122']++;dd=DDM.activeDrag;__cov_3eiEp1iCAUM1okIweRgSmw.s['123']++;dH=dd.get(NODE).get(OFFSET_HEIGHT);__cov_3eiEp1iCAUM1okIweRgSmw.s['124']++;dW=dd.get(NODE).get(OFFSET_WIDTH);__cov_3eiEp1iCAUM1okIweRgSmw.s['125']++;nh=nh+dH;__cov_3eiEp1iCAUM1okIweRgSmw.s['126']++;nw=nw+dW;__cov_3eiEp1iCAUM1okIweRgSmw.s['127']++;xy[0]=xy[0]-(dW-dd.deltaXY[0]);__cov_3eiEp1iCAUM1okIweRgSmw.s['128']++;xy[1]=xy[1]-(dH-dd.deltaXY[1]);}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['22'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['129']++;if(this.get('useShim')){__cov_3eiEp1iCAUM1okIweRgSmw.b['23'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['130']++;this.shim.setStyles({height:nh+'px',width:nw+'px',top:xy[1]+'px',left:xy[0]+'px'});}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['23'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['131']++;this.region={'0':xy[0],'1':xy[1],area:0,top:xy[1],right:xy[0]+nw,bottom:xy[1]+nh,left:xy[0]};},_handleTargetOver:function(){__cov_3eiEp1iCAUM1okIweRgSmw.f['24']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['132']++;if(DDM.isOverTarget(this)){__cov_3eiEp1iCAUM1okIweRgSmw.b['24'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['133']++;this.get(NODE).addClass(DDM.CSS_PREFIX+'-drop-over');__cov_3eiEp1iCAUM1okIweRgSmw.s['134']++;DDM.activeDrop=this;__cov_3eiEp1iCAUM1okIweRgSmw.s['135']++;DDM.otherDrops[this]=this;__cov_3eiEp1iCAUM1okIweRgSmw.s['136']++;if(this.overTarget){__cov_3eiEp1iCAUM1okIweRgSmw.b['25'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['137']++;DDM.activeDrag.fire('drag:over',{drop:this,drag:DDM.activeDrag});__cov_3eiEp1iCAUM1okIweRgSmw.s['138']++;this.fire(EV_DROP_OVER,{drop:this,drag:DDM.activeDrag});}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['25'][1]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['139']++;if(DDM.activeDrag.get('dragging')){__cov_3eiEp1iCAUM1okIweRgSmw.b['26'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['140']++;this.overTarget=true;__cov_3eiEp1iCAUM1okIweRgSmw.s['141']++;this.fire(EV_DROP_ENTER,{drop:this,drag:DDM.activeDrag});__cov_3eiEp1iCAUM1okIweRgSmw.s['142']++;DDM.activeDrag.fire('drag:enter',{drop:this,drag:DDM.activeDrag});__cov_3eiEp1iCAUM1okIweRgSmw.s['143']++;DDM.activeDrag.get(NODE).addClass(DDM.CSS_PREFIX+'-drag-over');}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['26'][1]++;}}}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['24'][1]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['144']++;this._handleOut();}},_handleOverEvent:function(){__cov_3eiEp1iCAUM1okIweRgSmw.f['25']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['145']++;this.shim.setStyle('zIndex','999');__cov_3eiEp1iCAUM1okIweRgSmw.s['146']++;DDM._addActiveShim(this);},_handleOutEvent:function(){__cov_3eiEp1iCAUM1okIweRgSmw.f['26']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['147']++;this.shim.setStyle('zIndex','1');__cov_3eiEp1iCAUM1okIweRgSmw.s['148']++;DDM._removeActiveShim(this);},_handleOut:function(force){__cov_3eiEp1iCAUM1okIweRgSmw.f['27']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['149']++;if((__cov_3eiEp1iCAUM1okIweRgSmw.b['28'][0]++,!DDM.isOverTarget(this))||(__cov_3eiEp1iCAUM1okIweRgSmw.b['28'][1]++,force)){__cov_3eiEp1iCAUM1okIweRgSmw.b['27'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['150']++;if(this.overTarget){__cov_3eiEp1iCAUM1okIweRgSmw.b['29'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['151']++;this.overTarget=false;__cov_3eiEp1iCAUM1okIweRgSmw.s['152']++;if(!force){__cov_3eiEp1iCAUM1okIweRgSmw.b['30'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['153']++;DDM._removeActiveShim(this);}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['30'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['154']++;if(DDM.activeDrag){__cov_3eiEp1iCAUM1okIweRgSmw.b['31'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['155']++;this.get(NODE).removeClass(DDM.CSS_PREFIX+'-drop-over');__cov_3eiEp1iCAUM1okIweRgSmw.s['156']++;DDM.activeDrag.get(NODE).removeClass(DDM.CSS_PREFIX+'-drag-over');__cov_3eiEp1iCAUM1okIweRgSmw.s['157']++;this.fire(EV_DROP_EXIT,{drop:this,drag:DDM.activeDrag});__cov_3eiEp1iCAUM1okIweRgSmw.s['158']++;DDM.activeDrag.fire('drag:exit',{drop:this,drag:DDM.activeDrag});__cov_3eiEp1iCAUM1okIweRgSmw.s['159']++;delete DDM.otherDrops[this];}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['31'][1]++;}}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['29'][1]++;}}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['27'][1]++;}}});__cov_3eiEp1iCAUM1okIweRgSmw.s['160']++;Y.DD.Drop=Drop;},'@VERSION@',{'requires':['dd-drag','dd-ddm-drop']}); diff --git a/build/dd-drop/dd-drop-debug.js b/build/dd-drop/dd-drop-debug.js index 806837dfed9..9012abab29a 100644 --- a/build/dd-drop/dd-drop-debug.js +++ b/build/dd-drop/dd-drop-debug.js @@ -71,8 +71,13 @@ YUI.add('dd-drop', function (Y, NAME) { //DD init speed up. + // (GS) Causes errors. + // (GS) See: http://yuilibrary.com/trac-archive/tickets/2532985.html + // (GS) However, changing from async to sync + // (GS) will cause change propagation, so leave it alone + // (GS) until further investigation and thorough testing. Y.on('domready', Y.bind(function() { - Y.later(100, this, this._createShim); + Y.later(100, this, Drop_createShim); }, this)); DDM._regTarget(this); @@ -178,6 +183,55 @@ YUI.add('dd-drop', function (Y, NAME) { } }; + function Drop_createShim() { + //No playground, defer + if (!DDM._pg) { + Y.later(10, this, Drop_createShim); + return; + } + if (this.shim) return; + + var s = this.get('node'); + + if (this.get('useShim')) { + createShimNode(this, s); + } else { + this.shim = s; + } + } + + function createShimNode(drop, s) { + var s, id; + try { + id = s.get("id"); + } catch(ex) { + // _stateProxy is null, TypeError thrown getting + // _stateProxy[id]. + // See: http://yuilibrary.com/trac-archive/tickets/2532985.html + return s; + } + + s = Y.Node.create('
'); + s.setStyles({ + height: drop.get(NODE).get(OFFSET_HEIGHT) + 'px', + width: drop.get(NODE).get(OFFSET_WIDTH) + 'px', + backgroundColor: 'yellow', + opacity: '.5', + zIndex: '1', + overflow: 'hidden', + top: '-900px', + left: '-900px', + position: 'absolute' + }); + DDM._pg.appendChild(s); + + s.on('mouseover', Y.bind(drop._handleOverEvent, drop)); + s.on('mouseout', Y.bind(drop._handleOutEvent, drop)); + drop.shim = s; + drop.fire("shimCreated", {drag: DDM.activeDrag }); + return s; + } + Y.extend(Drop, Y.Base, { /** * The default bubbleTarget for this object. Default: Y.DD.DDM @@ -435,46 +489,7 @@ YUI.add('dd-drop', function (Y, NAME) { left: xy[0] }; }, - /** - * Creates the Target shim and adds it to the DDM's playground.. - * @private - * @method _createShim - */ - _createShim: function() { - //No playground, defer - if (!DDM._pg) { - Y.later(10, this, this._createShim); - return; - } - //Shim already here, cancel - if (this.shim) { - return; - } - var s = this.get('node'); - - if (this.get('useShim')) { - s = Y.Node.create('
'); - s.setStyles({ - height: this.get(NODE).get(OFFSET_HEIGHT) + 'px', - width: this.get(NODE).get(OFFSET_WIDTH) + 'px', - backgroundColor: 'yellow', - opacity: '.5', - zIndex: '1', - overflow: 'hidden', - top: '-900px', - left: '-900px', - position: 'absolute' - }); - - DDM._pg.appendChild(s); - s.on('mouseover', Y.bind(this._handleOverEvent, this)); - s.on('mouseout', Y.bind(this._handleOutEvent, this)); - } - - - this.shim = s; - }, /** * This handles the over target call made from this object or from the DDM * @private diff --git a/build/dd-drop/dd-drop-min.js b/build/dd-drop/dd-drop-min.js index e800bff2f4d..05f43cf48b7 100644 --- a/build/dd-drop/dd-drop-min.js +++ b/build/dd-drop/dd-drop-min.js @@ -1 +1 @@ -YUI.add("dd-drop",function(e,t){var n="node",r=e.DD.DDM,i="offsetHeight",s="offsetWidth",o="drop:over",u="drop:enter",a="drop:exit",f=function(){this._lazyAddAttrs=!1,f.superclass.constructor.apply(this,arguments),e.on("domready",e.bind(function(){e.later(100,this,this._createShim)},this)),r._regTarget(this)};f.NAME="drop",f.ATTRS={node:{setter:function(t){var n=e.one(t);return n||e.error("DD.Drop: Invalid Node Given: "+t),n}},groups:{value:["default"],getter:function(){return this._groups?e.Object.keys(this._groups):(this._groups={},[])},setter:function(t){return this._groups=e.Array.hash(t),t}},padding:{value:"0",setter:function(e){return r.cssSizestoObject(e)}},lock:{value:!1,setter:function(e){return e?this.get(n).addClass(r.CSS_PREFIX+"-drop-locked"):this.get(n).removeClass(r.CSS_PREFIX+"-drop-locked"),e}},bubbles:{setter:function(e){return this.addTarget(e),e}},useShim:{value:!0,setter:function(t){return e.DD.DDM._noShim=!t,t}}},e.extend(f,e.Base,{_bubbleTargets:e.DD.DDM,addToGroup:function(e){return this._groups[e]=!0,this},removeFromGroup:function(e){return delete this._groups[e],this},_createEvents:function(){var t=[o,u,a,"drop:hit"];e.Array.each(t,function(e){this.publish(e,{type:e,emitFacade:!0,preventable:!1,bubbles:!0,queuable:!1,prefix:"drop"})},this)},_valid:null,_groups:null,shim:null,region:null,overTarget:null,inGroup:function(t){this._valid=!1;var n=!1;return e.Array.each(t,function(e){this._groups[e]&&(n=!0,this._valid=!0)},this),n},initializer:function(){e.later(100,this,this._createEvents);var t=this.get(n),i;t.get("id")||(i=e.stamp(t),t.set("id",i)),t.addClass(r.CSS_PREFIX+"-drop"),this.set("groups",this.get("groups"))},destructor:function(){r._unregTarget(this),this.shim&&this.shim!==this.get(n)&&(this.shim.detachAll(),this.shim.remove(),this.shim=null),this.get(n).removeClass(r.CSS_PREFIX+"-drop"),this.detachAll()},_deactivateShim:function(){if(!this.shim)return!1;this.get(n).removeClass(r.CSS_PREFIX+"-drop-active-valid"),this.get(n).removeClass(r.CSS_PREFIX+"-drop-active-invalid"),this.get(n).removeClass(r.CSS_PREFIX+"-drop-over"),this.get("useShim")&&this.shim.setStyles({top:"-999px",left:"-999px",zIndex:"1"}),this.overTarget=!1},_activateShim:function(){if(!r.activeDrag)return!1;if(this.get(n)===r.activeDrag.get(n))return!1;if(this.get("lock"))return!1;var e=this.get(n);this.inGroup(r.activeDrag.get("groups"))?(e.removeClass(r.CSS_PREFIX+"-drop-active-invalid"),e.addClass(r.CSS_PREFIX+"-drop-active-valid"),r._addValid(this),this.overTarget=!1,this.get("useShim")||(this.shim=this.get(n)),this.sizeShim()):(r._removeValid(this),e.removeClass(r.CSS_PREFIX+"-drop-active-valid"),e.addClass(r.CSS_PREFIX+"-drop-active-invalid"))},sizeShim:function(){if(!r.activeDrag)return!1;if(this.get(n)===r.activeDrag.get(n))return!1;if(this.get("lock"))return!1;if(!this.shim)return e.later(100,this,this.sizeShim),!1;var t=this.get(n),o=t.get(i),u=t.get(s),a=t.getXY(),f=this.get("padding"),l,c,h;u=u+f.left+f.right,o=o+f.top+f.bottom,a[0]=a[0]-f.left,a[1]=a[1]-f.top,r.activeDrag.get("dragMode")===r.INTERSECT&&(l=r.activeDrag,c=l.get(n).get(i),h=l.get(n).get(s),o+=c,u+=h,a[0]=a[0]-(h-l.deltaXY[0]),a[1]=a[1]-(c-l.deltaXY[1])),this.get("useShim")&&this.shim.setStyles({height:o+"px",width:u+"px",top:a[1]+"px",left:a[0]+"px"}),this.region={0:a[0],1:a[1],area:0,top:a[1],right:a[0]+u,bottom:a[1]+o,left:a[0]}},_createShim:function(){if(!r._pg){e.later(10,this,this._createShim);return}if(this.shim)return;var t=this.get("node");this.get("useShim")&&(t=e.Node.create('
'),t.setStyles({height:this.get(n).get(i)+"px",width:this.get(n).get(s)+"px",backgroundColor:"yellow",opacity:".5",zIndex:"1",overflow:"hidden",top:"-900px",left:"-900px",position:"absolute"}),r._pg.appendChild(t),t.on("mouseover",e.bind(this._handleOverEvent,this)),t.on("mouseout",e.bind(this._handleOutEvent,this))),this.shim=t},_handleTargetOver:function(){r.isOverTarget(this)?(this.get(n).addClass(r.CSS_PREFIX+"-drop-over"),r.activeDrop=this,r.otherDrops[this]=this,this.overTarget?(r.activeDrag.fire("drag:over",{drop:this,drag:r.activeDrag}),this.fire(o,{drop:this,drag:r.activeDrag})):r.activeDrag.get("dragging")&&(this.overTarget=!0,this.fire(u,{drop:this,drag:r.activeDrag}),r.activeDrag.fire("drag:enter",{drop:this,drag:r.activeDrag}),r.activeDrag.get(n).addClass(r.CSS_PREFIX+"-drag-over"))):this._handleOut()},_handleOverEvent:function(){this.shim.setStyle("zIndex","999"),r._addActiveShim(this)},_handleOutEvent:function(){this.shim.setStyle("zIndex","1"),r._removeActiveShim(this)},_handleOut:function(e){(!r.isOverTarget(this)||e)&&this.overTarget&&(this.overTarget=!1,e||r._removeActiveShim(this),r.activeDrag&&(this.get(n).removeClass(r.CSS_PREFIX+"-drop-over"),r.activeDrag.get(n).removeClass(r.CSS_PREFIX+"-drag-over"),this.fire(a,{drop:this,drag:r.activeDrag}),r.activeDrag.fire("drag:exit",{drop:this,drag:r.activeDrag}),delete r.otherDrops[this]))}}),e.DD.Drop=f},"@VERSION@",{requires:["dd-drag","dd-ddm-drop"]}); +YUI.add("dd-drop",function(e,t){function l(){if(!r._pg){e.later(10,this,l);return}if(this.shim)return;var t=this.get("node");this.get("useShim")?c(this,t):this.shim=t}function c(t,o){var o,u;try{u=o.get("id")}catch(a){return o}return o=e.Node.create('
'),o.setStyles({height:t.get(n).get(i)+"px",width:t.get(n).get(s)+"px",backgroundColor:"yellow",opacity:".5",zIndex:"1",overflow:"hidden",top:"-900px",left:"-900px",position:"absolute"}),r._pg.appendChild(o),o.on("mouseover",e.bind(t._handleOverEvent,t)),o.on("mouseout",e.bind(t._handleOutEvent,t)),t.shim=o,t.fire("shimCreated",{drag:r.activeDrag}),o}var n="node",r=e.DD.DDM,i="offsetHeight",s="offsetWidth",o="drop:over",u="drop:enter",a="drop:exit",f=function(){this._lazyAddAttrs=!1,f.superclass.constructor.apply(this,arguments),e.on("domready",e.bind(function(){e.later(100,this,l)},this)),r._regTarget(this)};f.NAME="drop",f.ATTRS={node:{setter:function(t){var n=e.one(t);return n||e.error("DD.Drop: Invalid Node Given: "+t),n}},groups:{value:["default"],getter:function(){return this._groups?e.Object.keys(this._groups):(this._groups={},[])},setter:function(t){return this._groups=e.Array.hash(t),t}},padding:{value:"0",setter:function(e){return r.cssSizestoObject(e)}},lock:{value:!1,setter:function(e){return e?this.get(n).addClass(r.CSS_PREFIX+"-drop-locked"):this.get(n).removeClass(r.CSS_PREFIX+"-drop-locked"),e}},bubbles:{setter:function(e){return this.addTarget(e),e}},useShim:{value:!0,setter:function(t){return e.DD.DDM._noShim=!t,t}}},e.extend(f,e.Base,{_bubbleTargets:e.DD.DDM,addToGroup:function(e){return this._groups[e]=!0,this},removeFromGroup:function(e){return delete this._groups[e],this},_createEvents:function(){var t=[o,u,a,"drop:hit"];e.Array.each(t,function(e){this.publish(e,{type:e,emitFacade:!0,preventable:!1,bubbles:!0,queuable:!1,prefix:"drop"})},this)},_valid:null,_groups:null,shim:null,region:null,overTarget:null,inGroup:function(t){this._valid=!1;var n=!1;return e.Array.each(t,function(e){this._groups[e]&&(n=!0,this._valid=!0)},this),n},initializer:function(){e.later(100,this,this._createEvents);var t=this.get(n),i;t.get("id")||(i=e.stamp(t),t.set("id",i)),t.addClass(r.CSS_PREFIX+"-drop"),this.set("groups",this.get("groups"))},destructor:function(){r._unregTarget(this),this.shim&&this.shim!==this.get(n)&&(this.shim.detachAll(),this.shim.remove(),this.shim=null),this.get(n).removeClass(r.CSS_PREFIX+"-drop"),this.detachAll()},_deactivateShim:function(){if(!this.shim)return!1;this.get(n).removeClass(r.CSS_PREFIX+"-drop-active-valid"),this.get(n).removeClass(r.CSS_PREFIX+"-drop-active-invalid"),this.get(n).removeClass(r.CSS_PREFIX+"-drop-over"),this.get("useShim")&&this.shim.setStyles({top:"-999px",left:"-999px",zIndex:"1"}),this.overTarget=!1},_activateShim:function(){if(!r.activeDrag)return!1;if(this.get(n)===r.activeDrag.get(n))return!1;if(this.get("lock"))return!1;var e=this.get(n);this.inGroup(r.activeDrag.get("groups"))?(e.removeClass(r.CSS_PREFIX+"-drop-active-invalid"),e.addClass(r.CSS_PREFIX+"-drop-active-valid"),r._addValid(this),this.overTarget=!1,this.get("useShim")||(this.shim=this.get(n)),this.sizeShim()):(r._removeValid(this),e.removeClass(r.CSS_PREFIX+"-drop-active-valid"),e.addClass(r.CSS_PREFIX+"-drop-active-invalid"))},sizeShim:function(){if(!r.activeDrag)return!1;if(this.get(n)===r.activeDrag.get(n))return!1;if(this.get("lock"))return!1;if(!this.shim)return e.later(100,this,this.sizeShim),!1;var t=this.get(n),o=t.get(i),u=t.get(s),a=t.getXY(),f=this.get("padding"),l,c,h;u=u+f.left+f.right,o=o+f.top+f.bottom,a[0]=a[0]-f.left,a[1]=a[1]-f.top,r.activeDrag.get("dragMode")===r.INTERSECT&&(l=r.activeDrag,c=l.get(n).get(i),h=l.get(n).get(s),o+=c,u+=h,a[0]=a[0]-(h-l.deltaXY[0]),a[1]=a[1]-(c-l.deltaXY[1])),this.get("useShim")&&this.shim.setStyles({height:o+"px",width:u+"px",top:a[1]+"px",left:a[0]+"px"}),this.region={0:a[0],1:a[1],area:0,top:a[1],right:a[0]+u,bottom:a[1]+o,left:a[0]}},_handleTargetOver:function(){r.isOverTarget(this)?(this.get(n).addClass(r.CSS_PREFIX+"-drop-over"),r.activeDrop=this,r.otherDrops[this]=this,this.overTarget?(r.activeDrag.fire("drag:over",{drop:this,drag:r.activeDrag}),this.fire(o,{drop:this,drag:r.activeDrag})):r.activeDrag.get("dragging")&&(this.overTarget=!0,this.fire(u,{drop:this,drag:r.activeDrag}),r.activeDrag.fire("drag:enter",{drop:this,drag:r.activeDrag}),r.activeDrag.get(n).addClass(r.CSS_PREFIX+"-drag-over"))):this._handleOut()},_handleOverEvent:function(){this.shim.setStyle("zIndex","999"),r._addActiveShim(this)},_handleOutEvent:function(){this.shim.setStyle("zIndex","1"),r._removeActiveShim(this)},_handleOut:function(e){(!r.isOverTarget(this)||e)&&this.overTarget&&(this.overTarget=!1,e||r._removeActiveShim(this),r.activeDrag&&(this.get(n).removeClass(r.CSS_PREFIX+"-drop-over"),r.activeDrag.get(n).removeClass(r.CSS_PREFIX+"-drag-over"),this.fire(a,{drop:this,drag:r.activeDrag}),r.activeDrag.fire("drag:exit",{drop:this,drag:r.activeDrag}),delete r.otherDrops[this]))}}),e.DD.Drop=f},"@VERSION@",{requires:["dd-drag","dd-ddm-drop"]}); diff --git a/build/dd-drop/dd-drop.js b/build/dd-drop/dd-drop.js index bd182ee0daf..f8cd445c2fc 100644 --- a/build/dd-drop/dd-drop.js +++ b/build/dd-drop/dd-drop.js @@ -1,4 +1,4 @@ -YUI.add('dd-drop', function (Y, NAME) { +YUI.add('dd-drop', function (Y, NAME){ /** @@ -71,8 +71,13 @@ YUI.add('dd-drop', function (Y, NAME) { //DD init speed up. + // (GS) Causes errors. + // (GS) See: http://yuilibrary.com/trac-archive/tickets/2532985.html + // (GS) However, changing from async to sync + // (GS) will cause change propagation, so leave it alone + // (GS) until further investigation and thorough testing. Y.on('domready', Y.bind(function() { - Y.later(100, this, this._createShim); + Y.later(100, this, Drop_createShim); }, this)); DDM._regTarget(this); @@ -177,6 +182,55 @@ YUI.add('dd-drop', function (Y, NAME) { } }; + function Drop_createShim() { + //No playground, defer + if (!DDM._pg) { + Y.later(10, this, Drop_createShim); + return; + } + if (this.shim) return; + + var s = this.get('node'); + + if (this.get('useShim')) { + createShimNode(this, s); + } else { + this.shim = s; + } + } + + function createShimNode(drop, s) { + var id; + try { + id = s.get("id"); + } catch(ex) { + // _stateProxy is null, TypeError thrown getting + // _stateProxy[id]. + // See: http://yuilibrary.com/trac-archive/tickets/2532985.html + return s; + } + + s = Y.Node.create('
'); + s.setStyles({ + height: drop.get(NODE).get(OFFSET_HEIGHT) + 'px', + width: drop.get(NODE).get(OFFSET_WIDTH) + 'px', + backgroundColor: 'yellow', + opacity: '.5', + zIndex: '1', + overflow: 'hidden', + top: '-900px', + left: '-900px', + position: 'absolute' + }); + DDM._pg.appendChild(s); + + s.on('mouseover', Y.bind(drop._handleOverEvent, drop)); + s.on('mouseout', Y.bind(drop._handleOutEvent, drop)); + drop.shim = s; + drop.fire("shimCreated", {drag: DDM.activeDrag }); + return s; + } + Y.extend(Drop, Y.Base, { /** * The default bubbleTarget for this object. Default: Y.DD.DDM @@ -434,46 +488,7 @@ YUI.add('dd-drop', function (Y, NAME) { left: xy[0] }; }, - /** - * Creates the Target shim and adds it to the DDM's playground.. - * @private - * @method _createShim - */ - _createShim: function() { - //No playground, defer - if (!DDM._pg) { - Y.later(10, this, this._createShim); - return; - } - //Shim already here, cancel - if (this.shim) { - return; - } - var s = this.get('node'); - - if (this.get('useShim')) { - s = Y.Node.create('
'); - s.setStyles({ - height: this.get(NODE).get(OFFSET_HEIGHT) + 'px', - width: this.get(NODE).get(OFFSET_WIDTH) + 'px', - backgroundColor: 'yellow', - opacity: '.5', - zIndex: '1', - overflow: 'hidden', - top: '-900px', - left: '-900px', - position: 'absolute' - }); - - DDM._pg.appendChild(s); - s.on('mouseover', Y.bind(this._handleOverEvent, this)); - s.on('mouseout', Y.bind(this._handleOutEvent, this)); - } - - - this.shim = s; - }, /** * This handles the over target call made from this object or from the DDM * @private diff --git a/src/build/dd-constrain/dd-constrain-coverage.js b/src/build/dd-constrain/dd-constrain-coverage.js new file mode 100644 index 00000000000..350224a0a0f --- /dev/null +++ b/src/build/dd-constrain/dd-constrain-coverage.js @@ -0,0 +1,6 @@ +if (typeof __coverage__ === 'undefined') { __coverage__ = {}; } +if (!__coverage__['build/dd-constrain/dd-constrain.js']) { + __coverage__['build/dd-constrain/dd-constrain.js'] = {"path":"build/dd-constrain/dd-constrain.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0,"106":0,"107":0,"108":0,"109":0,"110":0,"111":0,"112":0,"113":0,"114":0,"115":0,"116":0,"117":0,"118":0,"119":0,"120":0,"121":0,"122":0,"123":0,"124":0,"125":0,"126":0,"127":0,"128":0,"129":0,"130":0,"131":0,"132":0},"b":{"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0],"8":[0,0],"9":[0,0],"10":[0,0],"11":[0,0],"12":[0,0],"13":[0,0],"14":[0,0],"15":[0,0],"16":[0,0],"17":[0,0],"18":[0,0],"19":[0,0],"20":[0,0],"21":[0,0],"22":[0,0],"23":[0,0],"24":[0,0,0],"25":[0,0],"26":[0,0,0],"27":[0,0],"28":[0,0],"29":[0,0],"30":[0,0],"31":[0,0],"32":[0,0],"33":[0,0],"34":[0,0],"35":[0,0],"36":[0,0],"37":[0,0],"38":[0,0],"39":[0,0],"40":[0,0],"41":[0,0],"42":[0,0],"43":[0,0],"44":[0,0],"45":[0,0],"46":[0,0],"47":[0,0],"48":[0,0],"49":[0,0],"50":[0,0]},"f":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":43}}},"2":{"name":"(anonymous_2)","line":53,"loc":{"start":{"line":53,"column":12},"end":{"line":53,"column":23}}},"3":{"name":"(anonymous_3)","line":129,"loc":{"start":{"line":129,"column":20},"end":{"line":129,"column":37}}},"4":{"name":"(anonymous_4)","line":143,"loc":{"start":{"line":143,"column":20},"end":{"line":143,"column":34}}},"5":{"name":"(anonymous_5)","line":158,"loc":{"start":{"line":158,"column":20},"end":{"line":158,"column":32}}},"6":{"name":"(anonymous_6)","line":169,"loc":{"start":{"line":169,"column":20},"end":{"line":169,"column":32}}},"7":{"name":"(anonymous_7)","line":180,"loc":{"start":{"line":180,"column":20},"end":{"line":180,"column":31}}},"8":{"name":"(anonymous_8)","line":198,"loc":{"start":{"line":198,"column":21},"end":{"line":198,"column":32}}},"9":{"name":"(anonymous_9)","line":208,"loc":{"start":{"line":208,"column":20},"end":{"line":208,"column":31}}},"10":{"name":"(anonymous_10)","line":211,"loc":{"start":{"line":211,"column":16},"end":{"line":211,"column":33}}},"11":{"name":"(anonymous_11)","line":223,"loc":{"start":{"line":223,"column":23},"end":{"line":223,"column":34}}},"12":{"name":"(anonymous_12)","line":229,"loc":{"start":{"line":229,"column":29},"end":{"line":229,"column":41}}},"13":{"name":"(anonymous_13)","line":244,"loc":{"start":{"line":244,"column":20},"end":{"line":244,"column":31}}},"14":{"name":"(anonymous_14)","line":253,"loc":{"start":{"line":253,"column":22},"end":{"line":253,"column":33}}},"15":{"name":"(anonymous_15)","line":268,"loc":{"start":{"line":268,"column":22},"end":{"line":268,"column":33}}},"16":{"name":"(anonymous_16)","line":275,"loc":{"start":{"line":275,"column":20},"end":{"line":275,"column":31}}},"17":{"name":"(anonymous_17)","line":283,"loc":{"start":{"line":283,"column":24},"end":{"line":283,"column":35}}},"18":{"name":"(anonymous_18)","line":309,"loc":{"start":{"line":309,"column":29},"end":{"line":309,"column":44}}},"19":{"name":"(anonymous_19)","line":325,"loc":{"start":{"line":325,"column":19},"end":{"line":325,"column":33}}},"20":{"name":"(anonymous_20)","line":347,"loc":{"start":{"line":347,"column":22},"end":{"line":347,"column":36}}},"21":{"name":"(anonymous_21)","line":376,"loc":{"start":{"line":376,"column":18},"end":{"line":376,"column":31}}},"22":{"name":"(anonymous_22)","line":390,"loc":{"start":{"line":390,"column":15},"end":{"line":390,"column":26}}},"23":{"name":"(anonymous_23)","line":414,"loc":{"start":{"line":414,"column":14},"end":{"line":414,"column":25}}},"24":{"name":"(anonymous_24)","line":438,"loc":{"start":{"line":438,"column":21},"end":{"line":438,"column":37}}},"25":{"name":"(anonymous_25)","line":464,"loc":{"start":{"line":464,"column":21},"end":{"line":464,"column":32}}},"26":{"name":"(anonymous_26)","line":472,"loc":{"start":{"line":472,"column":21},"end":{"line":472,"column":32}}},"27":{"name":"(anonymous_27)","line":495,"loc":{"start":{"line":495,"column":20},"end":{"line":495,"column":59}}},"28":{"name":"(anonymous_28)","line":526,"loc":{"start":{"line":526,"column":24},"end":{"line":526,"column":57}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":562,"column":43}},"2":{"start":{"line":23,"column":4},"end":{"line":56,"column":10}},"3":{"start":{"line":54,"column":12},"end":{"line":54,"column":39}},"4":{"start":{"line":55,"column":12},"end":{"line":55,"column":60}},"5":{"start":{"line":58,"column":4},"end":{"line":58,"column":29}},"6":{"start":{"line":68,"column":4},"end":{"line":68,"column":17}},"7":{"start":{"line":70,"column":4},"end":{"line":192,"column":6}},"8":{"start":{"line":130,"column":16},"end":{"line":130,"column":57}},"9":{"start":{"line":144,"column":16},"end":{"line":144,"column":38}},"10":{"start":{"line":145,"column":16},"end":{"line":147,"column":17}},"11":{"start":{"line":146,"column":20},"end":{"line":146,"column":31}},"12":{"start":{"line":148,"column":16},"end":{"line":148,"column":27}},"13":{"start":{"line":159,"column":16},"end":{"line":159,"column":48}},"14":{"start":{"line":170,"column":16},"end":{"line":170,"column":55}},"15":{"start":{"line":181,"column":16},"end":{"line":181,"column":51}},"16":{"start":{"line":194,"column":4},"end":{"line":475,"column":6}},"17":{"start":{"line":199,"column":12},"end":{"line":199,"column":33}},"18":{"start":{"line":201,"column":12},"end":{"line":206,"column":14}},"19":{"start":{"line":209,"column":12},"end":{"line":214,"column":14}},"20":{"start":{"line":212,"column":20},"end":{"line":212,"column":36}},"21":{"start":{"line":216,"column":12},"end":{"line":216,"column":42}},"22":{"start":{"line":224,"column":12},"end":{"line":227,"column":14}},"23":{"start":{"line":229,"column":12},"end":{"line":237,"column":21}},"24":{"start":{"line":230,"column":16},"end":{"line":236,"column":19}},"25":{"start":{"line":245,"column":12},"end":{"line":245,"column":40}},"26":{"start":{"line":246,"column":12},"end":{"line":246,"column":40}},"27":{"start":{"line":254,"column":12},"end":{"line":254,"column":30}},"28":{"start":{"line":269,"column":12},"end":{"line":269,"column":68}},"29":{"start":{"line":276,"column":12},"end":{"line":276,"column":37}},"30":{"start":{"line":284,"column":12},"end":{"line":286,"column":23}},"31":{"start":{"line":288,"column":12},"end":{"line":301,"column":13}},"32":{"start":{"line":289,"column":16},"end":{"line":300,"column":17}},"33":{"start":{"line":290,"column":20},"end":{"line":293,"column":21}},"34":{"start":{"line":291,"column":24},"end":{"line":291,"column":111}},"35":{"start":{"line":292,"column":24},"end":{"line":292,"column":44}},"36":{"start":{"line":294,"column":20},"end":{"line":294,"column":56}},"37":{"start":{"line":295,"column":20},"end":{"line":297,"column":21}},"38":{"start":{"line":296,"column":24},"end":{"line":296,"column":42}},"39":{"start":{"line":298,"column":23},"end":{"line":300,"column":17}},"40":{"start":{"line":299,"column":20},"end":{"line":299,"column":42}},"41":{"start":{"line":302,"column":12},"end":{"line":304,"column":13}},"42":{"start":{"line":303,"column":16},"end":{"line":303,"column":27}},"43":{"start":{"line":305,"column":12},"end":{"line":307,"column":13}},"44":{"start":{"line":306,"column":16},"end":{"line":306,"column":77}},"45":{"start":{"line":309,"column":12},"end":{"line":315,"column":15}},"46":{"start":{"line":310,"column":16},"end":{"line":314,"column":17}},"47":{"start":{"line":311,"column":20},"end":{"line":311,"column":35}},"48":{"start":{"line":313,"column":20},"end":{"line":313,"column":35}},"49":{"start":{"line":316,"column":12},"end":{"line":316,"column":26}},"50":{"start":{"line":326,"column":12},"end":{"line":327,"column":38}},"51":{"start":{"line":329,"column":12},"end":{"line":329,"column":38}},"52":{"start":{"line":331,"column":12},"end":{"line":336,"column":13}},"53":{"start":{"line":332,"column":16},"end":{"line":332,"column":60}},"54":{"start":{"line":333,"column":16},"end":{"line":333,"column":59}},"55":{"start":{"line":334,"column":16},"end":{"line":334,"column":41}},"56":{"start":{"line":335,"column":16},"end":{"line":335,"column":43}},"57":{"start":{"line":337,"column":12},"end":{"line":337,"column":21}},"58":{"start":{"line":348,"column":12},"end":{"line":352,"column":59}},"59":{"start":{"line":354,"column":16},"end":{"line":356,"column":17}},"60":{"start":{"line":355,"column":20},"end":{"line":355,"column":46}},"61":{"start":{"line":357,"column":16},"end":{"line":360,"column":17}},"62":{"start":{"line":358,"column":20},"end":{"line":358,"column":36}},"63":{"start":{"line":361,"column":16},"end":{"line":363,"column":17}},"64":{"start":{"line":362,"column":20},"end":{"line":362,"column":45}},"65":{"start":{"line":364,"column":16},"end":{"line":366,"column":17}},"66":{"start":{"line":365,"column":20},"end":{"line":365,"column":37}},"67":{"start":{"line":368,"column":12},"end":{"line":368,"column":23}},"68":{"start":{"line":377,"column":12},"end":{"line":377,"column":61}},"69":{"start":{"line":379,"column":12},"end":{"line":380,"column":31}},"70":{"start":{"line":381,"column":16},"end":{"line":383,"column":17}},"71":{"start":{"line":382,"column":20},"end":{"line":382,"column":34}},"72":{"start":{"line":384,"column":12},"end":{"line":384,"column":26}},"73":{"start":{"line":391,"column":12},"end":{"line":393,"column":41}},"74":{"start":{"line":395,"column":12},"end":{"line":397,"column":13}},"75":{"start":{"line":396,"column":16},"end":{"line":396,"column":61}},"76":{"start":{"line":398,"column":12},"end":{"line":400,"column":13}},"77":{"start":{"line":399,"column":16},"end":{"line":399,"column":61}},"78":{"start":{"line":402,"column":12},"end":{"line":404,"column":13}},"79":{"start":{"line":403,"column":16},"end":{"line":403,"column":45}},"80":{"start":{"line":406,"column":12},"end":{"line":406,"column":43}},"81":{"start":{"line":408,"column":12},"end":{"line":408,"column":29}},"82":{"start":{"line":415,"column":12},"end":{"line":418,"column":53}},"83":{"start":{"line":420,"column":12},"end":{"line":423,"column":13}},"84":{"start":{"line":421,"column":16},"end":{"line":421,"column":35}},"85":{"start":{"line":422,"column":16},"end":{"line":422,"column":46}},"86":{"start":{"line":425,"column":12},"end":{"line":428,"column":13}},"87":{"start":{"line":426,"column":16},"end":{"line":426,"column":35}},"88":{"start":{"line":427,"column":16},"end":{"line":427,"column":46}},"89":{"start":{"line":439,"column":12},"end":{"line":443,"column":39}},"90":{"start":{"line":444,"column":16},"end":{"line":446,"column":17}},"91":{"start":{"line":445,"column":20},"end":{"line":445,"column":77}},"92":{"start":{"line":447,"column":16},"end":{"line":449,"column":17}},"93":{"start":{"line":448,"column":20},"end":{"line":448,"column":77}},"94":{"start":{"line":450,"column":16},"end":{"line":452,"column":17}},"95":{"start":{"line":451,"column":20},"end":{"line":451,"column":97}},"96":{"start":{"line":453,"column":16},"end":{"line":455,"column":17}},"97":{"start":{"line":454,"column":20},"end":{"line":454,"column":97}},"98":{"start":{"line":457,"column":12},"end":{"line":457,"column":22}},"99":{"start":{"line":465,"column":12},"end":{"line":465,"column":39}},"100":{"start":{"line":473,"column":12},"end":{"line":473,"column":39}},"101":{"start":{"line":477,"column":4},"end":{"line":477,"column":26}},"102":{"start":{"line":478,"column":4},"end":{"line":478,"column":31}},"103":{"start":{"line":479,"column":4},"end":{"line":479,"column":31}},"104":{"start":{"line":481,"column":4},"end":{"line":558,"column":7}},"105":{"start":{"line":496,"column":12},"end":{"line":498,"column":36}},"106":{"start":{"line":499,"column":16},"end":{"line":511,"column":17}},"107":{"start":{"line":500,"column":20},"end":{"line":510,"column":21}},"108":{"start":{"line":501,"column":24},"end":{"line":501,"column":53}},"109":{"start":{"line":502,"column":24},"end":{"line":509,"column":25}},"110":{"start":{"line":503,"column":28},"end":{"line":505,"column":29}},"111":{"start":{"line":504,"column":32},"end":{"line":504,"column":67}},"112":{"start":{"line":506,"column":28},"end":{"line":508,"column":29}},"113":{"start":{"line":507,"column":32},"end":{"line":507,"column":67}},"114":{"start":{"line":512,"column":16},"end":{"line":512,"column":27}},"115":{"start":{"line":527,"column":12},"end":{"line":528,"column":34}},"116":{"start":{"line":530,"column":12},"end":{"line":532,"column":13}},"117":{"start":{"line":531,"column":16},"end":{"line":531,"column":27}},"118":{"start":{"line":533,"column":12},"end":{"line":535,"column":13}},"119":{"start":{"line":534,"column":16},"end":{"line":534,"column":32}},"120":{"start":{"line":537,"column":12},"end":{"line":555,"column":13}},"121":{"start":{"line":538,"column":16},"end":{"line":538,"column":31}},"122":{"start":{"line":539,"column":16},"end":{"line":553,"column":17}},"123":{"start":{"line":540,"column":20},"end":{"line":540,"column":43}},"124":{"start":{"line":541,"column":20},"end":{"line":541,"column":46}},"125":{"start":{"line":542,"column":20},"end":{"line":542,"column":67}},"126":{"start":{"line":543,"column":20},"end":{"line":551,"column":21}},"127":{"start":{"line":544,"column":24},"end":{"line":550,"column":25}},"128":{"start":{"line":545,"column":28},"end":{"line":549,"column":29}},"129":{"start":{"line":546,"column":32},"end":{"line":546,"column":47}},"130":{"start":{"line":548,"column":32},"end":{"line":548,"column":53}},"131":{"start":{"line":552,"column":20},"end":{"line":552,"column":31}},"132":{"start":{"line":556,"column":12},"end":{"line":556,"column":43}}},"branchMap":{"1":{"line":145,"type":"if","locations":[{"start":{"line":145,"column":16},"end":{"line":145,"column":16}},{"start":{"line":145,"column":16},"end":{"line":145,"column":16}}]},"2":{"line":288,"type":"if","locations":[{"start":{"line":288,"column":12},"end":{"line":288,"column":12}},{"start":{"line":288,"column":12},"end":{"line":288,"column":12}}]},"3":{"line":289,"type":"if","locations":[{"start":{"line":289,"column":16},"end":{"line":289,"column":16}},{"start":{"line":289,"column":16},"end":{"line":289,"column":16}}]},"4":{"line":290,"type":"if","locations":[{"start":{"line":290,"column":20},"end":{"line":290,"column":20}},{"start":{"line":290,"column":20},"end":{"line":290,"column":20}}]},"5":{"line":295,"type":"if","locations":[{"start":{"line":295,"column":20},"end":{"line":295,"column":20}},{"start":{"line":295,"column":20},"end":{"line":295,"column":20}}]},"6":{"line":298,"type":"if","locations":[{"start":{"line":298,"column":23},"end":{"line":298,"column":23}},{"start":{"line":298,"column":23},"end":{"line":298,"column":23}}]},"7":{"line":302,"type":"if","locations":[{"start":{"line":302,"column":12},"end":{"line":302,"column":12}},{"start":{"line":302,"column":12},"end":{"line":302,"column":12}}]},"8":{"line":302,"type":"binary-expr","locations":[{"start":{"line":302,"column":16},"end":{"line":302,"column":20}},{"start":{"line":302,"column":24},"end":{"line":302,"column":31}}]},"9":{"line":305,"type":"if","locations":[{"start":{"line":305,"column":12},"end":{"line":305,"column":12}},{"start":{"line":305,"column":12},"end":{"line":305,"column":12}}]},"10":{"line":310,"type":"if","locations":[{"start":{"line":310,"column":16},"end":{"line":310,"column":16}},{"start":{"line":310,"column":16},"end":{"line":310,"column":16}}]},"11":{"line":310,"type":"binary-expr","locations":[{"start":{"line":310,"column":21},"end":{"line":310,"column":32}},{"start":{"line":310,"column":38},"end":{"line":310,"column":50}}]},"12":{"line":331,"type":"if","locations":[{"start":{"line":331,"column":12},"end":{"line":331,"column":12}},{"start":{"line":331,"column":12},"end":{"line":331,"column":12}}]},"13":{"line":354,"type":"if","locations":[{"start":{"line":354,"column":16},"end":{"line":354,"column":16}},{"start":{"line":354,"column":16},"end":{"line":354,"column":16}}]},"14":{"line":357,"type":"if","locations":[{"start":{"line":357,"column":16},"end":{"line":357,"column":16}},{"start":{"line":357,"column":16},"end":{"line":357,"column":16}}]},"15":{"line":361,"type":"if","locations":[{"start":{"line":361,"column":16},"end":{"line":361,"column":16}},{"start":{"line":361,"column":16},"end":{"line":361,"column":16}}]},"16":{"line":364,"type":"if","locations":[{"start":{"line":364,"column":16},"end":{"line":364,"column":16}},{"start":{"line":364,"column":16},"end":{"line":364,"column":16}}]},"17":{"line":377,"type":"binary-expr","locations":[{"start":{"line":377,"column":17},"end":{"line":377,"column":19}},{"start":{"line":377,"column":23},"end":{"line":377,"column":60}}]},"18":{"line":381,"type":"if","locations":[{"start":{"line":381,"column":16},"end":{"line":381,"column":16}},{"start":{"line":381,"column":16},"end":{"line":381,"column":16}}]},"19":{"line":381,"type":"binary-expr","locations":[{"start":{"line":381,"column":21},"end":{"line":381,"column":37}},{"start":{"line":381,"column":43},"end":{"line":381,"column":59}}]},"20":{"line":395,"type":"if","locations":[{"start":{"line":395,"column":12},"end":{"line":395,"column":12}},{"start":{"line":395,"column":12},"end":{"line":395,"column":12}}]},"21":{"line":398,"type":"if","locations":[{"start":{"line":398,"column":12},"end":{"line":398,"column":12}},{"start":{"line":398,"column":12},"end":{"line":398,"column":12}}]},"22":{"line":402,"type":"if","locations":[{"start":{"line":402,"column":12},"end":{"line":402,"column":12}},{"start":{"line":402,"column":12},"end":{"line":402,"column":12}}]},"23":{"line":420,"type":"if","locations":[{"start":{"line":420,"column":12},"end":{"line":420,"column":12}},{"start":{"line":420,"column":12},"end":{"line":420,"column":12}}]},"24":{"line":420,"type":"binary-expr","locations":[{"start":{"line":420,"column":17},"end":{"line":420,"column":36}},{"start":{"line":420,"column":40},"end":{"line":420,"column":62}},{"start":{"line":420,"column":68},"end":{"line":420,"column":99}}]},"25":{"line":425,"type":"if","locations":[{"start":{"line":425,"column":12},"end":{"line":425,"column":12}},{"start":{"line":425,"column":12},"end":{"line":425,"column":12}}]},"26":{"line":425,"type":"binary-expr","locations":[{"start":{"line":425,"column":17},"end":{"line":425,"column":36}},{"start":{"line":425,"column":40},"end":{"line":425,"column":62}},{"start":{"line":425,"column":68},"end":{"line":425,"column":99}}]},"27":{"line":444,"type":"if","locations":[{"start":{"line":444,"column":16},"end":{"line":444,"column":16}},{"start":{"line":444,"column":16},"end":{"line":444,"column":16}}]},"28":{"line":444,"type":"binary-expr","locations":[{"start":{"line":444,"column":20},"end":{"line":444,"column":22}},{"start":{"line":444,"column":26},"end":{"line":444,"column":49}}]},"29":{"line":447,"type":"if","locations":[{"start":{"line":447,"column":16},"end":{"line":447,"column":16}},{"start":{"line":447,"column":16},"end":{"line":447,"column":16}}]},"30":{"line":447,"type":"binary-expr","locations":[{"start":{"line":447,"column":20},"end":{"line":447,"column":22}},{"start":{"line":447,"column":26},"end":{"line":447,"column":49}}]},"31":{"line":450,"type":"if","locations":[{"start":{"line":450,"column":16},"end":{"line":450,"column":16}},{"start":{"line":450,"column":16},"end":{"line":450,"column":16}}]},"32":{"line":453,"type":"if","locations":[{"start":{"line":453,"column":16},"end":{"line":453,"column":16}},{"start":{"line":453,"column":16},"end":{"line":453,"column":16}}]},"33":{"line":499,"type":"if","locations":[{"start":{"line":499,"column":16},"end":{"line":499,"column":16}},{"start":{"line":499,"column":16},"end":{"line":499,"column":16}}]},"34":{"line":499,"type":"binary-expr","locations":[{"start":{"line":499,"column":21},"end":{"line":499,"column":30}},{"start":{"line":499,"column":36},"end":{"line":499,"column":45}}]},"35":{"line":500,"type":"if","locations":[{"start":{"line":500,"column":20},"end":{"line":500,"column":20}},{"start":{"line":500,"column":20},"end":{"line":500,"column":20}}]},"36":{"line":500,"type":"binary-expr","locations":[{"start":{"line":500,"column":25},"end":{"line":500,"column":34}},{"start":{"line":500,"column":40},"end":{"line":500,"column":49}}]},"37":{"line":502,"type":"if","locations":[{"start":{"line":502,"column":24},"end":{"line":502,"column":24}},{"start":{"line":502,"column":24},"end":{"line":502,"column":24}}]},"38":{"line":502,"type":"binary-expr","locations":[{"start":{"line":502,"column":28},"end":{"line":502,"column":32}},{"start":{"line":502,"column":36},"end":{"line":502,"column":40}}]},"39":{"line":503,"type":"if","locations":[{"start":{"line":503,"column":28},"end":{"line":503,"column":28}},{"start":{"line":503,"column":28},"end":{"line":503,"column":28}}]},"40":{"line":506,"type":"if","locations":[{"start":{"line":506,"column":28},"end":{"line":506,"column":28}},{"start":{"line":506,"column":28},"end":{"line":506,"column":28}}]},"41":{"line":530,"type":"if","locations":[{"start":{"line":530,"column":12},"end":{"line":530,"column":12}},{"start":{"line":530,"column":12},"end":{"line":530,"column":12}}]},"42":{"line":530,"type":"binary-expr","locations":[{"start":{"line":530,"column":16},"end":{"line":530,"column":22}},{"start":{"line":530,"column":27},"end":{"line":530,"column":45}}]},"43":{"line":533,"type":"if","locations":[{"start":{"line":533,"column":12},"end":{"line":533,"column":12}},{"start":{"line":533,"column":12},"end":{"line":533,"column":12}}]},"44":{"line":539,"type":"if","locations":[{"start":{"line":539,"column":16},"end":{"line":539,"column":16}},{"start":{"line":539,"column":16},"end":{"line":539,"column":16}}]},"45":{"line":539,"type":"binary-expr","locations":[{"start":{"line":539,"column":20},"end":{"line":539,"column":31}},{"start":{"line":539,"column":35},"end":{"line":539,"column":53}}]},"46":{"line":542,"type":"cond-expr","locations":[{"start":{"line":542,"column":44},"end":{"line":542,"column":52}},{"start":{"line":542,"column":55},"end":{"line":542,"column":66}}]},"47":{"line":543,"type":"if","locations":[{"start":{"line":543,"column":20},"end":{"line":543,"column":20}},{"start":{"line":543,"column":20},"end":{"line":543,"column":20}}]},"48":{"line":543,"type":"binary-expr","locations":[{"start":{"line":543,"column":24},"end":{"line":543,"column":28}},{"start":{"line":543,"column":32},"end":{"line":543,"column":36}}]},"49":{"line":544,"type":"if","locations":[{"start":{"line":544,"column":24},"end":{"line":544,"column":24}},{"start":{"line":544,"column":24},"end":{"line":544,"column":24}}]},"50":{"line":545,"type":"if","locations":[{"start":{"line":545,"column":28},"end":{"line":545,"column":28}},{"start":{"line":545,"column":28},"end":{"line":545,"column":28}}]}},"code":["(function () { YUI.add('dd-constrain', function (Y, NAME) {","",""," /**"," * The Drag & Drop Utility allows you to create a draggable interface efficiently,"," * buffering you from browser-level abnormalities and enabling you to focus on the interesting"," * logic surrounding your particular implementation. This component enables you to create a"," * variety of standard draggable objects with just a few lines of code and then,"," * using its extensive API, add your own specific implementation logic."," * @module dd"," * @main dd"," * @submodule dd-constrain"," */"," /**"," * Plugin for the dd-drag module to add the constraining methods to it."," * It supports constraining to a node or viewport. It supports tick based moves and XY axis constraints."," * @class DDConstrained"," * @extends Base"," * @constructor"," * @namespace Plugin"," */",""," var DRAG_NODE = 'dragNode',"," OFFSET_HEIGHT = 'offsetHeight',"," OFFSET_WIDTH = 'offsetWidth',"," HOST = 'host',"," TICK_X_ARRAY = 'tickXArray',"," TICK_Y_ARRAY = 'tickYArray',"," DDM = Y.DD.DDM,"," TOP = 'top',"," RIGHT = 'right',"," BOTTOM = 'bottom',"," LEFT = 'left',"," VIEW = 'view',"," proto = null,",""," /**"," * Fires when this node is aligned with the tickX value."," * @event drag:tickAlignX"," * @param {EventFacade} event An Event Facade object"," * @type {CustomEvent}"," */"," EV_TICK_ALIGN_X = 'drag:tickAlignX',",""," /**"," * Fires when this node is aligned with the tickY value."," * @event drag:tickAlignY"," * @param {EventFacade} event An Event Facade object"," * @type {CustomEvent}"," */"," EV_TICK_ALIGN_Y = 'drag:tickAlignY',",""," C = function() {"," this._lazyAddAttrs = false;"," C.superclass.constructor.apply(this, arguments);"," };",""," C.NAME = 'ddConstrained';"," /**"," * The Constrained instance will be placed on the Drag instance under the con namespace."," * @property NS"," * @default con"," * @readonly"," * @protected"," * @static"," * @type {String}"," */"," C.NS = 'con';",""," C.ATTRS = {"," host: {"," },"," /**"," * Stick the drag movement to the X-Axis. Default: false"," * @attribute stickX"," * @type Boolean"," */"," stickX: {"," value: false"," },"," /**"," * Stick the drag movement to the Y-Axis"," * @type Boolean"," * @attribute stickY"," */"," stickY: {"," value: false"," },"," /**"," * The X tick offset the drag node should snap to on each drag move. False for no ticks. Default: false"," * @type Number/false"," * @attribute tickX"," */"," tickX: {"," value: false"," },"," /**"," * The Y tick offset the drag node should snap to on each drag move. False for no ticks. Default: false"," * @type Number/false"," * @attribute tickY"," */"," tickY: {"," value: false"," },"," /**"," * An array of page coordinates to use as X ticks for drag movement."," * @type Array"," * @attribute tickXArray"," */"," tickXArray: {"," value: false"," },"," /**"," * An array of page coordinates to use as Y ticks for drag movement."," * @type Array"," * @attribute tickYArray"," */"," tickYArray: {"," value: false"," },"," /**"," * CSS style string for the gutter of a region (supports negative values): '5 0'"," * (sets top and bottom to 5px, left and right to 0px), '1 2 3 4' (top 1px, right 2px, bottom 3px, left 4px)"," * @attribute gutter"," * @type String"," */"," gutter: {"," value: '0',"," setter: function(gutter) {"," return Y.DD.DDM.cssSizestoObject(gutter);"," }"," },"," /**"," * Will attempt to constrain the drag node to the boundaries. Arguments:
"," * 'view': Contrain to Viewport
"," * '#selector_string': Constrain to this node
"," * '{Region Object}': An Object Literal containing a valid region (top, right, bottom, left) of page positions"," * @attribute constrain"," * @type {String/Object/Node}"," */"," constrain: {"," value: VIEW,"," setter: function(con) {"," var node = Y.one(con);"," if (node) {"," con = node;"," }"," return con;"," }"," },"," /**"," * An Object Literal containing a valid region (top, right, bottom, left) of page positions to constrain the drag node to."," * @deprecated"," * @attribute constrain2region"," * @type Object"," */"," constrain2region: {"," setter: function(r) {"," return this.set('constrain', r);"," }"," },"," /**"," * Will attempt to constrain the drag node to the boundaries of this node."," * @deprecated"," * @attribute constrain2node"," * @type Object"," */"," constrain2node: {"," setter: function(n) {"," return this.set('constrain', Y.one(n));"," }"," },"," /**"," * Will attempt to constrain the drag node to the boundaries of the viewport region."," * @deprecated"," * @attribute constrain2view"," * @type Object"," */"," constrain2view: {"," setter: function() {"," return this.set('constrain', VIEW);"," }"," },"," /**"," * Should the region be cached for performace. Default: true"," * @attribute cacheRegion"," * @type Boolean"," */"," cacheRegion: {"," value: true"," }"," };",""," proto = {"," _lastTickXFired: null,"," _lastTickYFired: null,",""," initializer: function() {"," this._createEvents();",""," this._eventHandles = ["," this.get(HOST).on('drag:end', Y.bind(this._handleEnd, this)),"," this.get(HOST).on('drag:start', Y.bind(this._handleStart, this)),"," this.get(HOST).after('drag:align', Y.bind(this.align, this)),"," this.get(HOST).after('drag:drag', Y.bind(this.drag, this))"," ];"," },"," destructor: function() {"," Y.Array.each("," this._eventHandles,"," function(handle) {"," handle.detach();"," }"," );",""," this._eventHandles.length = 0;"," },"," /**"," * This method creates all the events for this Event Target and publishes them so we get Event Bubbling."," * @private"," * @method _createEvents"," */"," _createEvents: function() {"," var ev = ["," EV_TICK_ALIGN_X,"," EV_TICK_ALIGN_Y"," ];",""," Y.Array.each(ev, function(v) {"," this.publish(v, {"," type: v,"," emitFacade: true,"," bubbles: true,"," queuable: false,"," prefix: 'drag'"," });"," }, this);"," },"," /**"," * Fires on drag:end"," * @private"," * @method _handleEnd"," */"," _handleEnd: function() {"," this._lastTickYFired = null;"," this._lastTickXFired = null;"," },"," /**"," * Fires on drag:start and clears the _regionCache"," * @private"," * @method _handleStart"," */"," _handleStart: function() {"," this.resetCache();"," },"," /**"," * Store a cache of the region that we are constraining to"," * @private"," * @property _regionCache"," * @type Object"," */"," _regionCache: null,"," /**"," * Get's the region and caches it, called from window.resize and when the cache is null"," * @private"," * @method _cacheRegion"," */"," _cacheRegion: function() {"," this._regionCache = this.get('constrain').get('region');"," },"," /**"," * Reset the internal region cache."," * @method resetCache"," */"," resetCache: function() {"," this._regionCache = null;"," },"," /**"," * Standardizes the 'constraint' attribute"," * @private"," * @method _getConstraint"," */"," _getConstraint: function() {"," var con = this.get('constrain'),"," g = this.get('gutter'),"," region;",""," if (con) {"," if (con instanceof Y.Node) {"," if (!this._regionCache) {"," this._eventHandles.push(Y.on('resize', Y.bind(this._cacheRegion, this), Y.config.win));"," this._cacheRegion();"," }"," region = Y.clone(this._regionCache);"," if (!this.get('cacheRegion')) {"," this.resetCache();"," }"," } else if (Y.Lang.isObject(con)) {"," region = Y.clone(con);"," }"," }"," if (!con || !region) {"," con = VIEW;"," }"," if (con === VIEW) {"," region = this.get(HOST).get(DRAG_NODE).get('viewportRegion');"," }",""," Y.Object.each(g, function(i, n) {"," if ((n === RIGHT) || (n === BOTTOM)) {"," region[n] -= i;"," } else {"," region[n] += i;"," }"," });"," return region;"," },",""," /**"," * Get the active region: viewport, node, custom region"," * @method getRegion"," * @param {Boolean} inc Include the node's height and width"," * @return {Object} The active region."," */"," getRegion: function(inc) {"," var r = {}, oh = null, ow = null,"," host = this.get(HOST);",""," r = this._getConstraint();",""," if (inc) {"," oh = host.get(DRAG_NODE).get(OFFSET_HEIGHT);"," ow = host.get(DRAG_NODE).get(OFFSET_WIDTH);"," r[RIGHT] = r[RIGHT] - ow;"," r[BOTTOM] = r[BOTTOM] - oh;"," }"," return r;"," },"," /**"," * Check if xy is inside a given region, if not change to it be inside."," * @private"," * @method _checkRegion"," * @param {Array} _xy The XY to check if it's in the current region, if it isn't"," * inside the region, it will reset the xy array to be inside the region."," * @return {Array} The new XY that is inside the region"," */"," _checkRegion: function(_xy) {"," var oxy = _xy,"," r = this.getRegion(),"," host = this.get(HOST),"," oh = host.get(DRAG_NODE).get(OFFSET_HEIGHT),"," ow = host.get(DRAG_NODE).get(OFFSET_WIDTH);",""," if (oxy[1] > (r[BOTTOM] - oh)) {"," _xy[1] = (r[BOTTOM] - oh);"," }"," if (r[TOP] > oxy[1]) {"," _xy[1] = r[TOP];",""," }"," if (oxy[0] > (r[RIGHT] - ow)) {"," _xy[0] = (r[RIGHT] - ow);"," }"," if (r[LEFT] > oxy[0]) {"," _xy[0] = r[LEFT];"," }",""," return _xy;"," },"," /**"," * Checks if the XY passed or the dragNode is inside the active region."," * @method inRegion"," * @param {Array} xy Optional XY to check, if not supplied this.get('dragNode').getXY() is used."," * @return {Boolean} True if the XY is inside the region, false otherwise."," */"," inRegion: function(xy) {"," xy = xy || this.get(HOST).get(DRAG_NODE).getXY();",""," var _xy = this._checkRegion([xy[0], xy[1]]),"," inside = false;"," if ((xy[0] === _xy[0]) && (xy[1] === _xy[1])) {"," inside = true;"," }"," return inside;"," },"," /**"," * Modifies the Drag.actXY method from the after drag:align event. This is where the constraining happens."," * @method align"," */"," align: function() {"," var host = this.get(HOST),"," _xy = [host.actXY[0], host.actXY[1]],"," r = this.getRegion(true);",""," if (this.get('stickX')) {"," _xy[1] = (host.startXY[1] - host.deltaXY[1]);"," }"," if (this.get('stickY')) {"," _xy[0] = (host.startXY[0] - host.deltaXY[0]);"," }",""," if (r) {"," _xy = this._checkRegion(_xy);"," }",""," _xy = this._checkTicks(_xy, r);",""," host.actXY = _xy;"," },"," /**"," * Fires after drag:drag. Handle the tickX and tickX align events."," * @method drag"," */"," drag: function() {"," var host = this.get(HOST),"," xt = this.get('tickX'),"," yt = this.get('tickY'),"," _xy = [host.actXY[0], host.actXY[1]];",""," if ((Y.Lang.isNumber(xt) || this.get(TICK_X_ARRAY)) && (this._lastTickXFired !== _xy[0])) {"," this._tickAlignX();"," this._lastTickXFired = _xy[0];"," }",""," if ((Y.Lang.isNumber(yt) || this.get(TICK_Y_ARRAY)) && (this._lastTickYFired !== _xy[1])) {"," this._tickAlignY();"," this._lastTickYFired = _xy[1];"," }"," },"," /**"," * This method delegates the proper helper method for tick calculations"," * @private"," * @method _checkTicks"," * @param {Array} xy The XY coords for the Drag"," * @param {Object} r The optional region that we are bound to."," * @return {Array} The calced XY coords"," */"," _checkTicks: function(xy, r) {"," var host = this.get(HOST),"," lx = (host.startXY[0] - host.deltaXY[0]),"," ly = (host.startXY[1] - host.deltaXY[1]),"," xt = this.get('tickX'),"," yt = this.get('tickY');"," if (xt && !this.get(TICK_X_ARRAY)) {"," xy[0] = DDM._calcTicks(xy[0], lx, xt, r[LEFT], r[RIGHT]);"," }"," if (yt && !this.get(TICK_Y_ARRAY)) {"," xy[1] = DDM._calcTicks(xy[1], ly, yt, r[TOP], r[BOTTOM]);"," }"," if (this.get(TICK_X_ARRAY)) {"," xy[0] = DDM._calcTickArray(xy[0], this.get(TICK_X_ARRAY), r[LEFT], r[RIGHT]);"," }"," if (this.get(TICK_Y_ARRAY)) {"," xy[1] = DDM._calcTickArray(xy[1], this.get(TICK_Y_ARRAY), r[TOP], r[BOTTOM]);"," }",""," return xy;"," },"," /**"," * Fires when the actXY[0] reach a new value respecting the tickX gap."," * @private"," * @method _tickAlignX"," */"," _tickAlignX: function() {"," this.fire(EV_TICK_ALIGN_X);"," },"," /**"," * Fires when the actXY[1] reach a new value respecting the tickY gap."," * @private"," * @method _tickAlignY"," */"," _tickAlignY: function() {"," this.fire(EV_TICK_ALIGN_Y);"," }"," };",""," Y.namespace('Plugin');"," Y.extend(C, Y.Base, proto);"," Y.Plugin.DDConstrained = C;",""," Y.mix(DDM, {"," /**"," * Helper method to calculate the tick offsets for a given position"," * @for DDM"," * @namespace DD"," * @private"," * @method _calcTicks"," * @param {Number} pos The current X or Y position"," * @param {Number} start The start X or Y position"," * @param {Number} tick The X or Y tick increment"," * @param {Number} off1 The min offset that we can't pass (region)"," * @param {Number} off2 The max offset that we can't pass (region)"," * @return {Number} The new position based on the tick calculation"," */"," _calcTicks: function(pos, start, tick, off1, off2) {"," var ix = ((pos - start) / tick),"," min = Math.floor(ix),"," max = Math.ceil(ix);"," if ((min !== 0) || (max !== 0)) {"," if ((ix >= min) && (ix <= max)) {"," pos = (start + (tick * min));"," if (off1 && off2) {"," if (pos < off1) {"," pos = (start + (tick * (min + 1)));"," }"," if (pos > off2) {"," pos = (start + (tick * (min - 1)));"," }"," }"," }"," }"," return pos;"," },"," /**"," * This method is used with the tickXArray and tickYArray config options"," * @for DDM"," * @namespace DD"," * @private"," * @method _calcTickArray"," * @param {Number} pos The current X or Y position"," * @param {Number} ticks The array containing our custom tick positions."," * @param {Number} off1 The min offset that we can't pass (region)"," * @param {Number} off2 The max offset that we can't pass (region)"," * @return The tick position"," */"," _calcTickArray: function(pos, ticks, off1, off2) {"," var i = 0, len = ticks.length, next = 0,"," diff1, diff2, ret;",""," if (!ticks || (ticks.length === 0)) {"," return pos;"," }"," if (ticks[0] >= pos) {"," return ticks[0];"," }",""," for (i = 0; i < len; i++) {"," next = (i + 1);"," if (ticks[next] && ticks[next] >= pos) {"," diff1 = pos - ticks[i];"," diff2 = ticks[next] - pos;"," ret = (diff2 > diff1) ? ticks[i] : ticks[next];"," if (off1 && off2) {"," if (ret > off2) {"," if (ticks[i]) {"," ret = ticks[i];"," } else {"," ret = ticks[len - 1];"," }"," }"," }"," return ret;"," }",""," }"," return ticks[ticks.length - 1];"," }"," });","","","","}, '@VERSION@', {\"requires\": [\"dd-drag\"]});","","}());"]}; +} +var __cov_SD7iOmvFzIRxqrTPWy$aUQ = __coverage__['build/dd-constrain/dd-constrain.js']; +__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['1']++;YUI.add('dd-constrain',function(Y,NAME){__cov_SD7iOmvFzIRxqrTPWy$aUQ.f['1']++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['2']++;var DRAG_NODE='dragNode',OFFSET_HEIGHT='offsetHeight',OFFSET_WIDTH='offsetWidth',HOST='host',TICK_X_ARRAY='tickXArray',TICK_Y_ARRAY='tickYArray',DDM=Y.DD.DDM,TOP='top',RIGHT='right',BOTTOM='bottom',LEFT='left',VIEW='view',proto=null,EV_TICK_ALIGN_X='drag:tickAlignX',EV_TICK_ALIGN_Y='drag:tickAlignY',C=function(){__cov_SD7iOmvFzIRxqrTPWy$aUQ.f['2']++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['3']++;this._lazyAddAttrs=false;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['4']++;C.superclass.constructor.apply(this,arguments);};__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['5']++;C.NAME='ddConstrained';__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['6']++;C.NS='con';__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['7']++;C.ATTRS={host:{},stickX:{value:false},stickY:{value:false},tickX:{value:false},tickY:{value:false},tickXArray:{value:false},tickYArray:{value:false},gutter:{value:'0',setter:function(gutter){__cov_SD7iOmvFzIRxqrTPWy$aUQ.f['3']++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['8']++;return Y.DD.DDM.cssSizestoObject(gutter);}},constrain:{value:VIEW,setter:function(con){__cov_SD7iOmvFzIRxqrTPWy$aUQ.f['4']++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['9']++;var node=Y.one(con);__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['10']++;if(node){__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['1'][0]++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['11']++;con=node;}else{__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['1'][1]++;}__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['12']++;return con;}},constrain2region:{setter:function(r){__cov_SD7iOmvFzIRxqrTPWy$aUQ.f['5']++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['13']++;return this.set('constrain',r);}},constrain2node:{setter:function(n){__cov_SD7iOmvFzIRxqrTPWy$aUQ.f['6']++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['14']++;return this.set('constrain',Y.one(n));}},constrain2view:{setter:function(){__cov_SD7iOmvFzIRxqrTPWy$aUQ.f['7']++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['15']++;return this.set('constrain',VIEW);}},cacheRegion:{value:true}};__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['16']++;proto={_lastTickXFired:null,_lastTickYFired:null,initializer:function(){__cov_SD7iOmvFzIRxqrTPWy$aUQ.f['8']++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['17']++;this._createEvents();__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['18']++;this._eventHandles=[this.get(HOST).on('drag:end',Y.bind(this._handleEnd,this)),this.get(HOST).on('drag:start',Y.bind(this._handleStart,this)),this.get(HOST).after('drag:align',Y.bind(this.align,this)),this.get(HOST).after('drag:drag',Y.bind(this.drag,this))];},destructor:function(){__cov_SD7iOmvFzIRxqrTPWy$aUQ.f['9']++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['19']++;Y.Array.each(this._eventHandles,function(handle){__cov_SD7iOmvFzIRxqrTPWy$aUQ.f['10']++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['20']++;handle.detach();});__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['21']++;this._eventHandles.length=0;},_createEvents:function(){__cov_SD7iOmvFzIRxqrTPWy$aUQ.f['11']++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['22']++;var ev=[EV_TICK_ALIGN_X,EV_TICK_ALIGN_Y];__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['23']++;Y.Array.each(ev,function(v){__cov_SD7iOmvFzIRxqrTPWy$aUQ.f['12']++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['24']++;this.publish(v,{type:v,emitFacade:true,bubbles:true,queuable:false,prefix:'drag'});},this);},_handleEnd:function(){__cov_SD7iOmvFzIRxqrTPWy$aUQ.f['13']++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['25']++;this._lastTickYFired=null;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['26']++;this._lastTickXFired=null;},_handleStart:function(){__cov_SD7iOmvFzIRxqrTPWy$aUQ.f['14']++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['27']++;this.resetCache();},_regionCache:null,_cacheRegion:function(){__cov_SD7iOmvFzIRxqrTPWy$aUQ.f['15']++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['28']++;this._regionCache=this.get('constrain').get('region');},resetCache:function(){__cov_SD7iOmvFzIRxqrTPWy$aUQ.f['16']++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['29']++;this._regionCache=null;},_getConstraint:function(){__cov_SD7iOmvFzIRxqrTPWy$aUQ.f['17']++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['30']++;var con=this.get('constrain'),g=this.get('gutter'),region;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['31']++;if(con){__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['2'][0]++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['32']++;if(con instanceof Y.Node){__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['3'][0]++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['33']++;if(!this._regionCache){__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['4'][0]++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['34']++;this._eventHandles.push(Y.on('resize',Y.bind(this._cacheRegion,this),Y.config.win));__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['35']++;this._cacheRegion();}else{__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['4'][1]++;}__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['36']++;region=Y.clone(this._regionCache);__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['37']++;if(!this.get('cacheRegion')){__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['5'][0]++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['38']++;this.resetCache();}else{__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['5'][1]++;}}else{__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['3'][1]++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['39']++;if(Y.Lang.isObject(con)){__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['6'][0]++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['40']++;region=Y.clone(con);}else{__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['6'][1]++;}}}else{__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['2'][1]++;}__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['41']++;if((__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['8'][0]++,!con)||(__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['8'][1]++,!region)){__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['7'][0]++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['42']++;con=VIEW;}else{__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['7'][1]++;}__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['43']++;if(con===VIEW){__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['9'][0]++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['44']++;region=this.get(HOST).get(DRAG_NODE).get('viewportRegion');}else{__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['9'][1]++;}__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['45']++;Y.Object.each(g,function(i,n){__cov_SD7iOmvFzIRxqrTPWy$aUQ.f['18']++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['46']++;if((__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['11'][0]++,n===RIGHT)||(__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['11'][1]++,n===BOTTOM)){__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['10'][0]++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['47']++;region[n]-=i;}else{__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['10'][1]++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['48']++;region[n]+=i;}});__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['49']++;return region;},getRegion:function(inc){__cov_SD7iOmvFzIRxqrTPWy$aUQ.f['19']++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['50']++;var r={},oh=null,ow=null,host=this.get(HOST);__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['51']++;r=this._getConstraint();__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['52']++;if(inc){__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['12'][0]++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['53']++;oh=host.get(DRAG_NODE).get(OFFSET_HEIGHT);__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['54']++;ow=host.get(DRAG_NODE).get(OFFSET_WIDTH);__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['55']++;r[RIGHT]=r[RIGHT]-ow;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['56']++;r[BOTTOM]=r[BOTTOM]-oh;}else{__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['12'][1]++;}__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['57']++;return r;},_checkRegion:function(_xy){__cov_SD7iOmvFzIRxqrTPWy$aUQ.f['20']++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['58']++;var oxy=_xy,r=this.getRegion(),host=this.get(HOST),oh=host.get(DRAG_NODE).get(OFFSET_HEIGHT),ow=host.get(DRAG_NODE).get(OFFSET_WIDTH);__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['59']++;if(oxy[1]>r[BOTTOM]-oh){__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['13'][0]++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['60']++;_xy[1]=r[BOTTOM]-oh;}else{__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['13'][1]++;}__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['61']++;if(r[TOP]>oxy[1]){__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['14'][0]++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['62']++;_xy[1]=r[TOP];}else{__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['14'][1]++;}__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['63']++;if(oxy[0]>r[RIGHT]-ow){__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['15'][0]++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['64']++;_xy[0]=r[RIGHT]-ow;}else{__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['15'][1]++;}__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['65']++;if(r[LEFT]>oxy[0]){__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['16'][0]++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['66']++;_xy[0]=r[LEFT];}else{__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['16'][1]++;}__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['67']++;return _xy;},inRegion:function(xy){__cov_SD7iOmvFzIRxqrTPWy$aUQ.f['21']++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['68']++;xy=(__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['17'][0]++,xy)||(__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['17'][1]++,this.get(HOST).get(DRAG_NODE).getXY());__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['69']++;var _xy=this._checkRegion([xy[0],xy[1]]),inside=false;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['70']++;if((__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['19'][0]++,xy[0]===_xy[0])&&(__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['19'][1]++,xy[1]===_xy[1])){__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['18'][0]++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['71']++;inside=true;}else{__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['18'][1]++;}__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['72']++;return inside;},align:function(){__cov_SD7iOmvFzIRxqrTPWy$aUQ.f['22']++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['73']++;var host=this.get(HOST),_xy=[host.actXY[0],host.actXY[1]],r=this.getRegion(true);__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['74']++;if(this.get('stickX')){__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['20'][0]++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['75']++;_xy[1]=host.startXY[1]-host.deltaXY[1];}else{__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['20'][1]++;}__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['76']++;if(this.get('stickY')){__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['21'][0]++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['77']++;_xy[0]=host.startXY[0]-host.deltaXY[0];}else{__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['21'][1]++;}__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['78']++;if(r){__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['22'][0]++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['79']++;_xy=this._checkRegion(_xy);}else{__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['22'][1]++;}__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['80']++;_xy=this._checkTicks(_xy,r);__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['81']++;host.actXY=_xy;},drag:function(){__cov_SD7iOmvFzIRxqrTPWy$aUQ.f['23']++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['82']++;var host=this.get(HOST),xt=this.get('tickX'),yt=this.get('tickY'),_xy=[host.actXY[0],host.actXY[1]];__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['83']++;if(((__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['24'][0]++,Y.Lang.isNumber(xt))||(__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['24'][1]++,this.get(TICK_X_ARRAY)))&&(__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['24'][2]++,this._lastTickXFired!==_xy[0])){__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['23'][0]++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['84']++;this._tickAlignX();__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['85']++;this._lastTickXFired=_xy[0];}else{__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['23'][1]++;}__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['86']++;if(((__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['26'][0]++,Y.Lang.isNumber(yt))||(__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['26'][1]++,this.get(TICK_Y_ARRAY)))&&(__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['26'][2]++,this._lastTickYFired!==_xy[1])){__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['25'][0]++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['87']++;this._tickAlignY();__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['88']++;this._lastTickYFired=_xy[1];}else{__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['25'][1]++;}},_checkTicks:function(xy,r){__cov_SD7iOmvFzIRxqrTPWy$aUQ.f['24']++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['89']++;var host=this.get(HOST),lx=host.startXY[0]-host.deltaXY[0],ly=host.startXY[1]-host.deltaXY[1],xt=this.get('tickX'),yt=this.get('tickY');__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['90']++;if((__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['28'][0]++,xt)&&(__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['28'][1]++,!this.get(TICK_X_ARRAY))){__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['27'][0]++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['91']++;xy[0]=DDM._calcTicks(xy[0],lx,xt,r[LEFT],r[RIGHT]);}else{__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['27'][1]++;}__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['92']++;if((__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['30'][0]++,yt)&&(__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['30'][1]++,!this.get(TICK_Y_ARRAY))){__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['29'][0]++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['93']++;xy[1]=DDM._calcTicks(xy[1],ly,yt,r[TOP],r[BOTTOM]);}else{__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['29'][1]++;}__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['94']++;if(this.get(TICK_X_ARRAY)){__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['31'][0]++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['95']++;xy[0]=DDM._calcTickArray(xy[0],this.get(TICK_X_ARRAY),r[LEFT],r[RIGHT]);}else{__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['31'][1]++;}__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['96']++;if(this.get(TICK_Y_ARRAY)){__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['32'][0]++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['97']++;xy[1]=DDM._calcTickArray(xy[1],this.get(TICK_Y_ARRAY),r[TOP],r[BOTTOM]);}else{__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['32'][1]++;}__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['98']++;return xy;},_tickAlignX:function(){__cov_SD7iOmvFzIRxqrTPWy$aUQ.f['25']++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['99']++;this.fire(EV_TICK_ALIGN_X);},_tickAlignY:function(){__cov_SD7iOmvFzIRxqrTPWy$aUQ.f['26']++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['100']++;this.fire(EV_TICK_ALIGN_Y);}};__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['101']++;Y.namespace('Plugin');__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['102']++;Y.extend(C,Y.Base,proto);__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['103']++;Y.Plugin.DDConstrained=C;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['104']++;Y.mix(DDM,{_calcTicks:function(pos,start,tick,off1,off2){__cov_SD7iOmvFzIRxqrTPWy$aUQ.f['27']++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['105']++;var ix=(pos-start)/tick,min=Math.floor(ix),max=Math.ceil(ix);__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['106']++;if((__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['34'][0]++,min!==0)||(__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['34'][1]++,max!==0)){__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['33'][0]++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['107']++;if((__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['36'][0]++,ix>=min)&&(__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['36'][1]++,ix<=max)){__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['35'][0]++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['108']++;pos=start+tick*min;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['109']++;if((__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['38'][0]++,off1)&&(__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['38'][1]++,off2)){__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['37'][0]++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['110']++;if(posoff2){__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['40'][0]++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['113']++;pos=start+tick*(min-1);}else{__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['40'][1]++;}}else{__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['37'][1]++;}}else{__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['35'][1]++;}}else{__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['33'][1]++;}__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['114']++;return pos;},_calcTickArray:function(pos,ticks,off1,off2){__cov_SD7iOmvFzIRxqrTPWy$aUQ.f['28']++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['115']++;var i=0,len=ticks.length,next=0,diff1,diff2,ret;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['116']++;if((__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['42'][0]++,!ticks)||(__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['42'][1]++,ticks.length===0)){__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['41'][0]++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['117']++;return pos;}else{__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['41'][1]++;}__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['118']++;if(ticks[0]>=pos){__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['43'][0]++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['119']++;return ticks[0];}else{__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['43'][1]++;}__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['120']++;for(i=0;i=pos)){__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['44'][0]++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['123']++;diff1=pos-ticks[i];__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['124']++;diff2=ticks[next]-pos;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['125']++;ret=diff2>diff1?(__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['46'][0]++,ticks[i]):(__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['46'][1]++,ticks[next]);__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['126']++;if((__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['48'][0]++,off1)&&(__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['48'][1]++,off2)){__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['47'][0]++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['127']++;if(ret>off2){__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['49'][0]++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['128']++;if(ticks[i]){__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['50'][0]++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['129']++;ret=ticks[i];}else{__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['50'][1]++;__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['130']++;ret=ticks[len-1];}}else{__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['49'][1]++;}}else{__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['47'][1]++;}__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['131']++;return ret;}else{__cov_SD7iOmvFzIRxqrTPWy$aUQ.b['44'][1]++;}}__cov_SD7iOmvFzIRxqrTPWy$aUQ.s['132']++;return ticks[ticks.length-1];}});},'@VERSION@',{'requires':['dd-drag']}); diff --git a/src/build/dd-constrain/dd-constrain-debug.js b/src/build/dd-constrain/dd-constrain-debug.js new file mode 100644 index 00000000000..99f29dc03c8 --- /dev/null +++ b/src/build/dd-constrain/dd-constrain-debug.js @@ -0,0 +1,562 @@ +YUI.add('dd-constrain', function (Y, NAME) { + + + /** + * The Drag & Drop Utility allows you to create a draggable interface efficiently, + * buffering you from browser-level abnormalities and enabling you to focus on the interesting + * logic surrounding your particular implementation. This component enables you to create a + * variety of standard draggable objects with just a few lines of code and then, + * using its extensive API, add your own specific implementation logic. + * @module dd + * @main dd + * @submodule dd-constrain + */ + /** + * Plugin for the dd-drag module to add the constraining methods to it. + * It supports constraining to a node or viewport. It supports tick based moves and XY axis constraints. + * @class DDConstrained + * @extends Base + * @constructor + * @namespace Plugin + */ + + var DRAG_NODE = 'dragNode', + OFFSET_HEIGHT = 'offsetHeight', + OFFSET_WIDTH = 'offsetWidth', + HOST = 'host', + TICK_X_ARRAY = 'tickXArray', + TICK_Y_ARRAY = 'tickYArray', + DDM = Y.DD.DDM, + TOP = 'top', + RIGHT = 'right', + BOTTOM = 'bottom', + LEFT = 'left', + VIEW = 'view', + proto = null, + + /** + * Fires when this node is aligned with the tickX value. + * @event drag:tickAlignX + * @param {EventFacade} event An Event Facade object + * @type {CustomEvent} + */ + EV_TICK_ALIGN_X = 'drag:tickAlignX', + + /** + * Fires when this node is aligned with the tickY value. + * @event drag:tickAlignY + * @param {EventFacade} event An Event Facade object + * @type {CustomEvent} + */ + EV_TICK_ALIGN_Y = 'drag:tickAlignY', + + C = function() { + this._lazyAddAttrs = false; + C.superclass.constructor.apply(this, arguments); + }; + + C.NAME = 'ddConstrained'; + /** + * The Constrained instance will be placed on the Drag instance under the con namespace. + * @property NS + * @default con + * @readonly + * @protected + * @static + * @type {String} + */ + C.NS = 'con'; + + C.ATTRS = { + host: { + }, + /** + * Stick the drag movement to the X-Axis. Default: false + * @attribute stickX + * @type Boolean + */ + stickX: { + value: false + }, + /** + * Stick the drag movement to the Y-Axis + * @type Boolean + * @attribute stickY + */ + stickY: { + value: false + }, + /** + * The X tick offset the drag node should snap to on each drag move. False for no ticks. Default: false + * @type Number/false + * @attribute tickX + */ + tickX: { + value: false + }, + /** + * The Y tick offset the drag node should snap to on each drag move. False for no ticks. Default: false + * @type Number/false + * @attribute tickY + */ + tickY: { + value: false + }, + /** + * An array of page coordinates to use as X ticks for drag movement. + * @type Array + * @attribute tickXArray + */ + tickXArray: { + value: false + }, + /** + * An array of page coordinates to use as Y ticks for drag movement. + * @type Array + * @attribute tickYArray + */ + tickYArray: { + value: false + }, + /** + * CSS style string for the gutter of a region (supports negative values): '5 0' + * (sets top and bottom to 5px, left and right to 0px), '1 2 3 4' (top 1px, right 2px, bottom 3px, left 4px) + * @attribute gutter + * @type String + */ + gutter: { + value: '0', + setter: function(gutter) { + return Y.DD.DDM.cssSizestoObject(gutter); + } + }, + /** + * Will attempt to constrain the drag node to the boundaries. Arguments:
+ * 'view': Contrain to Viewport
+ * '#selector_string': Constrain to this node
+ * '{Region Object}': An Object Literal containing a valid region (top, right, bottom, left) of page positions + * @attribute constrain + * @type {String/Object/Node} + */ + constrain: { + value: VIEW, + setter: function(con) { + var node = Y.one(con); + if (node) { + con = node; + } + return con; + } + }, + /** + * An Object Literal containing a valid region (top, right, bottom, left) of page positions to constrain the drag node to. + * @deprecated + * @attribute constrain2region + * @type Object + */ + constrain2region: { + setter: function(r) { + return this.set('constrain', r); + } + }, + /** + * Will attempt to constrain the drag node to the boundaries of this node. + * @deprecated + * @attribute constrain2node + * @type Object + */ + constrain2node: { + setter: function(n) { + return this.set('constrain', Y.one(n)); + } + }, + /** + * Will attempt to constrain the drag node to the boundaries of the viewport region. + * @deprecated + * @attribute constrain2view + * @type Object + */ + constrain2view: { + setter: function() { + return this.set('constrain', VIEW); + } + }, + /** + * Should the region be cached for performace. Default: true + * @attribute cacheRegion + * @type Boolean + */ + cacheRegion: { + value: true + } + }; + + proto = { + _lastTickXFired: null, + _lastTickYFired: null, + + initializer: function() { + this._createEvents(); + + this._eventHandles = [ + this.get(HOST).on('drag:end', Y.bind(this._handleEnd, this)), + this.get(HOST).on('drag:start', Y.bind(this._handleStart, this)), + this.get(HOST).after('drag:align', Y.bind(this.align, this)), + this.get(HOST).after('drag:drag', Y.bind(this.drag, this)) + ]; + }, + destructor: function() { + Y.Array.each( + this._eventHandles, + function(handle) { + handle.detach(); + } + ); + + this._eventHandles.length = 0; + }, + /** + * This method creates all the events for this Event Target and publishes them so we get Event Bubbling. + * @private + * @method _createEvents + */ + _createEvents: function() { + var ev = [ + EV_TICK_ALIGN_X, + EV_TICK_ALIGN_Y + ]; + + Y.Array.each(ev, function(v) { + this.publish(v, { + type: v, + emitFacade: true, + bubbles: true, + queuable: false, + prefix: 'drag' + }); + }, this); + }, + /** + * Fires on drag:end + * @private + * @method _handleEnd + */ + _handleEnd: function() { + this._lastTickYFired = null; + this._lastTickXFired = null; + }, + /** + * Fires on drag:start and clears the _regionCache + * @private + * @method _handleStart + */ + _handleStart: function() { + this.resetCache(); + }, + /** + * Store a cache of the region that we are constraining to + * @private + * @property _regionCache + * @type Object + */ + _regionCache: null, + /** + * Get's the region and caches it, called from window.resize and when the cache is null + * @private + * @method _cacheRegion + */ + _cacheRegion: function() { + this._regionCache = this.get('constrain').get('region'); + }, + /** + * Reset the internal region cache. + * @method resetCache + */ + resetCache: function() { + this._regionCache = null; + }, + /** + * Standardizes the 'constraint' attribute + * @private + * @method _getConstraint + */ + _getConstraint: function() { + var con = this.get('constrain'), + g = this.get('gutter'), + region; + + if (con) { + if (con instanceof Y.Node) { + if (!this._regionCache) { + this._eventHandles.push(Y.on('resize', Y.bind(this._cacheRegion, this), Y.config.win)); + this._cacheRegion(); + } + region = Y.clone(this._regionCache); + if (!this.get('cacheRegion')) { + this.resetCache(); + } + } else if (Y.Lang.isObject(con)) { + region = Y.clone(con); + } + } + if (!con || !region) { + con = VIEW; + } + if (con === VIEW) { + region = this.get(HOST).get(DRAG_NODE).get('viewportRegion'); + } + + Y.Object.each(g, function(i, n) { + if ((n === RIGHT) || (n === BOTTOM)) { + region[n] -= i; + } else { + region[n] += i; + } + }); + return region; + }, + + /** + * Get the active region: viewport, node, custom region + * @method getRegion + * @param {Boolean} inc Include the node's height and width + * @return {Object} The active region. + */ + getRegion: function(inc) { + var r = {}, oh = null, ow = null, + host = this.get(HOST); + + r = this._getConstraint(); + + if (inc) { + oh = host.get(DRAG_NODE).get(OFFSET_HEIGHT); + ow = host.get(DRAG_NODE).get(OFFSET_WIDTH); + r[RIGHT] = r[RIGHT] - ow; + r[BOTTOM] = r[BOTTOM] - oh; + } + return r; + }, + /** + * Check if xy is inside a given region, if not change to it be inside. + * @private + * @method _checkRegion + * @param {Array} _xy The XY to check if it's in the current region, if it isn't + * inside the region, it will reset the xy array to be inside the region. + * @return {Array} The new XY that is inside the region + */ + _checkRegion: function(_xy) { + var oxy = _xy, + r = this.getRegion(), + host = this.get(HOST), + oh = host.get(DRAG_NODE).get(OFFSET_HEIGHT), + ow = host.get(DRAG_NODE).get(OFFSET_WIDTH); + + if (oxy[1] > (r[BOTTOM] - oh)) { + _xy[1] = (r[BOTTOM] - oh); + } + if (r[TOP] > oxy[1]) { + _xy[1] = r[TOP]; + + } + if (oxy[0] > (r[RIGHT] - ow)) { + _xy[0] = (r[RIGHT] - ow); + } + if (r[LEFT] > oxy[0]) { + _xy[0] = r[LEFT]; + } + + return _xy; + }, + /** + * Checks if the XY passed or the dragNode is inside the active region. + * @method inRegion + * @param {Array} xy Optional XY to check, if not supplied this.get('dragNode').getXY() is used. + * @return {Boolean} True if the XY is inside the region, false otherwise. + */ + inRegion: function(xy) { + xy = xy || this.get(HOST).get(DRAG_NODE).getXY(); + + var _xy = this._checkRegion([xy[0], xy[1]]), + inside = false; + if ((xy[0] === _xy[0]) && (xy[1] === _xy[1])) { + inside = true; + } + return inside; + }, + /** + * Modifies the Drag.actXY method from the after drag:align event. This is where the constraining happens. + * @method align + */ + align: function() { + var host = this.get(HOST), + _xy = [host.actXY[0], host.actXY[1]], + r = this.getRegion(true); + + if (this.get('stickX')) { + _xy[1] = (host.startXY[1] - host.deltaXY[1]); + } + if (this.get('stickY')) { + _xy[0] = (host.startXY[0] - host.deltaXY[0]); + } + + if (r) { + _xy = this._checkRegion(_xy); + } + + _xy = this._checkTicks(_xy, r); + + host.actXY = _xy; + }, + /** + * Fires after drag:drag. Handle the tickX and tickX align events. + * @method drag + */ + drag: function() { + var host = this.get(HOST), + xt = this.get('tickX'), + yt = this.get('tickY'), + _xy = [host.actXY[0], host.actXY[1]]; + + if ((Y.Lang.isNumber(xt) || this.get(TICK_X_ARRAY)) && (this._lastTickXFired !== _xy[0])) { + this._tickAlignX(); + this._lastTickXFired = _xy[0]; + } + + if ((Y.Lang.isNumber(yt) || this.get(TICK_Y_ARRAY)) && (this._lastTickYFired !== _xy[1])) { + this._tickAlignY(); + this._lastTickYFired = _xy[1]; + } + }, + /** + * This method delegates the proper helper method for tick calculations + * @private + * @method _checkTicks + * @param {Array} xy The XY coords for the Drag + * @param {Object} r The optional region that we are bound to. + * @return {Array} The calced XY coords + */ + _checkTicks: function(xy, r) { + var host = this.get(HOST), + lx = (host.startXY[0] - host.deltaXY[0]), + ly = (host.startXY[1] - host.deltaXY[1]), + xt = this.get('tickX'), + yt = this.get('tickY'); + if (xt && !this.get(TICK_X_ARRAY)) { + xy[0] = DDM._calcTicks(xy[0], lx, xt, r[LEFT], r[RIGHT]); + } + if (yt && !this.get(TICK_Y_ARRAY)) { + xy[1] = DDM._calcTicks(xy[1], ly, yt, r[TOP], r[BOTTOM]); + } + if (this.get(TICK_X_ARRAY)) { + xy[0] = DDM._calcTickArray(xy[0], this.get(TICK_X_ARRAY), r[LEFT], r[RIGHT]); + } + if (this.get(TICK_Y_ARRAY)) { + xy[1] = DDM._calcTickArray(xy[1], this.get(TICK_Y_ARRAY), r[TOP], r[BOTTOM]); + } + + return xy; + }, + /** + * Fires when the actXY[0] reach a new value respecting the tickX gap. + * @private + * @method _tickAlignX + */ + _tickAlignX: function() { + this.fire(EV_TICK_ALIGN_X); + }, + /** + * Fires when the actXY[1] reach a new value respecting the tickY gap. + * @private + * @method _tickAlignY + */ + _tickAlignY: function() { + this.fire(EV_TICK_ALIGN_Y); + } + }; + + Y.namespace('Plugin'); + Y.extend(C, Y.Base, proto); + Y.Plugin.DDConstrained = C; + + Y.mix(DDM, { + /** + * Helper method to calculate the tick offsets for a given position + * @for DDM + * @namespace DD + * @private + * @method _calcTicks + * @param {Number} pos The current X or Y position + * @param {Number} start The start X or Y position + * @param {Number} tick The X or Y tick increment + * @param {Number} off1 The min offset that we can't pass (region) + * @param {Number} off2 The max offset that we can't pass (region) + * @return {Number} The new position based on the tick calculation + */ + _calcTicks: function(pos, start, tick, off1, off2) { + var ix = ((pos - start) / tick), + min = Math.floor(ix), + max = Math.ceil(ix); + if ((min !== 0) || (max !== 0)) { + if ((ix >= min) && (ix <= max)) { + pos = (start + (tick * min)); + if (off1 && off2) { + if (pos < off1) { + pos = (start + (tick * (min + 1))); + } + if (pos > off2) { + pos = (start + (tick * (min - 1))); + } + } + } + } + return pos; + }, + /** + * This method is used with the tickXArray and tickYArray config options + * @for DDM + * @namespace DD + * @private + * @method _calcTickArray + * @param {Number} pos The current X or Y position + * @param {Number} ticks The array containing our custom tick positions. + * @param {Number} off1 The min offset that we can't pass (region) + * @param {Number} off2 The max offset that we can't pass (region) + * @return The tick position + */ + _calcTickArray: function(pos, ticks, off1, off2) { + var i = 0, len = ticks.length, next = 0, + diff1, diff2, ret; + + if (!ticks || (ticks.length === 0)) { + return pos; + } + if (ticks[0] >= pos) { + return ticks[0]; + } + + for (i = 0; i < len; i++) { + next = (i + 1); + if (ticks[next] && ticks[next] >= pos) { + diff1 = pos - ticks[i]; + diff2 = ticks[next] - pos; + ret = (diff2 > diff1) ? ticks[i] : ticks[next]; + if (off1 && off2) { + if (ret > off2) { + if (ticks[i]) { + ret = ticks[i]; + } else { + ret = ticks[len - 1]; + } + } + } + return ret; + } + + } + return ticks[ticks.length - 1]; + } + }); + + + +}, '@VERSION@', {"requires": ["dd-drag"]}); diff --git a/src/build/dd-constrain/dd-constrain-min.js b/src/build/dd-constrain/dd-constrain-min.js new file mode 100644 index 00000000000..bcd868023bd --- /dev/null +++ b/src/build/dd-constrain/dd-constrain-min.js @@ -0,0 +1 @@ +YUI.add("dd-constrain",function(e,t){var n="dragNode",r="offsetHeight",i="offsetWidth",s="host",o="tickXArray",u="tickYArray",a=e.DD.DDM,f="top",l="right",c="bottom",h="left",p="view",d=null,v="drag:tickAlignX",m="drag:tickAlignY",g=function(){this._lazyAddAttrs=!1,g.superclass.constructor.apply(this,arguments)};g.NAME="ddConstrained",g.NS="con",g.ATTRS={host:{},stickX:{value:!1},stickY:{value:!1},tickX:{value:!1},tickY:{value:!1},tickXArray:{value:!1},tickYArray:{value:!1},gutter:{value:"0",setter:function(t){return e.DD.DDM.cssSizestoObject(t)}},constrain:{value:p,setter:function(t){var n=e.one(t);return n&&(t=n),t}},constrain2region:{setter:function(e){return this.set("constrain",e)}},constrain2node:{setter:function(t){return this.set("constrain",e.one(t))}},constrain2view:{setter:function(){return this.set("constrain",p)}},cacheRegion:{value:!0}},d={_lastTickXFired:null,_lastTickYFired:null,initializer:function(){this._createEvents(),this._eventHandles=[this.get(s).on("drag:end",e.bind(this._handleEnd,this)),this.get(s).on("drag:start",e.bind(this._handleStart,this)),this.get(s).after("drag:align",e.bind(this.align,this)),this.get(s).after("drag:drag",e.bind(this.drag,this))]},destructor:function(){e.Array.each(this._eventHandles,function(e){e.detach()}),this._eventHandles.length=0},_createEvents:function(){var t=[v,m];e.Array.each(t,function(e){this.publish(e,{type:e,emitFacade:!0,bubbles:!0,queuable:!1,prefix:"drag"})},this)},_handleEnd:function(){this._lastTickYFired=null,this._lastTickXFired=null},_handleStart:function(){this.resetCache()},_regionCache:null,_cacheRegion:function(){this._regionCache=this.get("constrain").get("region")},resetCache:function(){this._regionCache=null},_getConstraint:function(){var t=this.get("constrain"),r=this.get("gutter"),i;t&&(t instanceof e.Node?(this._regionCache||(this._eventHandles.push(e.on("resize",e.bind(this._cacheRegion,this),e.config.win)),this._cacheRegion()),i=e.clone(this._regionCache),this.get("cacheRegion")||this.resetCache()):e.Lang.isObject(t)&&(i=e.clone(t)));if(!t||!i)t=p;return t===p&&(i=this.get(s).get(n).get("viewportRegion")),e.Object.each(r,function(e,t){t===l||t===c?i[t]-=e:i[t]+=e}),i},getRegion:function(e){var t={},o=null,u=null,a=this.get(s);return t=this._getConstraint(),e&&(o=a.get(n).get(r),u=a.get(n).get(i),t[l]=t[l]-u,t[c]=t[c]-o),t},_checkRegion:function(e){var t=e,o=this.getRegion(),u=this.get(s),a=u.get(n).get(r),p=u.get(n).get(i);return t[1]>o[c]-a&&(e[1]=o[c]-a),o[f]>t[1]&&(e[1]=o[f]),t[0]>o[l]-p&&(e[0]=o[l]-p),o[h]>t[0]&&(e[0]=o[h]),e},inRegion:function(e){e=e||this.get(s).get(n).getXY();var t=this._checkRegion([e[0],e[1]]),r=!1;return e[0]===t[0]&&e[1]===t[1]&&(r=!0),r},align:function(){var e=this.get(s),t=[e.actXY[0],e.actXY[1]],n=this.getRegion(!0);this.get("stickX")&&(t[1]=e.startXY[1]-e.deltaXY[1]),this.get("stickY")&&(t[0]=e.startXY[0]-e.deltaXY[0]),n&&(t=this._checkRegion(t)),t=this._checkTicks(t,n),e.actXY=t},drag:function(){var t=this.get(s),n=this.get("tickX"),r=this.get("tickY"),i=[t.actXY[0],t.actXY[1]];(e.Lang.isNumber(n)||this.get(o))&&this._lastTickXFired!==i[0]&&(this._tickAlignX(),this._lastTickXFired=i[0]),(e.Lang.isNumber(r)||this.get(u))&&this._lastTickYFired!==i[1]&&(this._tickAlignY(),this._lastTickYFired=i[1])},_checkTicks:function(e,t){var n=this.get(s),r=n.startXY[0]-n.deltaXY[0],i=n.startXY[1]-n.deltaXY[1],p=this.get("tickX"),d=this.get("tickY");return p&&!this.get(o)&&(e[0]=a._calcTicks(e[0],r,p,t[h],t[l])),d&&!this.get(u)&&(e[1]=a._calcTicks(e[1],i,d,t[f],t[c])),this.get(o)&&(e[0]=a._calcTickArray(e[0],this.get(o),t[h],t[l])),this.get(u)&&(e[1]=a._calcTickArray(e[1],this.get(u),t[f],t[c])),e},_tickAlignX:function(){this.fire(v)},_tickAlignY:function(){this.fire(m)}},e.namespace("Plugin"),e.extend(g,e.Base,d),e.Plugin.DDConstrained=g,e.mix(a,{_calcTicks:function(e,t,n,r,i){var s=(e-t)/n,o=Math.floor(s),u=Math.ceil(s);return(o!==0||u!==0)&&s>=o&&s<=u&&(e=t+n*o,r&&i&&(ei&&(e=t+n*(o-1)))),e},_calcTickArray:function(e,t,n,r){var i=0,s=t.length,o=0,u,a,f;if(!t||t.length===0)return e;if(t[0]>=e)return t[0];for(i=0;i=e)return u=e-t[i],a=t[o]-e,f=a>u?t[i]:t[o],n&&r&&f>r&&(t[i]?f=t[i]:f=t[s-1]),f}return t[t.length-1]}})},"@VERSION@",{requires:["dd-drag"]}); diff --git a/src/build/dd-constrain/dd-constrain.js b/src/build/dd-constrain/dd-constrain.js new file mode 100644 index 00000000000..99f29dc03c8 --- /dev/null +++ b/src/build/dd-constrain/dd-constrain.js @@ -0,0 +1,562 @@ +YUI.add('dd-constrain', function (Y, NAME) { + + + /** + * The Drag & Drop Utility allows you to create a draggable interface efficiently, + * buffering you from browser-level abnormalities and enabling you to focus on the interesting + * logic surrounding your particular implementation. This component enables you to create a + * variety of standard draggable objects with just a few lines of code and then, + * using its extensive API, add your own specific implementation logic. + * @module dd + * @main dd + * @submodule dd-constrain + */ + /** + * Plugin for the dd-drag module to add the constraining methods to it. + * It supports constraining to a node or viewport. It supports tick based moves and XY axis constraints. + * @class DDConstrained + * @extends Base + * @constructor + * @namespace Plugin + */ + + var DRAG_NODE = 'dragNode', + OFFSET_HEIGHT = 'offsetHeight', + OFFSET_WIDTH = 'offsetWidth', + HOST = 'host', + TICK_X_ARRAY = 'tickXArray', + TICK_Y_ARRAY = 'tickYArray', + DDM = Y.DD.DDM, + TOP = 'top', + RIGHT = 'right', + BOTTOM = 'bottom', + LEFT = 'left', + VIEW = 'view', + proto = null, + + /** + * Fires when this node is aligned with the tickX value. + * @event drag:tickAlignX + * @param {EventFacade} event An Event Facade object + * @type {CustomEvent} + */ + EV_TICK_ALIGN_X = 'drag:tickAlignX', + + /** + * Fires when this node is aligned with the tickY value. + * @event drag:tickAlignY + * @param {EventFacade} event An Event Facade object + * @type {CustomEvent} + */ + EV_TICK_ALIGN_Y = 'drag:tickAlignY', + + C = function() { + this._lazyAddAttrs = false; + C.superclass.constructor.apply(this, arguments); + }; + + C.NAME = 'ddConstrained'; + /** + * The Constrained instance will be placed on the Drag instance under the con namespace. + * @property NS + * @default con + * @readonly + * @protected + * @static + * @type {String} + */ + C.NS = 'con'; + + C.ATTRS = { + host: { + }, + /** + * Stick the drag movement to the X-Axis. Default: false + * @attribute stickX + * @type Boolean + */ + stickX: { + value: false + }, + /** + * Stick the drag movement to the Y-Axis + * @type Boolean + * @attribute stickY + */ + stickY: { + value: false + }, + /** + * The X tick offset the drag node should snap to on each drag move. False for no ticks. Default: false + * @type Number/false + * @attribute tickX + */ + tickX: { + value: false + }, + /** + * The Y tick offset the drag node should snap to on each drag move. False for no ticks. Default: false + * @type Number/false + * @attribute tickY + */ + tickY: { + value: false + }, + /** + * An array of page coordinates to use as X ticks for drag movement. + * @type Array + * @attribute tickXArray + */ + tickXArray: { + value: false + }, + /** + * An array of page coordinates to use as Y ticks for drag movement. + * @type Array + * @attribute tickYArray + */ + tickYArray: { + value: false + }, + /** + * CSS style string for the gutter of a region (supports negative values): '5 0' + * (sets top and bottom to 5px, left and right to 0px), '1 2 3 4' (top 1px, right 2px, bottom 3px, left 4px) + * @attribute gutter + * @type String + */ + gutter: { + value: '0', + setter: function(gutter) { + return Y.DD.DDM.cssSizestoObject(gutter); + } + }, + /** + * Will attempt to constrain the drag node to the boundaries. Arguments:
+ * 'view': Contrain to Viewport
+ * '#selector_string': Constrain to this node
+ * '{Region Object}': An Object Literal containing a valid region (top, right, bottom, left) of page positions + * @attribute constrain + * @type {String/Object/Node} + */ + constrain: { + value: VIEW, + setter: function(con) { + var node = Y.one(con); + if (node) { + con = node; + } + return con; + } + }, + /** + * An Object Literal containing a valid region (top, right, bottom, left) of page positions to constrain the drag node to. + * @deprecated + * @attribute constrain2region + * @type Object + */ + constrain2region: { + setter: function(r) { + return this.set('constrain', r); + } + }, + /** + * Will attempt to constrain the drag node to the boundaries of this node. + * @deprecated + * @attribute constrain2node + * @type Object + */ + constrain2node: { + setter: function(n) { + return this.set('constrain', Y.one(n)); + } + }, + /** + * Will attempt to constrain the drag node to the boundaries of the viewport region. + * @deprecated + * @attribute constrain2view + * @type Object + */ + constrain2view: { + setter: function() { + return this.set('constrain', VIEW); + } + }, + /** + * Should the region be cached for performace. Default: true + * @attribute cacheRegion + * @type Boolean + */ + cacheRegion: { + value: true + } + }; + + proto = { + _lastTickXFired: null, + _lastTickYFired: null, + + initializer: function() { + this._createEvents(); + + this._eventHandles = [ + this.get(HOST).on('drag:end', Y.bind(this._handleEnd, this)), + this.get(HOST).on('drag:start', Y.bind(this._handleStart, this)), + this.get(HOST).after('drag:align', Y.bind(this.align, this)), + this.get(HOST).after('drag:drag', Y.bind(this.drag, this)) + ]; + }, + destructor: function() { + Y.Array.each( + this._eventHandles, + function(handle) { + handle.detach(); + } + ); + + this._eventHandles.length = 0; + }, + /** + * This method creates all the events for this Event Target and publishes them so we get Event Bubbling. + * @private + * @method _createEvents + */ + _createEvents: function() { + var ev = [ + EV_TICK_ALIGN_X, + EV_TICK_ALIGN_Y + ]; + + Y.Array.each(ev, function(v) { + this.publish(v, { + type: v, + emitFacade: true, + bubbles: true, + queuable: false, + prefix: 'drag' + }); + }, this); + }, + /** + * Fires on drag:end + * @private + * @method _handleEnd + */ + _handleEnd: function() { + this._lastTickYFired = null; + this._lastTickXFired = null; + }, + /** + * Fires on drag:start and clears the _regionCache + * @private + * @method _handleStart + */ + _handleStart: function() { + this.resetCache(); + }, + /** + * Store a cache of the region that we are constraining to + * @private + * @property _regionCache + * @type Object + */ + _regionCache: null, + /** + * Get's the region and caches it, called from window.resize and when the cache is null + * @private + * @method _cacheRegion + */ + _cacheRegion: function() { + this._regionCache = this.get('constrain').get('region'); + }, + /** + * Reset the internal region cache. + * @method resetCache + */ + resetCache: function() { + this._regionCache = null; + }, + /** + * Standardizes the 'constraint' attribute + * @private + * @method _getConstraint + */ + _getConstraint: function() { + var con = this.get('constrain'), + g = this.get('gutter'), + region; + + if (con) { + if (con instanceof Y.Node) { + if (!this._regionCache) { + this._eventHandles.push(Y.on('resize', Y.bind(this._cacheRegion, this), Y.config.win)); + this._cacheRegion(); + } + region = Y.clone(this._regionCache); + if (!this.get('cacheRegion')) { + this.resetCache(); + } + } else if (Y.Lang.isObject(con)) { + region = Y.clone(con); + } + } + if (!con || !region) { + con = VIEW; + } + if (con === VIEW) { + region = this.get(HOST).get(DRAG_NODE).get('viewportRegion'); + } + + Y.Object.each(g, function(i, n) { + if ((n === RIGHT) || (n === BOTTOM)) { + region[n] -= i; + } else { + region[n] += i; + } + }); + return region; + }, + + /** + * Get the active region: viewport, node, custom region + * @method getRegion + * @param {Boolean} inc Include the node's height and width + * @return {Object} The active region. + */ + getRegion: function(inc) { + var r = {}, oh = null, ow = null, + host = this.get(HOST); + + r = this._getConstraint(); + + if (inc) { + oh = host.get(DRAG_NODE).get(OFFSET_HEIGHT); + ow = host.get(DRAG_NODE).get(OFFSET_WIDTH); + r[RIGHT] = r[RIGHT] - ow; + r[BOTTOM] = r[BOTTOM] - oh; + } + return r; + }, + /** + * Check if xy is inside a given region, if not change to it be inside. + * @private + * @method _checkRegion + * @param {Array} _xy The XY to check if it's in the current region, if it isn't + * inside the region, it will reset the xy array to be inside the region. + * @return {Array} The new XY that is inside the region + */ + _checkRegion: function(_xy) { + var oxy = _xy, + r = this.getRegion(), + host = this.get(HOST), + oh = host.get(DRAG_NODE).get(OFFSET_HEIGHT), + ow = host.get(DRAG_NODE).get(OFFSET_WIDTH); + + if (oxy[1] > (r[BOTTOM] - oh)) { + _xy[1] = (r[BOTTOM] - oh); + } + if (r[TOP] > oxy[1]) { + _xy[1] = r[TOP]; + + } + if (oxy[0] > (r[RIGHT] - ow)) { + _xy[0] = (r[RIGHT] - ow); + } + if (r[LEFT] > oxy[0]) { + _xy[0] = r[LEFT]; + } + + return _xy; + }, + /** + * Checks if the XY passed or the dragNode is inside the active region. + * @method inRegion + * @param {Array} xy Optional XY to check, if not supplied this.get('dragNode').getXY() is used. + * @return {Boolean} True if the XY is inside the region, false otherwise. + */ + inRegion: function(xy) { + xy = xy || this.get(HOST).get(DRAG_NODE).getXY(); + + var _xy = this._checkRegion([xy[0], xy[1]]), + inside = false; + if ((xy[0] === _xy[0]) && (xy[1] === _xy[1])) { + inside = true; + } + return inside; + }, + /** + * Modifies the Drag.actXY method from the after drag:align event. This is where the constraining happens. + * @method align + */ + align: function() { + var host = this.get(HOST), + _xy = [host.actXY[0], host.actXY[1]], + r = this.getRegion(true); + + if (this.get('stickX')) { + _xy[1] = (host.startXY[1] - host.deltaXY[1]); + } + if (this.get('stickY')) { + _xy[0] = (host.startXY[0] - host.deltaXY[0]); + } + + if (r) { + _xy = this._checkRegion(_xy); + } + + _xy = this._checkTicks(_xy, r); + + host.actXY = _xy; + }, + /** + * Fires after drag:drag. Handle the tickX and tickX align events. + * @method drag + */ + drag: function() { + var host = this.get(HOST), + xt = this.get('tickX'), + yt = this.get('tickY'), + _xy = [host.actXY[0], host.actXY[1]]; + + if ((Y.Lang.isNumber(xt) || this.get(TICK_X_ARRAY)) && (this._lastTickXFired !== _xy[0])) { + this._tickAlignX(); + this._lastTickXFired = _xy[0]; + } + + if ((Y.Lang.isNumber(yt) || this.get(TICK_Y_ARRAY)) && (this._lastTickYFired !== _xy[1])) { + this._tickAlignY(); + this._lastTickYFired = _xy[1]; + } + }, + /** + * This method delegates the proper helper method for tick calculations + * @private + * @method _checkTicks + * @param {Array} xy The XY coords for the Drag + * @param {Object} r The optional region that we are bound to. + * @return {Array} The calced XY coords + */ + _checkTicks: function(xy, r) { + var host = this.get(HOST), + lx = (host.startXY[0] - host.deltaXY[0]), + ly = (host.startXY[1] - host.deltaXY[1]), + xt = this.get('tickX'), + yt = this.get('tickY'); + if (xt && !this.get(TICK_X_ARRAY)) { + xy[0] = DDM._calcTicks(xy[0], lx, xt, r[LEFT], r[RIGHT]); + } + if (yt && !this.get(TICK_Y_ARRAY)) { + xy[1] = DDM._calcTicks(xy[1], ly, yt, r[TOP], r[BOTTOM]); + } + if (this.get(TICK_X_ARRAY)) { + xy[0] = DDM._calcTickArray(xy[0], this.get(TICK_X_ARRAY), r[LEFT], r[RIGHT]); + } + if (this.get(TICK_Y_ARRAY)) { + xy[1] = DDM._calcTickArray(xy[1], this.get(TICK_Y_ARRAY), r[TOP], r[BOTTOM]); + } + + return xy; + }, + /** + * Fires when the actXY[0] reach a new value respecting the tickX gap. + * @private + * @method _tickAlignX + */ + _tickAlignX: function() { + this.fire(EV_TICK_ALIGN_X); + }, + /** + * Fires when the actXY[1] reach a new value respecting the tickY gap. + * @private + * @method _tickAlignY + */ + _tickAlignY: function() { + this.fire(EV_TICK_ALIGN_Y); + } + }; + + Y.namespace('Plugin'); + Y.extend(C, Y.Base, proto); + Y.Plugin.DDConstrained = C; + + Y.mix(DDM, { + /** + * Helper method to calculate the tick offsets for a given position + * @for DDM + * @namespace DD + * @private + * @method _calcTicks + * @param {Number} pos The current X or Y position + * @param {Number} start The start X or Y position + * @param {Number} tick The X or Y tick increment + * @param {Number} off1 The min offset that we can't pass (region) + * @param {Number} off2 The max offset that we can't pass (region) + * @return {Number} The new position based on the tick calculation + */ + _calcTicks: function(pos, start, tick, off1, off2) { + var ix = ((pos - start) / tick), + min = Math.floor(ix), + max = Math.ceil(ix); + if ((min !== 0) || (max !== 0)) { + if ((ix >= min) && (ix <= max)) { + pos = (start + (tick * min)); + if (off1 && off2) { + if (pos < off1) { + pos = (start + (tick * (min + 1))); + } + if (pos > off2) { + pos = (start + (tick * (min - 1))); + } + } + } + } + return pos; + }, + /** + * This method is used with the tickXArray and tickYArray config options + * @for DDM + * @namespace DD + * @private + * @method _calcTickArray + * @param {Number} pos The current X or Y position + * @param {Number} ticks The array containing our custom tick positions. + * @param {Number} off1 The min offset that we can't pass (region) + * @param {Number} off2 The max offset that we can't pass (region) + * @return The tick position + */ + _calcTickArray: function(pos, ticks, off1, off2) { + var i = 0, len = ticks.length, next = 0, + diff1, diff2, ret; + + if (!ticks || (ticks.length === 0)) { + return pos; + } + if (ticks[0] >= pos) { + return ticks[0]; + } + + for (i = 0; i < len; i++) { + next = (i + 1); + if (ticks[next] && ticks[next] >= pos) { + diff1 = pos - ticks[i]; + diff2 = ticks[next] - pos; + ret = (diff2 > diff1) ? ticks[i] : ticks[next]; + if (off1 && off2) { + if (ret > off2) { + if (ticks[i]) { + ret = ticks[i]; + } else { + ret = ticks[len - 1]; + } + } + } + return ret; + } + + } + return ticks[ticks.length - 1]; + } + }); + + + +}, '@VERSION@', {"requires": ["dd-drag"]}); diff --git a/src/build/dd-ddm-base/dd-ddm-base-coverage.js b/src/build/dd-ddm-base/dd-ddm-base-coverage.js new file mode 100644 index 00000000000..bdda983a67c --- /dev/null +++ b/src/build/dd-ddm-base/dd-ddm-base-coverage.js @@ -0,0 +1,6 @@ +if (typeof __coverage__ === 'undefined') { __coverage__ = {}; } +if (!__coverage__['build/dd-ddm-base/dd-ddm-base.js']) { + __coverage__['build/dd-ddm-base/dd-ddm-base.js'] = {"path":"build/dd-ddm-base/dd-ddm-base.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0},"b":{"1":[0,0],"2":[0,0,0,0,0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0],"8":[0,0],"9":[0,0],"10":[0,0,0],"11":[0,0],"12":[0,0],"13":[0,0],"14":[0,0],"15":[0,0],"16":[0,0],"17":[0,0],"18":[0,0],"19":[0,0]},"f":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":42}}},"2":{"name":"(anonymous_2)","line":17,"loc":{"start":{"line":17,"column":18},"end":{"line":17,"column":29}}},"3":{"name":"(anonymous_3)","line":64,"loc":{"start":{"line":64,"column":20},"end":{"line":64,"column":35}}},"4":{"name":"(anonymous_4)","line":73,"loc":{"start":{"line":73,"column":19},"end":{"line":73,"column":30}}},"5":{"name":"(anonymous_5)","line":87,"loc":{"start":{"line":87,"column":22},"end":{"line":87,"column":37}}},"6":{"name":"(anonymous_6)","line":110,"loc":{"start":{"line":110,"column":26},"end":{"line":110,"column":37}}},"7":{"name":"(anonymous_7)","line":130,"loc":{"start":{"line":130,"column":18},"end":{"line":130,"column":30}}},"8":{"name":"(anonymous_8)","line":147,"loc":{"start":{"line":147,"column":20},"end":{"line":147,"column":32}}},"9":{"name":"(anonymous_9)","line":149,"loc":{"start":{"line":149,"column":38},"end":{"line":149,"column":50}}},"10":{"name":"(anonymous_10)","line":161,"loc":{"start":{"line":161,"column":25},"end":{"line":161,"column":36}}},"11":{"name":"(anonymous_11)","line":174,"loc":{"start":{"line":174,"column":16},"end":{"line":174,"column":27}}},"12":{"name":"(anonymous_12)","line":187,"loc":{"start":{"line":187,"column":20},"end":{"line":187,"column":31}}},"13":{"name":"(anonymous_13)","line":193,"loc":{"start":{"line":193,"column":18},"end":{"line":193,"column":29}}},"14":{"name":"(anonymous_14)","line":194,"loc":{"start":{"line":194,"column":19},"end":{"line":194,"column":30}}},"15":{"name":"(anonymous_15)","line":200,"loc":{"start":{"line":200,"column":14},"end":{"line":200,"column":25}}},"16":{"name":"(anonymous_16)","line":214,"loc":{"start":{"line":214,"column":18},"end":{"line":214,"column":29}}},"17":{"name":"(anonymous_17)","line":234,"loc":{"start":{"line":234,"column":18},"end":{"line":234,"column":31}}},"18":{"name":"(anonymous_18)","line":245,"loc":{"start":{"line":245,"column":15},"end":{"line":245,"column":28}}},"19":{"name":"(anonymous_19)","line":260,"loc":{"start":{"line":260,"column":26},"end":{"line":260,"column":43}}},"20":{"name":"(anonymous_20)","line":282,"loc":{"start":{"line":282,"column":17},"end":{"line":282,"column":32}}},"21":{"name":"(anonymous_21)","line":286,"loc":{"start":{"line":286,"column":42},"end":{"line":286,"column":54}}},"22":{"name":"(anonymous_22)","line":301,"loc":{"start":{"line":301,"column":22},"end":{"line":301,"column":39}}},"23":{"name":"(anonymous_23)","line":317,"loc":{"start":{"line":317,"column":17},"end":{"line":317,"column":29}}},"24":{"name":"(anonymous_24)","line":339,"loc":{"start":{"line":339,"column":18},"end":{"line":339,"column":35}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":374,"column":84}},"2":{"start":{"line":17,"column":4},"end":{"line":19,"column":6}},"3":{"start":{"line":18,"column":8},"end":{"line":18,"column":62}},"4":{"start":{"line":21,"column":4},"end":{"line":21,"column":25}},"5":{"start":{"line":23,"column":4},"end":{"line":70,"column":6}},"6":{"start":{"line":65,"column":16},"end":{"line":65,"column":40}},"7":{"start":{"line":66,"column":16},"end":{"line":66,"column":28}},"8":{"start":{"line":72,"column":4},"end":{"line":355,"column":7}},"9":{"start":{"line":88,"column":12},"end":{"line":90,"column":13}},"10":{"start":{"line":89,"column":16},"end":{"line":89,"column":48}},"11":{"start":{"line":91,"column":12},"end":{"line":101,"column":13}},"12":{"start":{"line":94,"column":20},"end":{"line":94,"column":29}},"13":{"start":{"line":97,"column":20},"end":{"line":97,"column":29}},"14":{"start":{"line":100,"column":20},"end":{"line":100,"column":29}},"15":{"start":{"line":102,"column":12},"end":{"line":102,"column":21}},"16":{"start":{"line":131,"column":12},"end":{"line":133,"column":13}},"17":{"start":{"line":132,"column":16},"end":{"line":132,"column":29}},"18":{"start":{"line":135,"column":12},"end":{"line":137,"column":13}},"19":{"start":{"line":136,"column":16},"end":{"line":136,"column":39}},"20":{"start":{"line":138,"column":12},"end":{"line":138,"column":32}},"21":{"start":{"line":139,"column":12},"end":{"line":139,"column":24}},"22":{"start":{"line":148,"column":12},"end":{"line":148,"column":25}},"23":{"start":{"line":149,"column":12},"end":{"line":153,"column":15}},"24":{"start":{"line":150,"column":16},"end":{"line":152,"column":17}},"25":{"start":{"line":151,"column":20},"end":{"line":151,"column":40}},"26":{"start":{"line":154,"column":12},"end":{"line":154,"column":30}},"27":{"start":{"line":162,"column":12},"end":{"line":162,"column":29}},"28":{"start":{"line":163,"column":12},"end":{"line":163,"column":32}},"29":{"start":{"line":165,"column":12},"end":{"line":165,"column":42}},"30":{"start":{"line":166,"column":12},"end":{"line":166,"column":99}},"31":{"start":{"line":167,"column":12},"end":{"line":167,"column":55}},"32":{"start":{"line":175,"column":12},"end":{"line":175,"column":35}},"33":{"start":{"line":176,"column":12},"end":{"line":176,"column":30}},"34":{"start":{"line":201,"column":12},"end":{"line":207,"column":13}},"35":{"start":{"line":202,"column":16},"end":{"line":202,"column":39}},"36":{"start":{"line":203,"column":16},"end":{"line":203,"column":32}},"37":{"start":{"line":204,"column":16},"end":{"line":204,"column":37}},"38":{"start":{"line":205,"column":16},"end":{"line":205,"column":58}},"39":{"start":{"line":206,"column":16},"end":{"line":206,"column":39}},"40":{"start":{"line":215,"column":12},"end":{"line":217,"column":13}},"41":{"start":{"line":216,"column":16},"end":{"line":216,"column":28}},"42":{"start":{"line":218,"column":12},"end":{"line":218,"column":24}},"43":{"start":{"line":235,"column":12},"end":{"line":237,"column":13}},"44":{"start":{"line":236,"column":16},"end":{"line":236,"column":31}},"45":{"start":{"line":246,"column":12},"end":{"line":249,"column":13}},"46":{"start":{"line":247,"column":16},"end":{"line":247,"column":64}},"47":{"start":{"line":248,"column":16},"end":{"line":248,"column":33}},"48":{"start":{"line":261,"column":12},"end":{"line":261,"column":38}},"49":{"start":{"line":263,"column":12},"end":{"line":267,"column":13}},"50":{"start":{"line":264,"column":24},"end":{"line":264,"column":50}},"51":{"start":{"line":264,"column":51},"end":{"line":264,"column":57}},"52":{"start":{"line":265,"column":24},"end":{"line":265,"column":36}},"53":{"start":{"line":265,"column":37},"end":{"line":265,"column":49}},"54":{"start":{"line":265,"column":50},"end":{"line":265,"column":56}},"55":{"start":{"line":266,"column":24},"end":{"line":266,"column":36}},"56":{"start":{"line":266,"column":37},"end":{"line":266,"column":43}},"57":{"start":{"line":269,"column":12},"end":{"line":274,"column":14}},"58":{"start":{"line":283,"column":12},"end":{"line":284,"column":32}},"59":{"start":{"line":285,"column":12},"end":{"line":291,"column":13}},"60":{"start":{"line":286,"column":16},"end":{"line":290,"column":19}},"61":{"start":{"line":287,"column":20},"end":{"line":289,"column":21}},"62":{"start":{"line":288,"column":24},"end":{"line":288,"column":33}},"63":{"start":{"line":292,"column":12},"end":{"line":292,"column":24}},"64":{"start":{"line":302,"column":12},"end":{"line":302,"column":38}},"65":{"start":{"line":303,"column":12},"end":{"line":303,"column":38}},"66":{"start":{"line":304,"column":12},"end":{"line":305,"column":33}},"67":{"start":{"line":307,"column":12},"end":{"line":307,"column":26}},"68":{"start":{"line":308,"column":12},"end":{"line":308,"column":26}},"69":{"start":{"line":309,"column":12},"end":{"line":309,"column":22}},"70":{"start":{"line":318,"column":12},"end":{"line":320,"column":13}},"71":{"start":{"line":319,"column":16},"end":{"line":319,"column":25}},"72":{"start":{"line":321,"column":12},"end":{"line":329,"column":13}},"73":{"start":{"line":322,"column":16},"end":{"line":326,"column":17}},"74":{"start":{"line":323,"column":20},"end":{"line":323,"column":45}},"75":{"start":{"line":325,"column":20},"end":{"line":325,"column":38}},"76":{"start":{"line":328,"column":16},"end":{"line":328,"column":29}},"77":{"start":{"line":330,"column":12},"end":{"line":330,"column":21}},"78":{"start":{"line":340,"column":12},"end":{"line":340,"column":38}},"79":{"start":{"line":341,"column":12},"end":{"line":341,"column":38}},"80":{"start":{"line":342,"column":12},"end":{"line":343,"column":42}},"81":{"start":{"line":345,"column":12},"end":{"line":352,"column":13}},"82":{"start":{"line":346,"column":16},"end":{"line":346,"column":39}},"83":{"start":{"line":347,"column":19},"end":{"line":352,"column":13}},"84":{"start":{"line":348,"column":16},"end":{"line":348,"column":39}},"85":{"start":{"line":350,"column":16},"end":{"line":350,"column":58}},"86":{"start":{"line":351,"column":16},"end":{"line":351,"column":38}},"87":{"start":{"line":353,"column":12},"end":{"line":353,"column":22}},"88":{"start":{"line":357,"column":4},"end":{"line":357,"column":22}},"89":{"start":{"line":358,"column":4},"end":{"line":358,"column":29}}},"branchMap":{"1":{"line":88,"type":"if","locations":[{"start":{"line":88,"column":12},"end":{"line":88,"column":12}},{"start":{"line":88,"column":12},"end":{"line":88,"column":12}}]},"2":{"line":91,"type":"switch","locations":[{"start":{"line":92,"column":16},"end":{"line":92,"column":23}},{"start":{"line":93,"column":16},"end":{"line":94,"column":29}},{"start":{"line":95,"column":16},"end":{"line":95,"column":23}},{"start":{"line":96,"column":16},"end":{"line":97,"column":29}},{"start":{"line":98,"column":16},"end":{"line":98,"column":23}},{"start":{"line":99,"column":16},"end":{"line":100,"column":29}}]},"3":{"line":131,"type":"if","locations":[{"start":{"line":131,"column":12},"end":{"line":131,"column":12}},{"start":{"line":131,"column":12},"end":{"line":131,"column":12}}]},"4":{"line":135,"type":"if","locations":[{"start":{"line":135,"column":12},"end":{"line":135,"column":12}},{"start":{"line":135,"column":12},"end":{"line":135,"column":12}}]},"5":{"line":150,"type":"if","locations":[{"start":{"line":150,"column":16},"end":{"line":150,"column":16}},{"start":{"line":150,"column":16},"end":{"line":150,"column":16}}]},"6":{"line":201,"type":"if","locations":[{"start":{"line":201,"column":12},"end":{"line":201,"column":12}},{"start":{"line":201,"column":12},"end":{"line":201,"column":12}}]},"7":{"line":215,"type":"if","locations":[{"start":{"line":215,"column":12},"end":{"line":215,"column":12}},{"start":{"line":215,"column":12},"end":{"line":215,"column":12}}]},"8":{"line":235,"type":"if","locations":[{"start":{"line":235,"column":12},"end":{"line":235,"column":12}},{"start":{"line":235,"column":12},"end":{"line":235,"column":12}}]},"9":{"line":246,"type":"if","locations":[{"start":{"line":246,"column":12},"end":{"line":246,"column":12}},{"start":{"line":246,"column":12},"end":{"line":246,"column":12}}]},"10":{"line":263,"type":"switch","locations":[{"start":{"line":264,"column":16},"end":{"line":264,"column":57}},{"start":{"line":265,"column":16},"end":{"line":265,"column":56}},{"start":{"line":266,"column":16},"end":{"line":266,"column":43}}]},"11":{"line":285,"type":"if","locations":[{"start":{"line":285,"column":12},"end":{"line":285,"column":12}},{"start":{"line":285,"column":12},"end":{"line":285,"column":12}}]},"12":{"line":287,"type":"if","locations":[{"start":{"line":287,"column":20},"end":{"line":287,"column":20}},{"start":{"line":287,"column":20},"end":{"line":287,"column":20}}]},"13":{"line":318,"type":"if","locations":[{"start":{"line":318,"column":12},"end":{"line":318,"column":12}},{"start":{"line":318,"column":12},"end":{"line":318,"column":12}}]},"14":{"line":321,"type":"if","locations":[{"start":{"line":321,"column":12},"end":{"line":321,"column":12}},{"start":{"line":321,"column":12},"end":{"line":321,"column":12}}]},"15":{"line":321,"type":"binary-expr","locations":[{"start":{"line":321,"column":16},"end":{"line":321,"column":17}},{"start":{"line":321,"column":21},"end":{"line":321,"column":26}}]},"16":{"line":322,"type":"if","locations":[{"start":{"line":322,"column":16},"end":{"line":322,"column":16}},{"start":{"line":322,"column":16},"end":{"line":322,"column":16}}]},"17":{"line":322,"type":"binary-expr","locations":[{"start":{"line":322,"column":20},"end":{"line":322,"column":28}},{"start":{"line":322,"column":33},"end":{"line":322,"column":54}}]},"18":{"line":345,"type":"if","locations":[{"start":{"line":345,"column":12},"end":{"line":345,"column":12}},{"start":{"line":345,"column":12},"end":{"line":345,"column":12}}]},"19":{"line":347,"type":"if","locations":[{"start":{"line":347,"column":19},"end":{"line":347,"column":19}},{"start":{"line":347,"column":19},"end":{"line":347,"column":19}}]}},"code":["(function () { YUI.add('dd-ddm-base', function (Y, NAME) {","",""," /**"," * Provides the base Drag Drop Manager required for making a Node draggable."," * @module dd"," * @submodule dd-ddm-base"," */"," /**"," * Provides the base Drag Drop Manager required for making a Node draggable."," * @class DDM"," * @extends Base"," * @constructor"," * @namespace DD"," */",""," var DDMBase = function() {"," DDMBase.superclass.constructor.apply(this, arguments);"," };",""," DDMBase.NAME = 'ddm';",""," DDMBase.ATTRS = {"," /**"," * The cursor to apply when dragging, if shimmed the shim will get the cursor."," * @attribute dragCursor"," * @type String"," */"," dragCursor: {"," value: 'move'"," },"," /**"," * The number of pixels to move to start a drag operation, default is 3."," * @attribute clickPixelThresh"," * @type Number"," */"," clickPixelThresh: {"," value: 3"," },"," /**"," * The number of milliseconds a mousedown has to pass to start a drag operation, default is 1000."," * @attribute clickTimeThresh"," * @type Number"," */"," clickTimeThresh: {"," value: 1000"," },"," /**"," * The number of milliseconds to throttle the mousemove event. Default: 150"," * @attribute throttleTime"," * @type Number"," */"," throttleTime: {"," //value: 150"," value: -1"," },"," /**"," * This attribute only works if the dd-drop module is active. It will set the dragMode (point, intersect, strict) of all future Drag instances."," * @attribute dragMode"," * @type String"," */"," dragMode: {"," value: 'point',"," setter: function(mode) {"," this._setDragMode(mode);"," return mode;"," }"," }",""," };",""," Y.extend(DDMBase, Y.Base, {"," _createPG: function() {},"," /**"," * flag set when we activate our first drag, so DDM can start listening for events."," * @property _active"," * @type {Boolean}"," */"," _active: null,"," /**"," * Handler for dragMode attribute setter."," * @private"," * @method _setDragMode"," * @param {String|Number} mode The Number value or the String for the DragMode to default all future drag instances to."," * @return Number The Mode to be set"," */"," _setDragMode: function(mode) {"," if (mode === null) {"," mode = Y.DD.DDM.get('dragMode');"," }"," switch (mode) {"," case 1:"," case 'intersect':"," return 1;"," case 2:"," case 'strict':"," return 2;"," case 0:"," case 'point':"," return 0;"," }"," return 0;"," },"," /**"," * The PREFIX to attach to all DD CSS class names"," * @property CSS_PREFIX"," * @type {String}"," */"," CSS_PREFIX: Y.ClassNameManager.getClassName('dd'),"," _activateTargets: function() {},"," /**"," * Holder for all registered drag elements."," * @private"," * @property _drags"," * @type {Array}"," */"," _drags: [],"," /**"," * A reference to the currently active draggable object."," * @property activeDrag"," * @type {Drag}"," */"," activeDrag: false,"," /**"," * Adds a reference to the drag object to the DDM._drags array, called in the constructor of Drag."," * @private"," * @method _regDrag"," * @param {Drag} d The Drag object"," */"," _regDrag: function(d) {"," if (this.getDrag(d.get('node'))) {"," return false;"," }",""," if (!this._active) {"," this._setupListeners();"," }"," this._drags.push(d);"," return true;"," },"," /**"," * Remove this drag object from the DDM._drags array."," * @private"," * @method _unregDrag"," * @param {Drag} d The drag object."," */"," _unregDrag: function(d) {"," var tmp = [];"," Y.Array.each(this._drags, function(n) {"," if (n !== d) {"," tmp[tmp.length] = n;"," }"," });"," this._drags = tmp;"," },"," /**"," * Add the document listeners."," * @private"," * @method _setupListeners"," */"," _setupListeners: function() {"," this._createPG();"," this._active = true;",""," var doc = Y.one(Y.config.doc);"," doc.on('mousemove', Y.throttle(Y.bind(this._docMove, this), this.get('throttleTime')));"," doc.on('mouseup', Y.bind(this._end, this));"," },"," /**"," * Internal method used by Drag to signal the start of a drag operation"," * @private"," * @method _start"," */"," _start: function() {"," this.fire('ddm:start');"," this._startDrag();"," },"," /**"," * Factory method to be overwritten by other DDM's"," * @private"," * @method _startDrag"," * @param {Number} x The x position of the drag element"," * @param {Number} y The y position of the drag element"," * @param {Number} w The width of the drag element"," * @param {Number} h The height of the drag element"," */"," _startDrag: function() {},"," /**"," * Factory method to be overwritten by other DDM's"," * @private"," * @method _endDrag"," */"," _endDrag: function() {},"," _dropMove: function() {},"," /**"," * Internal method used by Drag to signal the end of a drag operation"," * @private"," * @method _end"," */"," _end: function() {"," if (this.activeDrag) {"," this._shimming = false;"," this._endDrag();"," this.fire('ddm:end');"," this.activeDrag.end.call(this.activeDrag);"," this.activeDrag = null;"," }"," },"," /**"," * Method will forcefully stop a drag operation. For example calling this from inside an ESC keypress handler will stop this drag."," * @method stopDrag"," * @chainable"," */"," stopDrag: function() {"," if (this.activeDrag) {"," this._end();"," }"," return this;"," },"," /**"," * Set to true when drag starts and useShim is true. Used in pairing with _docMove"," * @private"," * @property _shimming"," * @see _docMove"," * @type {Boolean}"," */"," _shimming: false,"," /**"," * Internal listener for the mousemove on Document. Checks if the shim is in place to only call _move once per mouse move"," * @private"," * @method _docMove"," * @param {EventFacade} ev The Dom mousemove Event"," */"," _docMove: function(ev) {"," if (!this._shimming) {"," this._move(ev);"," }"," },"," /**"," * Internal listener for the mousemove DOM event to pass to the Drag's move method."," * @private"," * @method _move"," * @param {EventFacade} ev The Dom mousemove Event"," */"," _move: function(ev) {"," if (this.activeDrag) {"," this.activeDrag._move.call(this.activeDrag, ev);"," this._dropMove();"," }"," },"," /**"," * //TODO Private, rename??..."," * Helper method to use to set the gutter from the attribute setter."," * CSS style string for gutter: '5 0' (sets top and bottom to 5px, left and right to 0px), '1 2 3 4' (top 1px, right 2px, bottom 3px, left 4px)"," * @private"," * @method cssSizestoObject"," * @param {String} gutter CSS style string for gutter"," * @return {Object} The gutter Object Literal."," */"," cssSizestoObject: function(gutter) {"," var x = gutter.split(' ');",""," switch (x.length) {"," case 1: x[1] = x[2] = x[3] = x[0]; break;"," case 2: x[2] = x[0]; x[3] = x[1]; break;"," case 3: x[3] = x[1]; break;"," }",""," return {"," top : parseInt(x[0],10),"," right : parseInt(x[1],10),"," bottom: parseInt(x[2],10),"," left : parseInt(x[3],10)"," };"," },"," /**"," * Get a valid Drag instance back from a Node or a selector string, false otherwise"," * @method getDrag"," * @param {String/Object} node The Node instance or Selector string to check for a valid Drag Object"," * @return {Object}"," */"," getDrag: function(node) {"," var drag = false,"," n = Y.one(node);"," if (n instanceof Y.Node) {"," Y.Array.each(this._drags, function(v) {"," if (n.compareTo(v.get('node'))) {"," drag = v;"," }"," });"," }"," return drag;"," },"," /**"," * Swap the position of 2 nodes based on their CSS positioning."," * @method swapPosition"," * @param {Node} n1 The first node to swap"," * @param {Node} n2 The first node to swap"," * @return {Node}"," */"," swapPosition: function(n1, n2) {"," n1 = Y.DD.DDM.getNode(n1);"," n2 = Y.DD.DDM.getNode(n2);"," var xy1 = n1.getXY(),"," xy2 = n2.getXY();",""," n1.setXY(xy2);"," n2.setXY(xy1);"," return n1;"," },"," /**"," * Return a node instance from the given node, selector string or Y.Base extended object."," * @method getNode"," * @param {Node/Object/String} n The node to resolve."," * @return {Node}"," */"," getNode: function(n) {"," if (n instanceof Y.Node) {"," return n;"," }"," if (n && n.get) {"," if (Y.Widget && (n instanceof Y.Widget)) {"," n = n.get('boundingBox');"," } else {"," n = n.get('node');"," }"," } else {"," n = Y.one(n);"," }"," return n;"," },"," /**"," * Swap the position of 2 nodes based on their DOM location."," * @method swapNode"," * @param {Node} n1 The first node to swap"," * @param {Node} n2 The first node to swap"," * @return {Node}"," */"," swapNode: function(n1, n2) {"," n1 = Y.DD.DDM.getNode(n1);"," n2 = Y.DD.DDM.getNode(n2);"," var p = n2.get('parentNode'),"," s = n2.get('nextSibling');",""," if (s === n1) {"," p.insertBefore(n1, n2);"," } else if (n2 === n1.get('nextSibling')) {"," p.insertBefore(n2, n1);"," } else {"," n1.get('parentNode').replaceChild(n2, n1);"," p.insertBefore(n1, s);"," }"," return n1;"," }"," });",""," Y.namespace('DD');"," Y.DD.DDM = new DDMBase();",""," /**"," * Fires from the DDM before all drag events fire."," * @event ddm:start"," * @type {CustomEvent}"," */"," /**"," * Fires from the DDM after the DDM finishes, before the drag end events."," * @event ddm:end"," * @type {CustomEvent}"," */","","","","","}, '@VERSION@', {\"requires\": [\"node\", \"base\", \"yui-throttle\", \"classnamemanager\"]});","","}());"]}; +} +var __cov_nNXhio9FCl2e2x8wKKTbLw = __coverage__['build/dd-ddm-base/dd-ddm-base.js']; +__cov_nNXhio9FCl2e2x8wKKTbLw.s['1']++;YUI.add('dd-ddm-base',function(Y,NAME){__cov_nNXhio9FCl2e2x8wKKTbLw.f['1']++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['2']++;var DDMBase=function(){__cov_nNXhio9FCl2e2x8wKKTbLw.f['2']++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['3']++;DDMBase.superclass.constructor.apply(this,arguments);};__cov_nNXhio9FCl2e2x8wKKTbLw.s['4']++;DDMBase.NAME='ddm';__cov_nNXhio9FCl2e2x8wKKTbLw.s['5']++;DDMBase.ATTRS={dragCursor:{value:'move'},clickPixelThresh:{value:3},clickTimeThresh:{value:1000},throttleTime:{value:-1},dragMode:{value:'point',setter:function(mode){__cov_nNXhio9FCl2e2x8wKKTbLw.f['3']++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['6']++;this._setDragMode(mode);__cov_nNXhio9FCl2e2x8wKKTbLw.s['7']++;return mode;}}};__cov_nNXhio9FCl2e2x8wKKTbLw.s['8']++;Y.extend(DDMBase,Y.Base,{_createPG:function(){__cov_nNXhio9FCl2e2x8wKKTbLw.f['4']++;},_active:null,_setDragMode:function(mode){__cov_nNXhio9FCl2e2x8wKKTbLw.f['5']++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['9']++;if(mode===null){__cov_nNXhio9FCl2e2x8wKKTbLw.b['1'][0]++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['10']++;mode=Y.DD.DDM.get('dragMode');}else{__cov_nNXhio9FCl2e2x8wKKTbLw.b['1'][1]++;}__cov_nNXhio9FCl2e2x8wKKTbLw.s['11']++;switch(mode){case 1:__cov_nNXhio9FCl2e2x8wKKTbLw.b['2'][0]++;case'intersect':__cov_nNXhio9FCl2e2x8wKKTbLw.b['2'][1]++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['12']++;return 1;case 2:__cov_nNXhio9FCl2e2x8wKKTbLw.b['2'][2]++;case'strict':__cov_nNXhio9FCl2e2x8wKKTbLw.b['2'][3]++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['13']++;return 2;case 0:__cov_nNXhio9FCl2e2x8wKKTbLw.b['2'][4]++;case'point':__cov_nNXhio9FCl2e2x8wKKTbLw.b['2'][5]++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['14']++;return 0;}__cov_nNXhio9FCl2e2x8wKKTbLw.s['15']++;return 0;},CSS_PREFIX:Y.ClassNameManager.getClassName('dd'),_activateTargets:function(){__cov_nNXhio9FCl2e2x8wKKTbLw.f['6']++;},_drags:[],activeDrag:false,_regDrag:function(d){__cov_nNXhio9FCl2e2x8wKKTbLw.f['7']++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['16']++;if(this.getDrag(d.get('node'))){__cov_nNXhio9FCl2e2x8wKKTbLw.b['3'][0]++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['17']++;return false;}else{__cov_nNXhio9FCl2e2x8wKKTbLw.b['3'][1]++;}__cov_nNXhio9FCl2e2x8wKKTbLw.s['18']++;if(!this._active){__cov_nNXhio9FCl2e2x8wKKTbLw.b['4'][0]++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['19']++;this._setupListeners();}else{__cov_nNXhio9FCl2e2x8wKKTbLw.b['4'][1]++;}__cov_nNXhio9FCl2e2x8wKKTbLw.s['20']++;this._drags.push(d);__cov_nNXhio9FCl2e2x8wKKTbLw.s['21']++;return true;},_unregDrag:function(d){__cov_nNXhio9FCl2e2x8wKKTbLw.f['8']++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['22']++;var tmp=[];__cov_nNXhio9FCl2e2x8wKKTbLw.s['23']++;Y.Array.each(this._drags,function(n){__cov_nNXhio9FCl2e2x8wKKTbLw.f['9']++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['24']++;if(n!==d){__cov_nNXhio9FCl2e2x8wKKTbLw.b['5'][0]++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['25']++;tmp[tmp.length]=n;}else{__cov_nNXhio9FCl2e2x8wKKTbLw.b['5'][1]++;}});__cov_nNXhio9FCl2e2x8wKKTbLw.s['26']++;this._drags=tmp;},_setupListeners:function(){__cov_nNXhio9FCl2e2x8wKKTbLw.f['10']++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['27']++;this._createPG();__cov_nNXhio9FCl2e2x8wKKTbLw.s['28']++;this._active=true;__cov_nNXhio9FCl2e2x8wKKTbLw.s['29']++;var doc=Y.one(Y.config.doc);__cov_nNXhio9FCl2e2x8wKKTbLw.s['30']++;doc.on('mousemove',Y.throttle(Y.bind(this._docMove,this),this.get('throttleTime')));__cov_nNXhio9FCl2e2x8wKKTbLw.s['31']++;doc.on('mouseup',Y.bind(this._end,this));},_start:function(){__cov_nNXhio9FCl2e2x8wKKTbLw.f['11']++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['32']++;this.fire('ddm:start');__cov_nNXhio9FCl2e2x8wKKTbLw.s['33']++;this._startDrag();},_startDrag:function(){__cov_nNXhio9FCl2e2x8wKKTbLw.f['12']++;},_endDrag:function(){__cov_nNXhio9FCl2e2x8wKKTbLw.f['13']++;},_dropMove:function(){__cov_nNXhio9FCl2e2x8wKKTbLw.f['14']++;},_end:function(){__cov_nNXhio9FCl2e2x8wKKTbLw.f['15']++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['34']++;if(this.activeDrag){__cov_nNXhio9FCl2e2x8wKKTbLw.b['6'][0]++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['35']++;this._shimming=false;__cov_nNXhio9FCl2e2x8wKKTbLw.s['36']++;this._endDrag();__cov_nNXhio9FCl2e2x8wKKTbLw.s['37']++;this.fire('ddm:end');__cov_nNXhio9FCl2e2x8wKKTbLw.s['38']++;this.activeDrag.end.call(this.activeDrag);__cov_nNXhio9FCl2e2x8wKKTbLw.s['39']++;this.activeDrag=null;}else{__cov_nNXhio9FCl2e2x8wKKTbLw.b['6'][1]++;}},stopDrag:function(){__cov_nNXhio9FCl2e2x8wKKTbLw.f['16']++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['40']++;if(this.activeDrag){__cov_nNXhio9FCl2e2x8wKKTbLw.b['7'][0]++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['41']++;this._end();}else{__cov_nNXhio9FCl2e2x8wKKTbLw.b['7'][1]++;}__cov_nNXhio9FCl2e2x8wKKTbLw.s['42']++;return this;},_shimming:false,_docMove:function(ev){__cov_nNXhio9FCl2e2x8wKKTbLw.f['17']++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['43']++;if(!this._shimming){__cov_nNXhio9FCl2e2x8wKKTbLw.b['8'][0]++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['44']++;this._move(ev);}else{__cov_nNXhio9FCl2e2x8wKKTbLw.b['8'][1]++;}},_move:function(ev){__cov_nNXhio9FCl2e2x8wKKTbLw.f['18']++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['45']++;if(this.activeDrag){__cov_nNXhio9FCl2e2x8wKKTbLw.b['9'][0]++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['46']++;this.activeDrag._move.call(this.activeDrag,ev);__cov_nNXhio9FCl2e2x8wKKTbLw.s['47']++;this._dropMove();}else{__cov_nNXhio9FCl2e2x8wKKTbLw.b['9'][1]++;}},cssSizestoObject:function(gutter){__cov_nNXhio9FCl2e2x8wKKTbLw.f['19']++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['48']++;var x=gutter.split(' ');__cov_nNXhio9FCl2e2x8wKKTbLw.s['49']++;switch(x.length){case 1:__cov_nNXhio9FCl2e2x8wKKTbLw.b['10'][0]++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['50']++;x[1]=x[2]=x[3]=x[0];__cov_nNXhio9FCl2e2x8wKKTbLw.s['51']++;break;case 2:__cov_nNXhio9FCl2e2x8wKKTbLw.b['10'][1]++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['52']++;x[2]=x[0];__cov_nNXhio9FCl2e2x8wKKTbLw.s['53']++;x[3]=x[1];__cov_nNXhio9FCl2e2x8wKKTbLw.s['54']++;break;case 3:__cov_nNXhio9FCl2e2x8wKKTbLw.b['10'][2]++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['55']++;x[3]=x[1];__cov_nNXhio9FCl2e2x8wKKTbLw.s['56']++;break;}__cov_nNXhio9FCl2e2x8wKKTbLw.s['57']++;return{top:parseInt(x[0],10),right:parseInt(x[1],10),bottom:parseInt(x[2],10),left:parseInt(x[3],10)};},getDrag:function(node){__cov_nNXhio9FCl2e2x8wKKTbLw.f['20']++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['58']++;var drag=false,n=Y.one(node);__cov_nNXhio9FCl2e2x8wKKTbLw.s['59']++;if(n instanceof Y.Node){__cov_nNXhio9FCl2e2x8wKKTbLw.b['11'][0]++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['60']++;Y.Array.each(this._drags,function(v){__cov_nNXhio9FCl2e2x8wKKTbLw.f['21']++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['61']++;if(n.compareTo(v.get('node'))){__cov_nNXhio9FCl2e2x8wKKTbLw.b['12'][0]++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['62']++;drag=v;}else{__cov_nNXhio9FCl2e2x8wKKTbLw.b['12'][1]++;}});}else{__cov_nNXhio9FCl2e2x8wKKTbLw.b['11'][1]++;}__cov_nNXhio9FCl2e2x8wKKTbLw.s['63']++;return drag;},swapPosition:function(n1,n2){__cov_nNXhio9FCl2e2x8wKKTbLw.f['22']++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['64']++;n1=Y.DD.DDM.getNode(n1);__cov_nNXhio9FCl2e2x8wKKTbLw.s['65']++;n2=Y.DD.DDM.getNode(n2);__cov_nNXhio9FCl2e2x8wKKTbLw.s['66']++;var xy1=n1.getXY(),xy2=n2.getXY();__cov_nNXhio9FCl2e2x8wKKTbLw.s['67']++;n1.setXY(xy2);__cov_nNXhio9FCl2e2x8wKKTbLw.s['68']++;n2.setXY(xy1);__cov_nNXhio9FCl2e2x8wKKTbLw.s['69']++;return n1;},getNode:function(n){__cov_nNXhio9FCl2e2x8wKKTbLw.f['23']++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['70']++;if(n instanceof Y.Node){__cov_nNXhio9FCl2e2x8wKKTbLw.b['13'][0]++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['71']++;return n;}else{__cov_nNXhio9FCl2e2x8wKKTbLw.b['13'][1]++;}__cov_nNXhio9FCl2e2x8wKKTbLw.s['72']++;if((__cov_nNXhio9FCl2e2x8wKKTbLw.b['15'][0]++,n)&&(__cov_nNXhio9FCl2e2x8wKKTbLw.b['15'][1]++,n.get)){__cov_nNXhio9FCl2e2x8wKKTbLw.b['14'][0]++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['73']++;if((__cov_nNXhio9FCl2e2x8wKKTbLw.b['17'][0]++,Y.Widget)&&(__cov_nNXhio9FCl2e2x8wKKTbLw.b['17'][1]++,n instanceof Y.Widget)){__cov_nNXhio9FCl2e2x8wKKTbLw.b['16'][0]++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['74']++;n=n.get('boundingBox');}else{__cov_nNXhio9FCl2e2x8wKKTbLw.b['16'][1]++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['75']++;n=n.get('node');}}else{__cov_nNXhio9FCl2e2x8wKKTbLw.b['14'][1]++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['76']++;n=Y.one(n);}__cov_nNXhio9FCl2e2x8wKKTbLw.s['77']++;return n;},swapNode:function(n1,n2){__cov_nNXhio9FCl2e2x8wKKTbLw.f['24']++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['78']++;n1=Y.DD.DDM.getNode(n1);__cov_nNXhio9FCl2e2x8wKKTbLw.s['79']++;n2=Y.DD.DDM.getNode(n2);__cov_nNXhio9FCl2e2x8wKKTbLw.s['80']++;var p=n2.get('parentNode'),s=n2.get('nextSibling');__cov_nNXhio9FCl2e2x8wKKTbLw.s['81']++;if(s===n1){__cov_nNXhio9FCl2e2x8wKKTbLw.b['18'][0]++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['82']++;p.insertBefore(n1,n2);}else{__cov_nNXhio9FCl2e2x8wKKTbLw.b['18'][1]++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['83']++;if(n2===n1.get('nextSibling')){__cov_nNXhio9FCl2e2x8wKKTbLw.b['19'][0]++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['84']++;p.insertBefore(n2,n1);}else{__cov_nNXhio9FCl2e2x8wKKTbLw.b['19'][1]++;__cov_nNXhio9FCl2e2x8wKKTbLw.s['85']++;n1.get('parentNode').replaceChild(n2,n1);__cov_nNXhio9FCl2e2x8wKKTbLw.s['86']++;p.insertBefore(n1,s);}}__cov_nNXhio9FCl2e2x8wKKTbLw.s['87']++;return n1;}});__cov_nNXhio9FCl2e2x8wKKTbLw.s['88']++;Y.namespace('DD');__cov_nNXhio9FCl2e2x8wKKTbLw.s['89']++;Y.DD.DDM=new DDMBase();},'@VERSION@',{'requires':['node','base','yui-throttle','classnamemanager']}); diff --git a/src/build/dd-ddm-base/dd-ddm-base-debug.js b/src/build/dd-ddm-base/dd-ddm-base-debug.js new file mode 100644 index 00000000000..d1fbb589183 --- /dev/null +++ b/src/build/dd-ddm-base/dd-ddm-base-debug.js @@ -0,0 +1,374 @@ +YUI.add('dd-ddm-base', function (Y, NAME) { + + + /** + * Provides the base Drag Drop Manager required for making a Node draggable. + * @module dd + * @submodule dd-ddm-base + */ + /** + * Provides the base Drag Drop Manager required for making a Node draggable. + * @class DDM + * @extends Base + * @constructor + * @namespace DD + */ + + var DDMBase = function() { + DDMBase.superclass.constructor.apply(this, arguments); + }; + + DDMBase.NAME = 'ddm'; + + DDMBase.ATTRS = { + /** + * The cursor to apply when dragging, if shimmed the shim will get the cursor. + * @attribute dragCursor + * @type String + */ + dragCursor: { + value: 'move' + }, + /** + * The number of pixels to move to start a drag operation, default is 3. + * @attribute clickPixelThresh + * @type Number + */ + clickPixelThresh: { + value: 3 + }, + /** + * The number of milliseconds a mousedown has to pass to start a drag operation, default is 1000. + * @attribute clickTimeThresh + * @type Number + */ + clickTimeThresh: { + value: 1000 + }, + /** + * The number of milliseconds to throttle the mousemove event. Default: 150 + * @attribute throttleTime + * @type Number + */ + throttleTime: { + //value: 150 + value: -1 + }, + /** + * This attribute only works if the dd-drop module is active. It will set the dragMode (point, intersect, strict) of all future Drag instances. + * @attribute dragMode + * @type String + */ + dragMode: { + value: 'point', + setter: function(mode) { + this._setDragMode(mode); + return mode; + } + } + + }; + + Y.extend(DDMBase, Y.Base, { + _createPG: function() {}, + /** + * flag set when we activate our first drag, so DDM can start listening for events. + * @property _active + * @type {Boolean} + */ + _active: null, + /** + * Handler for dragMode attribute setter. + * @private + * @method _setDragMode + * @param {String|Number} mode The Number value or the String for the DragMode to default all future drag instances to. + * @return Number The Mode to be set + */ + _setDragMode: function(mode) { + if (mode === null) { + mode = Y.DD.DDM.get('dragMode'); + } + switch (mode) { + case 1: + case 'intersect': + return 1; + case 2: + case 'strict': + return 2; + case 0: + case 'point': + return 0; + } + return 0; + }, + /** + * The PREFIX to attach to all DD CSS class names + * @property CSS_PREFIX + * @type {String} + */ + CSS_PREFIX: Y.ClassNameManager.getClassName('dd'), + _activateTargets: function() {}, + /** + * Holder for all registered drag elements. + * @private + * @property _drags + * @type {Array} + */ + _drags: [], + /** + * A reference to the currently active draggable object. + * @property activeDrag + * @type {Drag} + */ + activeDrag: false, + /** + * Adds a reference to the drag object to the DDM._drags array, called in the constructor of Drag. + * @private + * @method _regDrag + * @param {Drag} d The Drag object + */ + _regDrag: function(d) { + if (this.getDrag(d.get('node'))) { + return false; + } + + if (!this._active) { + this._setupListeners(); + } + this._drags.push(d); + return true; + }, + /** + * Remove this drag object from the DDM._drags array. + * @private + * @method _unregDrag + * @param {Drag} d The drag object. + */ + _unregDrag: function(d) { + var tmp = []; + Y.Array.each(this._drags, function(n) { + if (n !== d) { + tmp[tmp.length] = n; + } + }); + this._drags = tmp; + }, + /** + * Add the document listeners. + * @private + * @method _setupListeners + */ + _setupListeners: function() { + this._createPG(); + this._active = true; + + var doc = Y.one(Y.config.doc); + doc.on('mousemove', Y.throttle(Y.bind(this._docMove, this), this.get('throttleTime'))); + doc.on('mouseup', Y.bind(this._end, this)); + }, + /** + * Internal method used by Drag to signal the start of a drag operation + * @private + * @method _start + */ + _start: function() { + this.fire('ddm:start'); + this._startDrag(); + }, + /** + * Factory method to be overwritten by other DDM's + * @private + * @method _startDrag + * @param {Number} x The x position of the drag element + * @param {Number} y The y position of the drag element + * @param {Number} w The width of the drag element + * @param {Number} h The height of the drag element + */ + _startDrag: function() {}, + /** + * Factory method to be overwritten by other DDM's + * @private + * @method _endDrag + */ + _endDrag: function() {}, + _dropMove: function() {}, + /** + * Internal method used by Drag to signal the end of a drag operation + * @private + * @method _end + */ + _end: function() { + if (this.activeDrag) { + this._shimming = false; + this._endDrag(); + this.fire('ddm:end'); + this.activeDrag.end.call(this.activeDrag); + this.activeDrag = null; + } + }, + /** + * Method will forcefully stop a drag operation. For example calling this from inside an ESC keypress handler will stop this drag. + * @method stopDrag + * @chainable + */ + stopDrag: function() { + if (this.activeDrag) { + this._end(); + } + return this; + }, + /** + * Set to true when drag starts and useShim is true. Used in pairing with _docMove + * @private + * @property _shimming + * @see _docMove + * @type {Boolean} + */ + _shimming: false, + /** + * Internal listener for the mousemove on Document. Checks if the shim is in place to only call _move once per mouse move + * @private + * @method _docMove + * @param {EventFacade} ev The Dom mousemove Event + */ + _docMove: function(ev) { + if (!this._shimming) { + this._move(ev); + } + }, + /** + * Internal listener for the mousemove DOM event to pass to the Drag's move method. + * @private + * @method _move + * @param {EventFacade} ev The Dom mousemove Event + */ + _move: function(ev) { + if (this.activeDrag) { + this.activeDrag._move.call(this.activeDrag, ev); + this._dropMove(); + } + }, + /** + * //TODO Private, rename??... + * Helper method to use to set the gutter from the attribute setter. + * CSS style string for gutter: '5 0' (sets top and bottom to 5px, left and right to 0px), '1 2 3 4' (top 1px, right 2px, bottom 3px, left 4px) + * @private + * @method cssSizestoObject + * @param {String} gutter CSS style string for gutter + * @return {Object} The gutter Object Literal. + */ + cssSizestoObject: function(gutter) { + var x = gutter.split(' '); + + switch (x.length) { + case 1: x[1] = x[2] = x[3] = x[0]; break; + case 2: x[2] = x[0]; x[3] = x[1]; break; + case 3: x[3] = x[1]; break; + } + + return { + top : parseInt(x[0],10), + right : parseInt(x[1],10), + bottom: parseInt(x[2],10), + left : parseInt(x[3],10) + }; + }, + /** + * Get a valid Drag instance back from a Node or a selector string, false otherwise + * @method getDrag + * @param {String/Object} node The Node instance or Selector string to check for a valid Drag Object + * @return {Object} + */ + getDrag: function(node) { + var drag = false, + n = Y.one(node); + if (n instanceof Y.Node) { + Y.Array.each(this._drags, function(v) { + if (n.compareTo(v.get('node'))) { + drag = v; + } + }); + } + return drag; + }, + /** + * Swap the position of 2 nodes based on their CSS positioning. + * @method swapPosition + * @param {Node} n1 The first node to swap + * @param {Node} n2 The first node to swap + * @return {Node} + */ + swapPosition: function(n1, n2) { + n1 = Y.DD.DDM.getNode(n1); + n2 = Y.DD.DDM.getNode(n2); + var xy1 = n1.getXY(), + xy2 = n2.getXY(); + + n1.setXY(xy2); + n2.setXY(xy1); + return n1; + }, + /** + * Return a node instance from the given node, selector string or Y.Base extended object. + * @method getNode + * @param {Node/Object/String} n The node to resolve. + * @return {Node} + */ + getNode: function(n) { + if (n instanceof Y.Node) { + return n; + } + if (n && n.get) { + if (Y.Widget && (n instanceof Y.Widget)) { + n = n.get('boundingBox'); + } else { + n = n.get('node'); + } + } else { + n = Y.one(n); + } + return n; + }, + /** + * Swap the position of 2 nodes based on their DOM location. + * @method swapNode + * @param {Node} n1 The first node to swap + * @param {Node} n2 The first node to swap + * @return {Node} + */ + swapNode: function(n1, n2) { + n1 = Y.DD.DDM.getNode(n1); + n2 = Y.DD.DDM.getNode(n2); + var p = n2.get('parentNode'), + s = n2.get('nextSibling'); + + if (s === n1) { + p.insertBefore(n1, n2); + } else if (n2 === n1.get('nextSibling')) { + p.insertBefore(n2, n1); + } else { + n1.get('parentNode').replaceChild(n2, n1); + p.insertBefore(n1, s); + } + return n1; + } + }); + + Y.namespace('DD'); + Y.DD.DDM = new DDMBase(); + + /** + * Fires from the DDM before all drag events fire. + * @event ddm:start + * @type {CustomEvent} + */ + /** + * Fires from the DDM after the DDM finishes, before the drag end events. + * @event ddm:end + * @type {CustomEvent} + */ + + + + +}, '@VERSION@', {"requires": ["node", "base", "yui-throttle", "classnamemanager"]}); diff --git a/src/build/dd-ddm-base/dd-ddm-base-min.js b/src/build/dd-ddm-base/dd-ddm-base-min.js new file mode 100644 index 00000000000..c14aedc553e --- /dev/null +++ b/src/build/dd-ddm-base/dd-ddm-base-min.js @@ -0,0 +1 @@ +YUI.add("dd-ddm-base",function(e,t){var n=function(){n.superclass.constructor.apply(this,arguments)};n.NAME="ddm",n.ATTRS={dragCursor:{value:"move"},clickPixelThresh:{value:3},clickTimeThresh:{value:1e3},throttleTime:{value:-1},dragMode:{value:"point",setter:function(e){return this._setDragMode(e),e}}},e.extend(n,e.Base,{_createPG:function(){},_active:null,_setDragMode:function(t){t===null&&(t=e.DD.DDM.get("dragMode"));switch(t){case 1:case"intersect":return 1;case 2:case"strict":return 2;case 0:case"point":return 0}return 0},CSS_PREFIX:e.ClassNameManager.getClassName("dd"),_activateTargets:function(){},_drags:[],activeDrag:!1,_regDrag:function(e){return this.getDrag(e.get("node"))?!1:(this._active||this._setupListeners(),this._drags.push(e),!0)},_unregDrag:function(t){var n=[];e.Array.each(this._drags,function(e){e!==t&&(n[n.length]=e)}),this._drags=n},_setupListeners:function(){this._createPG(),this._active=!0;var t=e.one(e.config.doc);t.on("mousemove",e.throttle(e.bind(this._docMove,this),this.get("throttleTime"))),t.on("mouseup",e.bind(this._end,this))},_start:function(){this.fire("ddm:start"),this._startDrag()},_startDrag:function(){},_endDrag:function(){},_dropMove:function(){},_end:function(){this.activeDrag&&(this._shimming=!1,this._endDrag(),this.fire("ddm:end"),this.activeDrag.end.call(this.activeDrag),this.activeDrag=null)},stopDrag:function(){return this.activeDrag&&this._end(),this},_shimming:!1,_docMove:function(e){this._shimming||this._move(e)},_move:function(e){this.activeDrag&&(this.activeDrag._move.call(this.activeDrag,e),this._dropMove())},cssSizestoObject:function(e){var t=e.split(" ");switch(t.length){case 1:t[1]=t[2]=t[3]=t[0];break;case 2:t[2]=t[0],t[3]=t[1];break;case 3:t[3]=t[1]}return{top:parseInt(t[0],10),right:parseInt(t[1],10),bottom:parseInt(t[2],10),left:parseInt(t[3],10)}},getDrag:function(t){var n=!1,r=e.one(t);return r instanceof e.Node&&e.Array.each(this._drags,function(e){r.compareTo(e.get("node"))&&(n=e)}),n},swapPosition:function(t,n){t=e.DD.DDM.getNode(t),n=e.DD.DDM.getNode(n);var r=t.getXY(),i=n.getXY();return t.setXY(i),n.setXY(r),t},getNode:function(t){return t instanceof e.Node?t:(t&&t.get?e.Widget&&t instanceof e.Widget?t=t.get("boundingBox"):t=t.get("node"):t=e.one(t),t)},swapNode:function(t,n){t=e.DD.DDM.getNode(t),n=e.DD.DDM.getNode(n);var r=n.get("parentNode"),i=n.get("nextSibling");return i===t?r.insertBefore(t,n):n===t.get("nextSibling")?r.insertBefore(n,t):(t.get("parentNode").replaceChild(n,t),r.insertBefore(t,i)),t}}),e.namespace("DD"),e.DD.DDM=new n},"@VERSION@",{requires:["node","base","yui-throttle","classnamemanager"]}); diff --git a/src/build/dd-ddm-base/dd-ddm-base.js b/src/build/dd-ddm-base/dd-ddm-base.js new file mode 100644 index 00000000000..d1fbb589183 --- /dev/null +++ b/src/build/dd-ddm-base/dd-ddm-base.js @@ -0,0 +1,374 @@ +YUI.add('dd-ddm-base', function (Y, NAME) { + + + /** + * Provides the base Drag Drop Manager required for making a Node draggable. + * @module dd + * @submodule dd-ddm-base + */ + /** + * Provides the base Drag Drop Manager required for making a Node draggable. + * @class DDM + * @extends Base + * @constructor + * @namespace DD + */ + + var DDMBase = function() { + DDMBase.superclass.constructor.apply(this, arguments); + }; + + DDMBase.NAME = 'ddm'; + + DDMBase.ATTRS = { + /** + * The cursor to apply when dragging, if shimmed the shim will get the cursor. + * @attribute dragCursor + * @type String + */ + dragCursor: { + value: 'move' + }, + /** + * The number of pixels to move to start a drag operation, default is 3. + * @attribute clickPixelThresh + * @type Number + */ + clickPixelThresh: { + value: 3 + }, + /** + * The number of milliseconds a mousedown has to pass to start a drag operation, default is 1000. + * @attribute clickTimeThresh + * @type Number + */ + clickTimeThresh: { + value: 1000 + }, + /** + * The number of milliseconds to throttle the mousemove event. Default: 150 + * @attribute throttleTime + * @type Number + */ + throttleTime: { + //value: 150 + value: -1 + }, + /** + * This attribute only works if the dd-drop module is active. It will set the dragMode (point, intersect, strict) of all future Drag instances. + * @attribute dragMode + * @type String + */ + dragMode: { + value: 'point', + setter: function(mode) { + this._setDragMode(mode); + return mode; + } + } + + }; + + Y.extend(DDMBase, Y.Base, { + _createPG: function() {}, + /** + * flag set when we activate our first drag, so DDM can start listening for events. + * @property _active + * @type {Boolean} + */ + _active: null, + /** + * Handler for dragMode attribute setter. + * @private + * @method _setDragMode + * @param {String|Number} mode The Number value or the String for the DragMode to default all future drag instances to. + * @return Number The Mode to be set + */ + _setDragMode: function(mode) { + if (mode === null) { + mode = Y.DD.DDM.get('dragMode'); + } + switch (mode) { + case 1: + case 'intersect': + return 1; + case 2: + case 'strict': + return 2; + case 0: + case 'point': + return 0; + } + return 0; + }, + /** + * The PREFIX to attach to all DD CSS class names + * @property CSS_PREFIX + * @type {String} + */ + CSS_PREFIX: Y.ClassNameManager.getClassName('dd'), + _activateTargets: function() {}, + /** + * Holder for all registered drag elements. + * @private + * @property _drags + * @type {Array} + */ + _drags: [], + /** + * A reference to the currently active draggable object. + * @property activeDrag + * @type {Drag} + */ + activeDrag: false, + /** + * Adds a reference to the drag object to the DDM._drags array, called in the constructor of Drag. + * @private + * @method _regDrag + * @param {Drag} d The Drag object + */ + _regDrag: function(d) { + if (this.getDrag(d.get('node'))) { + return false; + } + + if (!this._active) { + this._setupListeners(); + } + this._drags.push(d); + return true; + }, + /** + * Remove this drag object from the DDM._drags array. + * @private + * @method _unregDrag + * @param {Drag} d The drag object. + */ + _unregDrag: function(d) { + var tmp = []; + Y.Array.each(this._drags, function(n) { + if (n !== d) { + tmp[tmp.length] = n; + } + }); + this._drags = tmp; + }, + /** + * Add the document listeners. + * @private + * @method _setupListeners + */ + _setupListeners: function() { + this._createPG(); + this._active = true; + + var doc = Y.one(Y.config.doc); + doc.on('mousemove', Y.throttle(Y.bind(this._docMove, this), this.get('throttleTime'))); + doc.on('mouseup', Y.bind(this._end, this)); + }, + /** + * Internal method used by Drag to signal the start of a drag operation + * @private + * @method _start + */ + _start: function() { + this.fire('ddm:start'); + this._startDrag(); + }, + /** + * Factory method to be overwritten by other DDM's + * @private + * @method _startDrag + * @param {Number} x The x position of the drag element + * @param {Number} y The y position of the drag element + * @param {Number} w The width of the drag element + * @param {Number} h The height of the drag element + */ + _startDrag: function() {}, + /** + * Factory method to be overwritten by other DDM's + * @private + * @method _endDrag + */ + _endDrag: function() {}, + _dropMove: function() {}, + /** + * Internal method used by Drag to signal the end of a drag operation + * @private + * @method _end + */ + _end: function() { + if (this.activeDrag) { + this._shimming = false; + this._endDrag(); + this.fire('ddm:end'); + this.activeDrag.end.call(this.activeDrag); + this.activeDrag = null; + } + }, + /** + * Method will forcefully stop a drag operation. For example calling this from inside an ESC keypress handler will stop this drag. + * @method stopDrag + * @chainable + */ + stopDrag: function() { + if (this.activeDrag) { + this._end(); + } + return this; + }, + /** + * Set to true when drag starts and useShim is true. Used in pairing with _docMove + * @private + * @property _shimming + * @see _docMove + * @type {Boolean} + */ + _shimming: false, + /** + * Internal listener for the mousemove on Document. Checks if the shim is in place to only call _move once per mouse move + * @private + * @method _docMove + * @param {EventFacade} ev The Dom mousemove Event + */ + _docMove: function(ev) { + if (!this._shimming) { + this._move(ev); + } + }, + /** + * Internal listener for the mousemove DOM event to pass to the Drag's move method. + * @private + * @method _move + * @param {EventFacade} ev The Dom mousemove Event + */ + _move: function(ev) { + if (this.activeDrag) { + this.activeDrag._move.call(this.activeDrag, ev); + this._dropMove(); + } + }, + /** + * //TODO Private, rename??... + * Helper method to use to set the gutter from the attribute setter. + * CSS style string for gutter: '5 0' (sets top and bottom to 5px, left and right to 0px), '1 2 3 4' (top 1px, right 2px, bottom 3px, left 4px) + * @private + * @method cssSizestoObject + * @param {String} gutter CSS style string for gutter + * @return {Object} The gutter Object Literal. + */ + cssSizestoObject: function(gutter) { + var x = gutter.split(' '); + + switch (x.length) { + case 1: x[1] = x[2] = x[3] = x[0]; break; + case 2: x[2] = x[0]; x[3] = x[1]; break; + case 3: x[3] = x[1]; break; + } + + return { + top : parseInt(x[0],10), + right : parseInt(x[1],10), + bottom: parseInt(x[2],10), + left : parseInt(x[3],10) + }; + }, + /** + * Get a valid Drag instance back from a Node or a selector string, false otherwise + * @method getDrag + * @param {String/Object} node The Node instance or Selector string to check for a valid Drag Object + * @return {Object} + */ + getDrag: function(node) { + var drag = false, + n = Y.one(node); + if (n instanceof Y.Node) { + Y.Array.each(this._drags, function(v) { + if (n.compareTo(v.get('node'))) { + drag = v; + } + }); + } + return drag; + }, + /** + * Swap the position of 2 nodes based on their CSS positioning. + * @method swapPosition + * @param {Node} n1 The first node to swap + * @param {Node} n2 The first node to swap + * @return {Node} + */ + swapPosition: function(n1, n2) { + n1 = Y.DD.DDM.getNode(n1); + n2 = Y.DD.DDM.getNode(n2); + var xy1 = n1.getXY(), + xy2 = n2.getXY(); + + n1.setXY(xy2); + n2.setXY(xy1); + return n1; + }, + /** + * Return a node instance from the given node, selector string or Y.Base extended object. + * @method getNode + * @param {Node/Object/String} n The node to resolve. + * @return {Node} + */ + getNode: function(n) { + if (n instanceof Y.Node) { + return n; + } + if (n && n.get) { + if (Y.Widget && (n instanceof Y.Widget)) { + n = n.get('boundingBox'); + } else { + n = n.get('node'); + } + } else { + n = Y.one(n); + } + return n; + }, + /** + * Swap the position of 2 nodes based on their DOM location. + * @method swapNode + * @param {Node} n1 The first node to swap + * @param {Node} n2 The first node to swap + * @return {Node} + */ + swapNode: function(n1, n2) { + n1 = Y.DD.DDM.getNode(n1); + n2 = Y.DD.DDM.getNode(n2); + var p = n2.get('parentNode'), + s = n2.get('nextSibling'); + + if (s === n1) { + p.insertBefore(n1, n2); + } else if (n2 === n1.get('nextSibling')) { + p.insertBefore(n2, n1); + } else { + n1.get('parentNode').replaceChild(n2, n1); + p.insertBefore(n1, s); + } + return n1; + } + }); + + Y.namespace('DD'); + Y.DD.DDM = new DDMBase(); + + /** + * Fires from the DDM before all drag events fire. + * @event ddm:start + * @type {CustomEvent} + */ + /** + * Fires from the DDM after the DDM finishes, before the drag end events. + * @event ddm:end + * @type {CustomEvent} + */ + + + + +}, '@VERSION@', {"requires": ["node", "base", "yui-throttle", "classnamemanager"]}); diff --git a/src/build/dd-ddm-drop/dd-ddm-drop-coverage.js b/src/build/dd-ddm-drop/dd-ddm-drop-coverage.js new file mode 100644 index 00000000000..3771a38896f --- /dev/null +++ b/src/build/dd-ddm-drop/dd-ddm-drop-coverage.js @@ -0,0 +1,6 @@ +if (typeof __coverage__ === 'undefined') { __coverage__ = {}; } +if (!__coverage__['build/dd-ddm-drop/dd-ddm-drop.js']) { + __coverage__['build/dd-ddm-drop/dd-ddm-drop.js'] = {"path":"build/dd-ddm-drop/dd-ddm-drop.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0,"106":0,"107":0,"108":0,"109":0,"110":0,"111":0},"b":{"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0],"8":[0,0],"9":[0,0],"10":[0,0],"11":[0,0],"12":[0,0],"13":[0,0],"14":[0,0],"15":[0,0],"16":[0,0],"17":[0,0],"18":[0,0],"19":[0,0],"20":[0,0],"21":[0,0],"22":[0,0,0],"23":[0,0],"24":[0,0],"25":[0,0],"26":[0,0],"27":[0,0],"28":[0,0],"29":[0,0],"30":[0,0],"31":[0,0],"32":[0,0],"33":[0,0],"34":[0,0],"35":[0,0]},"f":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":42}}},"2":{"name":"(anonymous_2)","line":35,"loc":{"start":{"line":35,"column":24},"end":{"line":35,"column":35}}},"3":{"name":"(anonymous_3)","line":47,"loc":{"start":{"line":47,"column":24},"end":{"line":47,"column":36}}},"4":{"name":"(anonymous_4)","line":56,"loc":{"start":{"line":56,"column":27},"end":{"line":56,"column":39}}},"5":{"name":"(anonymous_5)","line":58,"loc":{"start":{"line":58,"column":44},"end":{"line":58,"column":56}}},"6":{"name":"(anonymous_6)","line":71,"loc":{"start":{"line":71,"column":25},"end":{"line":71,"column":41}}},"7":{"name":"(anonymous_7)","line":72,"loc":{"start":{"line":72,"column":29},"end":{"line":72,"column":45}}},"8":{"name":"(anonymous_8)","line":74,"loc":{"start":{"line":74,"column":36},"end":{"line":74,"column":48}}},"9":{"name":"(anonymous_9)","line":145,"loc":{"start":{"line":145,"column":19},"end":{"line":145,"column":34}}},"10":{"name":"(anonymous_10)","line":156,"loc":{"start":{"line":156,"column":22},"end":{"line":156,"column":37}}},"11":{"name":"(anonymous_11)","line":158,"loc":{"start":{"line":158,"column":42},"end":{"line":158,"column":54}}},"12":{"name":"(anonymous_12)","line":173,"loc":{"start":{"line":173,"column":22},"end":{"line":173,"column":37}}},"13":{"name":"(anonymous_13)","line":206,"loc":{"start":{"line":206,"column":20},"end":{"line":206,"column":31}}},"14":{"name":"(anonymous_14)","line":216,"loc":{"start":{"line":216,"column":26},"end":{"line":216,"column":37}}},"15":{"name":"(anonymous_15)","line":219,"loc":{"start":{"line":219,"column":39},"end":{"line":219,"column":51}}},"16":{"name":"(anonymous_16)","line":235,"loc":{"start":{"line":235,"column":22},"end":{"line":235,"column":43}}},"17":{"name":"(anonymous_17)","line":238,"loc":{"start":{"line":238,"column":33},"end":{"line":238,"column":45}}},"18":{"name":"(anonymous_18)","line":252,"loc":{"start":{"line":252,"column":37},"end":{"line":252,"column":49}}},"19":{"name":"(anonymous_19)","line":266,"loc":{"start":{"line":266,"column":28},"end":{"line":266,"column":39}}},"20":{"name":"(anonymous_20)","line":294,"loc":{"start":{"line":294,"column":39},"end":{"line":294,"column":51}}},"21":{"name":"(anonymous_21)","line":303,"loc":{"start":{"line":303,"column":19},"end":{"line":303,"column":30}}},"22":{"name":"(anonymous_22)","line":307,"loc":{"start":{"line":307,"column":47},"end":{"line":307,"column":59}}},"23":{"name":"(anonymous_23)","line":318,"loc":{"start":{"line":318,"column":17},"end":{"line":318,"column":28}}},"24":{"name":"(anonymous_24)","line":324,"loc":{"start":{"line":324,"column":42},"end":{"line":324,"column":54}}},"25":{"name":"(anonymous_25)","line":337,"loc":{"start":{"line":337,"column":27},"end":{"line":337,"column":38}}},"26":{"name":"(anonymous_26)","line":339,"loc":{"start":{"line":339,"column":32},"end":{"line":339,"column":44}}},"27":{"name":"(anonymous_27)","line":349,"loc":{"start":{"line":349,"column":20},"end":{"line":349,"column":32}}},"28":{"name":"(anonymous_28)","line":358,"loc":{"start":{"line":358,"column":22},"end":{"line":358,"column":37}}},"29":{"name":"(anonymous_29)","line":360,"loc":{"start":{"line":360,"column":39},"end":{"line":360,"column":51}}},"30":{"name":"(anonymous_30)","line":368,"loc":{"start":{"line":368,"column":42},"end":{"line":368,"column":54}}},"31":{"name":"(anonymous_31)","line":382,"loc":{"start":{"line":382,"column":17},"end":{"line":382,"column":32}}},"32":{"name":"(anonymous_32)","line":386,"loc":{"start":{"line":386,"column":43},"end":{"line":386,"column":55}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":399,"column":42}},"2":{"start":{"line":14,"column":4},"end":{"line":394,"column":13}},"3":{"start":{"line":36,"column":12},"end":{"line":38,"column":13}},"4":{"start":{"line":37,"column":16},"end":{"line":37,"column":28}},"5":{"start":{"line":39,"column":12},"end":{"line":39,"column":44}},"6":{"start":{"line":48,"column":12},"end":{"line":48,"column":38}},"7":{"start":{"line":57,"column":12},"end":{"line":57,"column":23}},"8":{"start":{"line":58,"column":12},"end":{"line":63,"column":15}},"9":{"start":{"line":59,"column":16},"end":{"line":61,"column":17}},"10":{"start":{"line":60,"column":20},"end":{"line":60,"column":30}},"11":{"start":{"line":64,"column":12},"end":{"line":64,"column":34}},"12":{"start":{"line":72,"column":12},"end":{"line":77,"column":22}},"13":{"start":{"line":73,"column":16},"end":{"line":73,"column":70}},"14":{"start":{"line":74,"column":16},"end":{"line":76,"column":25}},"15":{"start":{"line":75,"column":20},"end":{"line":75,"column":39}},"16":{"start":{"line":146,"column":12},"end":{"line":146,"column":39}},"17":{"start":{"line":147,"column":12},"end":{"line":147,"column":24}},"18":{"start":{"line":157,"column":12},"end":{"line":157,"column":27}},"19":{"start":{"line":158,"column":12},"end":{"line":162,"column":15}},"20":{"start":{"line":159,"column":16},"end":{"line":161,"column":17}},"21":{"start":{"line":160,"column":20},"end":{"line":160,"column":34}},"22":{"start":{"line":164,"column":12},"end":{"line":164,"column":36}},"23":{"start":{"line":165,"column":12},"end":{"line":165,"column":24}},"24":{"start":{"line":174,"column":12},"end":{"line":199,"column":13}},"25":{"start":{"line":175,"column":16},"end":{"line":176,"column":46}},"26":{"start":{"line":177,"column":16},"end":{"line":198,"column":17}},"27":{"start":{"line":178,"column":20},"end":{"line":178,"column":53}},"28":{"start":{"line":179,"column":20},"end":{"line":181,"column":21}},"29":{"start":{"line":180,"column":24},"end":{"line":180,"column":100}},"30":{"start":{"line":182,"column":20},"end":{"line":197,"column":21}},"31":{"start":{"line":183,"column":24},"end":{"line":186,"column":25}},"32":{"start":{"line":184,"column":28},"end":{"line":184,"column":71}},"33":{"start":{"line":185,"column":28},"end":{"line":185,"column":87}},"34":{"start":{"line":188,"column":24},"end":{"line":190,"column":25}},"35":{"start":{"line":189,"column":28},"end":{"line":189,"column":52}},"36":{"start":{"line":191,"column":24},"end":{"line":196,"column":49}},"37":{"start":{"line":200,"column":12},"end":{"line":200,"column":25}},"38":{"start":{"line":207,"column":12},"end":{"line":207,"column":33}},"39":{"start":{"line":208,"column":12},"end":{"line":208,"column":33}},"40":{"start":{"line":209,"column":12},"end":{"line":209,"column":35}},"41":{"start":{"line":217,"column":12},"end":{"line":217,"column":32}},"42":{"start":{"line":218,"column":12},"end":{"line":218,"column":30}},"43":{"start":{"line":219,"column":12},"end":{"line":224,"column":21}},"44":{"start":{"line":220,"column":16},"end":{"line":220,"column":36}},"45":{"start":{"line":221,"column":16},"end":{"line":223,"column":17}},"46":{"start":{"line":222,"column":20},"end":{"line":222,"column":41}},"47":{"start":{"line":225,"column":12},"end":{"line":225,"column":37}},"48":{"start":{"line":236,"column":12},"end":{"line":236,"column":46}},"49":{"start":{"line":238,"column":12},"end":{"line":248,"column":21}},"50":{"start":{"line":239,"column":16},"end":{"line":239,"column":85}},"51":{"start":{"line":240,"column":16},"end":{"line":240,"column":43}},"52":{"start":{"line":242,"column":16},"end":{"line":247,"column":17}},"53":{"start":{"line":243,"column":20},"end":{"line":246,"column":21}},"54":{"start":{"line":244,"column":24},"end":{"line":244,"column":42}},"55":{"start":{"line":245,"column":24},"end":{"line":245,"column":36}},"56":{"start":{"line":249,"column":12},"end":{"line":258,"column":13}},"57":{"start":{"line":250,"column":16},"end":{"line":250,"column":25}},"58":{"start":{"line":252,"column":16},"end":{"line":256,"column":25}},"59":{"start":{"line":253,"column":20},"end":{"line":255,"column":21}},"60":{"start":{"line":254,"column":24},"end":{"line":254,"column":36}},"61":{"start":{"line":257,"column":16},"end":{"line":257,"column":38}},"62":{"start":{"line":259,"column":12},"end":{"line":259,"column":27}},"63":{"start":{"line":267,"column":12},"end":{"line":269,"column":45}},"64":{"start":{"line":272,"column":12},"end":{"line":290,"column":13}},"65":{"start":{"line":273,"column":16},"end":{"line":281,"column":17}},"66":{"start":{"line":275,"column":20},"end":{"line":275,"column":44}},"67":{"start":{"line":276,"column":20},"end":{"line":276,"column":45}},"68":{"start":{"line":278,"column":20},"end":{"line":278,"column":67}},"69":{"start":{"line":279,"column":20},"end":{"line":279,"column":40}},"70":{"start":{"line":280,"column":20},"end":{"line":280,"column":35}},"71":{"start":{"line":282,"column":16},"end":{"line":282,"column":83}},"72":{"start":{"line":283,"column":16},"end":{"line":286,"column":17}},"73":{"start":{"line":284,"column":20},"end":{"line":284,"column":103}},"74":{"start":{"line":285,"column":20},"end":{"line":285,"column":108}},"75":{"start":{"line":287,"column":19},"end":{"line":290,"column":13}},"76":{"start":{"line":288,"column":16},"end":{"line":288,"column":83}},"77":{"start":{"line":289,"column":16},"end":{"line":289,"column":111}},"78":{"start":{"line":292,"column":12},"end":{"line":292,"column":35}},"79":{"start":{"line":294,"column":12},"end":{"line":296,"column":21}},"80":{"start":{"line":295,"column":16},"end":{"line":295,"column":38}},"81":{"start":{"line":304,"column":12},"end":{"line":310,"column":13}},"82":{"start":{"line":305,"column":16},"end":{"line":305,"column":41}},"83":{"start":{"line":307,"column":16},"end":{"line":309,"column":19}},"84":{"start":{"line":308,"column":20},"end":{"line":308,"column":46}},"85":{"start":{"line":319,"column":12},"end":{"line":321,"column":13}},"86":{"start":{"line":320,"column":16},"end":{"line":320,"column":39}},"87":{"start":{"line":322,"column":12},"end":{"line":322,"column":27}},"88":{"start":{"line":324,"column":12},"end":{"line":328,"column":15}},"89":{"start":{"line":325,"column":16},"end":{"line":327,"column":17}},"90":{"start":{"line":326,"column":20},"end":{"line":326,"column":34}},"91":{"start":{"line":329,"column":12},"end":{"line":329,"column":25}},"92":{"start":{"line":338,"column":12},"end":{"line":338,"column":39}},"93":{"start":{"line":339,"column":12},"end":{"line":341,"column":21}},"94":{"start":{"line":340,"column":16},"end":{"line":340,"column":44}},"95":{"start":{"line":350,"column":12},"end":{"line":350,"column":33}},"96":{"start":{"line":359,"column":12},"end":{"line":359,"column":37}},"97":{"start":{"line":360,"column":12},"end":{"line":364,"column":21}},"98":{"start":{"line":361,"column":16},"end":{"line":363,"column":17}},"99":{"start":{"line":362,"column":20},"end":{"line":362,"column":36}},"100":{"start":{"line":365,"column":12},"end":{"line":365,"column":35}},"101":{"start":{"line":367,"column":12},"end":{"line":367,"column":24}},"102":{"start":{"line":368,"column":12},"end":{"line":372,"column":15}},"103":{"start":{"line":369,"column":16},"end":{"line":371,"column":17}},"104":{"start":{"line":370,"column":20},"end":{"line":370,"column":35}},"105":{"start":{"line":374,"column":12},"end":{"line":374,"column":37}},"106":{"start":{"line":383,"column":12},"end":{"line":384,"column":32}},"107":{"start":{"line":385,"column":12},"end":{"line":391,"column":13}},"108":{"start":{"line":386,"column":16},"end":{"line":390,"column":19}},"109":{"start":{"line":387,"column":20},"end":{"line":389,"column":21}},"110":{"start":{"line":388,"column":24},"end":{"line":388,"column":33}},"111":{"start":{"line":392,"column":12},"end":{"line":392,"column":24}}},"branchMap":{"1":{"line":36,"type":"if","locations":[{"start":{"line":36,"column":12},"end":{"line":36,"column":12}},{"start":{"line":36,"column":12},"end":{"line":36,"column":12}}]},"2":{"line":59,"type":"if","locations":[{"start":{"line":59,"column":16},"end":{"line":59,"column":16}},{"start":{"line":59,"column":16},"end":{"line":59,"column":16}}]},"3":{"line":73,"type":"cond-expr","locations":[{"start":{"line":73,"column":39},"end":{"line":73,"column":51}},{"start":{"line":73,"column":54},"end":{"line":73,"column":68}}]},"4":{"line":159,"type":"if","locations":[{"start":{"line":159,"column":16},"end":{"line":159,"column":16}},{"start":{"line":159,"column":16},"end":{"line":159,"column":16}}]},"5":{"line":174,"type":"if","locations":[{"start":{"line":174,"column":12},"end":{"line":174,"column":12}},{"start":{"line":174,"column":12},"end":{"line":174,"column":12}}]},"6":{"line":174,"type":"binary-expr","locations":[{"start":{"line":174,"column":16},"end":{"line":174,"column":31}},{"start":{"line":174,"column":35},"end":{"line":174,"column":39}}]},"7":{"line":177,"type":"if","locations":[{"start":{"line":177,"column":16},"end":{"line":177,"column":16}},{"start":{"line":177,"column":16},"end":{"line":177,"column":16}}]},"8":{"line":177,"type":"binary-expr","locations":[{"start":{"line":177,"column":20},"end":{"line":177,"column":22}},{"start":{"line":177,"column":26},"end":{"line":177,"column":41}}]},"9":{"line":179,"type":"if","locations":[{"start":{"line":179,"column":20},"end":{"line":179,"column":20}},{"start":{"line":179,"column":20},"end":{"line":179,"column":20}}]},"10":{"line":182,"type":"if","locations":[{"start":{"line":182,"column":20},"end":{"line":182,"column":20}},{"start":{"line":182,"column":20},"end":{"line":182,"column":20}}]},"11":{"line":182,"type":"binary-expr","locations":[{"start":{"line":182,"column":24},"end":{"line":182,"column":28}},{"start":{"line":182,"column":32},"end":{"line":182,"column":41}}]},"12":{"line":183,"type":"if","locations":[{"start":{"line":183,"column":24},"end":{"line":183,"column":24}},{"start":{"line":183,"column":24},"end":{"line":183,"column":24}}]},"13":{"line":183,"type":"binary-expr","locations":[{"start":{"line":183,"column":29},"end":{"line":183,"column":53}},{"start":{"line":183,"column":58},"end":{"line":183,"column":70}}]},"14":{"line":184,"type":"binary-expr","locations":[{"start":{"line":184,"column":32},"end":{"line":184,"column":39}},{"start":{"line":184,"column":43},"end":{"line":184,"column":70}}]},"15":{"line":188,"type":"if","locations":[{"start":{"line":188,"column":24},"end":{"line":188,"column":24}},{"start":{"line":188,"column":24},"end":{"line":188,"column":24}}]},"16":{"line":221,"type":"if","locations":[{"start":{"line":221,"column":16},"end":{"line":221,"column":16}},{"start":{"line":221,"column":16},"end":{"line":221,"column":16}}]},"17":{"line":242,"type":"if","locations":[{"start":{"line":242,"column":16},"end":{"line":242,"column":16}},{"start":{"line":242,"column":16},"end":{"line":242,"column":16}}]},"18":{"line":243,"type":"if","locations":[{"start":{"line":243,"column":20},"end":{"line":243,"column":20}},{"start":{"line":243,"column":20},"end":{"line":243,"column":20}}]},"19":{"line":249,"type":"if","locations":[{"start":{"line":249,"column":12},"end":{"line":249,"column":12}},{"start":{"line":249,"column":12},"end":{"line":249,"column":12}}]},"20":{"line":253,"type":"if","locations":[{"start":{"line":253,"column":20},"end":{"line":253,"column":20}},{"start":{"line":253,"column":20},"end":{"line":253,"column":20}}]},"21":{"line":272,"type":"if","locations":[{"start":{"line":272,"column":12},"end":{"line":272,"column":12}},{"start":{"line":272,"column":12},"end":{"line":272,"column":12}}]},"22":{"line":272,"type":"binary-expr","locations":[{"start":{"line":272,"column":16},"end":{"line":272,"column":26}},{"start":{"line":272,"column":30},"end":{"line":272,"column":40}},{"start":{"line":272,"column":44},"end":{"line":272,"column":71}}]},"23":{"line":273,"type":"if","locations":[{"start":{"line":273,"column":16},"end":{"line":273,"column":16}},{"start":{"line":273,"column":16},"end":{"line":273,"column":16}}]},"24":{"line":283,"type":"if","locations":[{"start":{"line":283,"column":16},"end":{"line":283,"column":16}},{"start":{"line":283,"column":16},"end":{"line":283,"column":16}}]},"25":{"line":287,"type":"if","locations":[{"start":{"line":287,"column":19},"end":{"line":287,"column":19}},{"start":{"line":287,"column":19},"end":{"line":287,"column":19}}]},"26":{"line":287,"type":"binary-expr","locations":[{"start":{"line":287,"column":23},"end":{"line":287,"column":33}},{"start":{"line":287,"column":37},"end":{"line":287,"column":63}}]},"27":{"line":304,"type":"if","locations":[{"start":{"line":304,"column":12},"end":{"line":304,"column":12}},{"start":{"line":304,"column":12},"end":{"line":304,"column":12}}]},"28":{"line":319,"type":"if","locations":[{"start":{"line":319,"column":12},"end":{"line":319,"column":12}},{"start":{"line":319,"column":12},"end":{"line":319,"column":12}}]},"29":{"line":319,"type":"binary-expr","locations":[{"start":{"line":319,"column":16},"end":{"line":319,"column":29}},{"start":{"line":319,"column":33},"end":{"line":319,"column":45}}]},"30":{"line":325,"type":"if","locations":[{"start":{"line":325,"column":16},"end":{"line":325,"column":16}},{"start":{"line":325,"column":16},"end":{"line":325,"column":16}}]},"31":{"line":325,"type":"binary-expr","locations":[{"start":{"line":325,"column":20},"end":{"line":325,"column":26}},{"start":{"line":325,"column":30},"end":{"line":325,"column":70}}]},"32":{"line":361,"type":"if","locations":[{"start":{"line":361,"column":16},"end":{"line":361,"column":16}},{"start":{"line":361,"column":16},"end":{"line":361,"column":16}}]},"33":{"line":369,"type":"if","locations":[{"start":{"line":369,"column":16},"end":{"line":369,"column":16}},{"start":{"line":369,"column":16},"end":{"line":369,"column":16}}]},"34":{"line":385,"type":"if","locations":[{"start":{"line":385,"column":12},"end":{"line":385,"column":12}},{"start":{"line":385,"column":12},"end":{"line":385,"column":12}}]},"35":{"line":387,"type":"if","locations":[{"start":{"line":387,"column":20},"end":{"line":387,"column":20}},{"start":{"line":387,"column":20},"end":{"line":387,"column":20}}]}},"code":["(function () { YUI.add('dd-ddm-drop', function (Y, NAME) {","",""," /**"," * Extends the dd-ddm Class to add support for the placement of Drop Target"," * shims inside the viewport shim. It also handles all Drop Target related events and interactions."," * @module dd"," * @submodule dd-ddm-drop"," * @for DDM"," * @namespace DD"," */",""," //TODO CSS class name for the bestMatch.."," Y.mix(Y.DD.DDM, {"," /**"," * This flag turns off the use of the mouseover/mouseout shim. It should not be used unless you know what you are doing."," * @private"," * @property _noShim"," * @type {Boolean}"," */"," _noShim: false,"," /**"," * Placeholder for all active shims on the page"," * @private"," * @property _activeShims"," * @type {Array}"," */"," _activeShims: [],"," /**"," * This method checks the _activeShims Object to see if there is a shim active."," * @private"," * @method _hasActiveShim"," * @return {Boolean}"," */"," _hasActiveShim: function() {"," if (this._noShim) {"," return true;"," }"," return this._activeShims.length;"," },"," /**"," * Adds a Drop Target to the list of active shims"," * @private"," * @method _addActiveShim"," * @param {Object} d The Drop instance to add to the list."," */"," _addActiveShim: function(d) {"," this._activeShims.push(d);"," },"," /**"," * Removes a Drop Target to the list of active shims"," * @private"," * @method _removeActiveShim"," * @param {Object} d The Drop instance to remove from the list."," */"," _removeActiveShim: function(d) {"," var s = [];"," Y.Array.each(this._activeShims, function(v) {"," if (v._yuid !== d._yuid) {"," s.push(v);"," }",""," });"," this._activeShims = s;"," },"," /**"," * This method will sync the position of the shims on the Drop Targets that are currently active."," * @method syncActiveShims"," * @param {Boolean} force Resize/sync all Targets."," */"," syncActiveShims: function(force) {"," Y.later(0, this, function(force) {"," var drops = ((force) ? this.targets : this._lookup());"," Y.Array.each(drops, function(v) {"," v.sizeShim.call(v);"," }, this);"," }, force);"," },"," /**"," * The mode that the drag operations will run in 0 for Point, 1 for Intersect, 2 for Strict"," * @private"," * @property mode"," * @type Number"," */"," mode: 0,"," /**"," * In point mode, a Drop is targeted by the cursor being over the Target"," * @private"," * @property POINT"," * @type Number"," */"," POINT: 0,"," /**"," * In intersect mode, a Drop is targeted by \"part\" of the drag node being over the Target"," * @private"," * @property INTERSECT"," * @type Number"," */"," INTERSECT: 1,"," /**"," * In strict mode, a Drop is targeted by the \"entire\" drag node being over the Target"," * @private"," * @property STRICT"," * @type Number"," */"," STRICT: 2,"," /**"," * Should we only check targets that are in the viewport on drags (for performance), default: true"," * @property useHash"," * @type {Boolean}"," */"," useHash: true,"," /**"," * A reference to the active Drop Target"," * @property activeDrop"," * @type {Object}"," */"," activeDrop: null,"," /**"," * An array of the valid Drop Targets for this interaction."," * @property validDrops"," * @type {Array}"," */"," //TODO Change array/object literals to be in sync.."," validDrops: [],"," /**"," * An object literal of Other Drop Targets that we encountered during this interaction (in the case of overlapping Drop Targets)"," * @property otherDrops"," * @type {Object}"," */"," otherDrops: {},"," /**"," * All of the Targets"," * @property targets"," * @type {Array}"," */"," targets: [],"," /**"," * Add a Drop Target to the list of Valid Targets. This list get's regenerated on each new drag operation."," * @private"," * @method _addValid"," * @param {Object} drop"," * @chainable"," */"," _addValid: function(drop) {"," this.validDrops.push(drop);"," return this;"," },"," /**"," * Removes a Drop Target from the list of Valid Targets. This list get's regenerated on each new drag operation."," * @private"," * @method _removeValid"," * @param {Object} drop"," * @chainable"," */"," _removeValid: function(drop) {"," var drops = [];"," Y.Array.each(this.validDrops, function(v) {"," if (v !== drop) {"," drops.push(v);"," }"," });",""," this.validDrops = drops;"," return this;"," },"," /**"," * Check to see if the Drag element is over the target, method varies on current mode"," * @method isOverTarget"," * @param {Object} drop The drop to check against"," * @return {Boolean}"," */"," isOverTarget: function(drop) {"," if (this.activeDrag && drop) {"," var xy = this.activeDrag.mouseXY, r, dMode = this.activeDrag.get('dragMode'),"," aRegion, node = drop.shim;"," if (xy && this.activeDrag) {"," aRegion = this.activeDrag.region;"," if (dMode === this.STRICT) {"," return this.activeDrag.get('dragNode').inRegion(drop.region, true, aRegion);"," }"," if (drop && drop.shim) {"," if ((dMode === this.INTERSECT) && this._noShim) {"," r = aRegion || this.activeDrag.get('node');"," return drop.get('node').intersect(r, drop.region).inRegion;"," }",""," if (this._noShim) {"," node = drop.get('node');"," }"," return node.intersect({"," top: xy[1],"," bottom: xy[1],"," left: xy[0],"," right: xy[0]"," }, drop.region).inRegion;"," }"," }"," }"," return false;"," },"," /**"," * Clears the cache data used for this interaction."," * @method clearCache"," */"," clearCache: function() {"," this.validDrops = [];"," this.otherDrops = {};"," this._activeShims = [];"," },"," /**"," * Clear the cache and activate the shims of all the targets"," * @private"," * @method _activateTargets"," */"," _activateTargets: function() {"," this._noShim = true;"," this.clearCache();"," Y.Array.each(this.targets, function(v) {"," v._activateShim([]);"," if (v.get('noShim') === true) {"," this._noShim = false;"," }"," }, this);"," this._handleTargetOver();",""," },"," /**"," * This method will gather the area for all potential targets and see which has the hightest covered area and return it."," * @method getBestMatch"," * @param {Array} drops An Array of drops to scan for the best match."," * @param {Boolean} all If present, it returns an Array. First item is best match, second is an Array of the other items in the original Array."," * @return {Object or Array}"," */"," getBestMatch: function(drops, all) {"," var biggest = null, area = 0, out;",""," Y.Object.each(drops, function(v) {"," var inter = this.activeDrag.get('dragNode').intersect(v.get('node'));"," v.region.area = inter.area;",""," if (inter.inRegion) {"," if (inter.area > area) {"," area = inter.area;"," biggest = v;"," }"," }"," }, this);"," if (all) {"," out = [];"," //TODO Sort the others in numeric order by area covered.."," Y.Object.each(drops, function(v) {"," if (v !== biggest) {"," out.push(v);"," }"," }, this);"," return [biggest, out];"," }"," return biggest;"," },"," /**"," * This method fires the drop:hit, drag:drophit, drag:dropmiss methods and deactivates the shims.."," * @private"," * @method _deactivateTargets"," */"," _deactivateTargets: function() {"," var other = [], tmp,"," activeDrag = this.activeDrag,"," activeDrop = this.activeDrop;",""," //TODO why is this check so hard??"," if (activeDrag && activeDrop && this.otherDrops[activeDrop]) {"," if (!activeDrag.get('dragMode')) {"," //TODO otherDrops -- private.."," other = this.otherDrops;"," delete other[activeDrop];"," } else {"," tmp = this.getBestMatch(this.otherDrops, true);"," activeDrop = tmp[0];"," other = tmp[1];"," }"," activeDrag.get('node').removeClass(this.CSS_PREFIX + '-drag-over');"," if (activeDrop) {"," activeDrop.fire('drop:hit', { drag: activeDrag, drop: activeDrop, others: other });"," activeDrag.fire('drag:drophit', { drag: activeDrag, drop: activeDrop, others: other });"," }"," } else if (activeDrag && activeDrag.get('dragging')) {"," activeDrag.get('node').removeClass(this.CSS_PREFIX + '-drag-over');"," activeDrag.fire('drag:dropmiss', { pageX: activeDrag.lastXY[0], pageY: activeDrag.lastXY[1] });"," }",""," this.activeDrop = null;",""," Y.Array.each(this.targets, function(v) {"," v._deactivateShim([]);"," }, this);"," },"," /**"," * This method is called when the move method is called on the Drag Object."," * @private"," * @method _dropMove"," */"," _dropMove: function() {"," if (this._hasActiveShim()) {"," this._handleTargetOver();"," } else {"," Y.Object.each(this.otherDrops, function(v) {"," v._handleOut.apply(v, []);"," });"," }"," },"," /**"," * Filters the list of Drops down to those in the viewport."," * @private"," * @method _lookup"," * @return {Array} The valid Drop Targets that are in the viewport."," */"," _lookup: function() {"," if (!this.useHash || this._noShim) {"," return this.validDrops;"," }"," var drops = [];"," //Only scan drop shims that are in the Viewport"," Y.Array.each(this.validDrops, function(v) {"," if (v.shim && v.shim.inViewportRegion(false, v.region)) {"," drops.push(v);"," }"," });"," return drops;",""," },"," /**"," * This method execs _handleTargetOver on all valid Drop Targets"," * @private"," * @method _handleTargetOver"," */"," _handleTargetOver: function() {"," var drops = this._lookup();"," Y.Array.each(drops, function(v) {"," v._handleTargetOver.call(v);"," }, this);"," },"," /**"," * Add the passed in Target to the targets collection"," * @private"," * @method _regTarget"," * @param {Object} t The Target to add to the targets collection"," */"," _regTarget: function(t) {"," this.targets.push(t);"," },"," /**"," * Remove the passed in Target from the targets collection"," * @private"," * @method _unregTarget"," * @param {Object} drop The Target to remove from the targets collection"," */"," _unregTarget: function(drop) {"," var targets = [], vdrops;"," Y.Array.each(this.targets, function(v) {"," if (v !== drop) {"," targets.push(v);"," }"," }, this);"," this.targets = targets;",""," vdrops = [];"," Y.Array.each(this.validDrops, function(v) {"," if (v !== drop) {"," vdrops.push(v);"," }"," });",""," this.validDrops = vdrops;"," },"," /**"," * Get a valid Drop instance back from a Node or a selector string, false otherwise"," * @method getDrop"," * @param {String/Object} node The Node instance or Selector string to check for a valid Drop Object"," * @return {Object}"," */"," getDrop: function(node) {"," var drop = false,"," n = Y.one(node);"," if (n instanceof Y.Node) {"," Y.Array.each(this.targets, function(v) {"," if (n.compareTo(v.get('node'))) {"," drop = v;"," }"," });"," }"," return drop;"," }"," }, true);","","","","","}, '@VERSION@', {\"requires\": [\"dd-ddm\"]});","","}());"]}; +} +var __cov_o$ssUG$Zx$_5NVajDettpw = __coverage__['build/dd-ddm-drop/dd-ddm-drop.js']; +__cov_o$ssUG$Zx$_5NVajDettpw.s['1']++;YUI.add('dd-ddm-drop',function(Y,NAME){__cov_o$ssUG$Zx$_5NVajDettpw.f['1']++;__cov_o$ssUG$Zx$_5NVajDettpw.s['2']++;Y.mix(Y.DD.DDM,{_noShim:false,_activeShims:[],_hasActiveShim:function(){__cov_o$ssUG$Zx$_5NVajDettpw.f['2']++;__cov_o$ssUG$Zx$_5NVajDettpw.s['3']++;if(this._noShim){__cov_o$ssUG$Zx$_5NVajDettpw.b['1'][0]++;__cov_o$ssUG$Zx$_5NVajDettpw.s['4']++;return true;}else{__cov_o$ssUG$Zx$_5NVajDettpw.b['1'][1]++;}__cov_o$ssUG$Zx$_5NVajDettpw.s['5']++;return this._activeShims.length;},_addActiveShim:function(d){__cov_o$ssUG$Zx$_5NVajDettpw.f['3']++;__cov_o$ssUG$Zx$_5NVajDettpw.s['6']++;this._activeShims.push(d);},_removeActiveShim:function(d){__cov_o$ssUG$Zx$_5NVajDettpw.f['4']++;__cov_o$ssUG$Zx$_5NVajDettpw.s['7']++;var s=[];__cov_o$ssUG$Zx$_5NVajDettpw.s['8']++;Y.Array.each(this._activeShims,function(v){__cov_o$ssUG$Zx$_5NVajDettpw.f['5']++;__cov_o$ssUG$Zx$_5NVajDettpw.s['9']++;if(v._yuid!==d._yuid){__cov_o$ssUG$Zx$_5NVajDettpw.b['2'][0]++;__cov_o$ssUG$Zx$_5NVajDettpw.s['10']++;s.push(v);}else{__cov_o$ssUG$Zx$_5NVajDettpw.b['2'][1]++;}});__cov_o$ssUG$Zx$_5NVajDettpw.s['11']++;this._activeShims=s;},syncActiveShims:function(force){__cov_o$ssUG$Zx$_5NVajDettpw.f['6']++;__cov_o$ssUG$Zx$_5NVajDettpw.s['12']++;Y.later(0,this,function(force){__cov_o$ssUG$Zx$_5NVajDettpw.f['7']++;__cov_o$ssUG$Zx$_5NVajDettpw.s['13']++;var drops=force?(__cov_o$ssUG$Zx$_5NVajDettpw.b['3'][0]++,this.targets):(__cov_o$ssUG$Zx$_5NVajDettpw.b['3'][1]++,this._lookup());__cov_o$ssUG$Zx$_5NVajDettpw.s['14']++;Y.Array.each(drops,function(v){__cov_o$ssUG$Zx$_5NVajDettpw.f['8']++;__cov_o$ssUG$Zx$_5NVajDettpw.s['15']++;v.sizeShim.call(v);},this);},force);},mode:0,POINT:0,INTERSECT:1,STRICT:2,useHash:true,activeDrop:null,validDrops:[],otherDrops:{},targets:[],_addValid:function(drop){__cov_o$ssUG$Zx$_5NVajDettpw.f['9']++;__cov_o$ssUG$Zx$_5NVajDettpw.s['16']++;this.validDrops.push(drop);__cov_o$ssUG$Zx$_5NVajDettpw.s['17']++;return this;},_removeValid:function(drop){__cov_o$ssUG$Zx$_5NVajDettpw.f['10']++;__cov_o$ssUG$Zx$_5NVajDettpw.s['18']++;var drops=[];__cov_o$ssUG$Zx$_5NVajDettpw.s['19']++;Y.Array.each(this.validDrops,function(v){__cov_o$ssUG$Zx$_5NVajDettpw.f['11']++;__cov_o$ssUG$Zx$_5NVajDettpw.s['20']++;if(v!==drop){__cov_o$ssUG$Zx$_5NVajDettpw.b['4'][0]++;__cov_o$ssUG$Zx$_5NVajDettpw.s['21']++;drops.push(v);}else{__cov_o$ssUG$Zx$_5NVajDettpw.b['4'][1]++;}});__cov_o$ssUG$Zx$_5NVajDettpw.s['22']++;this.validDrops=drops;__cov_o$ssUG$Zx$_5NVajDettpw.s['23']++;return this;},isOverTarget:function(drop){__cov_o$ssUG$Zx$_5NVajDettpw.f['12']++;__cov_o$ssUG$Zx$_5NVajDettpw.s['24']++;if((__cov_o$ssUG$Zx$_5NVajDettpw.b['6'][0]++,this.activeDrag)&&(__cov_o$ssUG$Zx$_5NVajDettpw.b['6'][1]++,drop)){__cov_o$ssUG$Zx$_5NVajDettpw.b['5'][0]++;__cov_o$ssUG$Zx$_5NVajDettpw.s['25']++;var xy=this.activeDrag.mouseXY,r,dMode=this.activeDrag.get('dragMode'),aRegion,node=drop.shim;__cov_o$ssUG$Zx$_5NVajDettpw.s['26']++;if((__cov_o$ssUG$Zx$_5NVajDettpw.b['8'][0]++,xy)&&(__cov_o$ssUG$Zx$_5NVajDettpw.b['8'][1]++,this.activeDrag)){__cov_o$ssUG$Zx$_5NVajDettpw.b['7'][0]++;__cov_o$ssUG$Zx$_5NVajDettpw.s['27']++;aRegion=this.activeDrag.region;__cov_o$ssUG$Zx$_5NVajDettpw.s['28']++;if(dMode===this.STRICT){__cov_o$ssUG$Zx$_5NVajDettpw.b['9'][0]++;__cov_o$ssUG$Zx$_5NVajDettpw.s['29']++;return this.activeDrag.get('dragNode').inRegion(drop.region,true,aRegion);}else{__cov_o$ssUG$Zx$_5NVajDettpw.b['9'][1]++;}__cov_o$ssUG$Zx$_5NVajDettpw.s['30']++;if((__cov_o$ssUG$Zx$_5NVajDettpw.b['11'][0]++,drop)&&(__cov_o$ssUG$Zx$_5NVajDettpw.b['11'][1]++,drop.shim)){__cov_o$ssUG$Zx$_5NVajDettpw.b['10'][0]++;__cov_o$ssUG$Zx$_5NVajDettpw.s['31']++;if((__cov_o$ssUG$Zx$_5NVajDettpw.b['13'][0]++,dMode===this.INTERSECT)&&(__cov_o$ssUG$Zx$_5NVajDettpw.b['13'][1]++,this._noShim)){__cov_o$ssUG$Zx$_5NVajDettpw.b['12'][0]++;__cov_o$ssUG$Zx$_5NVajDettpw.s['32']++;r=(__cov_o$ssUG$Zx$_5NVajDettpw.b['14'][0]++,aRegion)||(__cov_o$ssUG$Zx$_5NVajDettpw.b['14'][1]++,this.activeDrag.get('node'));__cov_o$ssUG$Zx$_5NVajDettpw.s['33']++;return drop.get('node').intersect(r,drop.region).inRegion;}else{__cov_o$ssUG$Zx$_5NVajDettpw.b['12'][1]++;}__cov_o$ssUG$Zx$_5NVajDettpw.s['34']++;if(this._noShim){__cov_o$ssUG$Zx$_5NVajDettpw.b['15'][0]++;__cov_o$ssUG$Zx$_5NVajDettpw.s['35']++;node=drop.get('node');}else{__cov_o$ssUG$Zx$_5NVajDettpw.b['15'][1]++;}__cov_o$ssUG$Zx$_5NVajDettpw.s['36']++;return node.intersect({top:xy[1],bottom:xy[1],left:xy[0],right:xy[0]},drop.region).inRegion;}else{__cov_o$ssUG$Zx$_5NVajDettpw.b['10'][1]++;}}else{__cov_o$ssUG$Zx$_5NVajDettpw.b['7'][1]++;}}else{__cov_o$ssUG$Zx$_5NVajDettpw.b['5'][1]++;}__cov_o$ssUG$Zx$_5NVajDettpw.s['37']++;return false;},clearCache:function(){__cov_o$ssUG$Zx$_5NVajDettpw.f['13']++;__cov_o$ssUG$Zx$_5NVajDettpw.s['38']++;this.validDrops=[];__cov_o$ssUG$Zx$_5NVajDettpw.s['39']++;this.otherDrops={};__cov_o$ssUG$Zx$_5NVajDettpw.s['40']++;this._activeShims=[];},_activateTargets:function(){__cov_o$ssUG$Zx$_5NVajDettpw.f['14']++;__cov_o$ssUG$Zx$_5NVajDettpw.s['41']++;this._noShim=true;__cov_o$ssUG$Zx$_5NVajDettpw.s['42']++;this.clearCache();__cov_o$ssUG$Zx$_5NVajDettpw.s['43']++;Y.Array.each(this.targets,function(v){__cov_o$ssUG$Zx$_5NVajDettpw.f['15']++;__cov_o$ssUG$Zx$_5NVajDettpw.s['44']++;v._activateShim([]);__cov_o$ssUG$Zx$_5NVajDettpw.s['45']++;if(v.get('noShim')===true){__cov_o$ssUG$Zx$_5NVajDettpw.b['16'][0]++;__cov_o$ssUG$Zx$_5NVajDettpw.s['46']++;this._noShim=false;}else{__cov_o$ssUG$Zx$_5NVajDettpw.b['16'][1]++;}},this);__cov_o$ssUG$Zx$_5NVajDettpw.s['47']++;this._handleTargetOver();},getBestMatch:function(drops,all){__cov_o$ssUG$Zx$_5NVajDettpw.f['16']++;__cov_o$ssUG$Zx$_5NVajDettpw.s['48']++;var biggest=null,area=0,out;__cov_o$ssUG$Zx$_5NVajDettpw.s['49']++;Y.Object.each(drops,function(v){__cov_o$ssUG$Zx$_5NVajDettpw.f['17']++;__cov_o$ssUG$Zx$_5NVajDettpw.s['50']++;var inter=this.activeDrag.get('dragNode').intersect(v.get('node'));__cov_o$ssUG$Zx$_5NVajDettpw.s['51']++;v.region.area=inter.area;__cov_o$ssUG$Zx$_5NVajDettpw.s['52']++;if(inter.inRegion){__cov_o$ssUG$Zx$_5NVajDettpw.b['17'][0]++;__cov_o$ssUG$Zx$_5NVajDettpw.s['53']++;if(inter.area>area){__cov_o$ssUG$Zx$_5NVajDettpw.b['18'][0]++;__cov_o$ssUG$Zx$_5NVajDettpw.s['54']++;area=inter.area;__cov_o$ssUG$Zx$_5NVajDettpw.s['55']++;biggest=v;}else{__cov_o$ssUG$Zx$_5NVajDettpw.b['18'][1]++;}}else{__cov_o$ssUG$Zx$_5NVajDettpw.b['17'][1]++;}},this);__cov_o$ssUG$Zx$_5NVajDettpw.s['56']++;if(all){__cov_o$ssUG$Zx$_5NVajDettpw.b['19'][0]++;__cov_o$ssUG$Zx$_5NVajDettpw.s['57']++;out=[];__cov_o$ssUG$Zx$_5NVajDettpw.s['58']++;Y.Object.each(drops,function(v){__cov_o$ssUG$Zx$_5NVajDettpw.f['18']++;__cov_o$ssUG$Zx$_5NVajDettpw.s['59']++;if(v!==biggest){__cov_o$ssUG$Zx$_5NVajDettpw.b['20'][0]++;__cov_o$ssUG$Zx$_5NVajDettpw.s['60']++;out.push(v);}else{__cov_o$ssUG$Zx$_5NVajDettpw.b['20'][1]++;}},this);__cov_o$ssUG$Zx$_5NVajDettpw.s['61']++;return[biggest,out];}else{__cov_o$ssUG$Zx$_5NVajDettpw.b['19'][1]++;}__cov_o$ssUG$Zx$_5NVajDettpw.s['62']++;return biggest;},_deactivateTargets:function(){__cov_o$ssUG$Zx$_5NVajDettpw.f['19']++;__cov_o$ssUG$Zx$_5NVajDettpw.s['63']++;var other=[],tmp,activeDrag=this.activeDrag,activeDrop=this.activeDrop;__cov_o$ssUG$Zx$_5NVajDettpw.s['64']++;if((__cov_o$ssUG$Zx$_5NVajDettpw.b['22'][0]++,activeDrag)&&(__cov_o$ssUG$Zx$_5NVajDettpw.b['22'][1]++,activeDrop)&&(__cov_o$ssUG$Zx$_5NVajDettpw.b['22'][2]++,this.otherDrops[activeDrop])){__cov_o$ssUG$Zx$_5NVajDettpw.b['21'][0]++;__cov_o$ssUG$Zx$_5NVajDettpw.s['65']++;if(!activeDrag.get('dragMode')){__cov_o$ssUG$Zx$_5NVajDettpw.b['23'][0]++;__cov_o$ssUG$Zx$_5NVajDettpw.s['66']++;other=this.otherDrops;__cov_o$ssUG$Zx$_5NVajDettpw.s['67']++;delete other[activeDrop];}else{__cov_o$ssUG$Zx$_5NVajDettpw.b['23'][1]++;__cov_o$ssUG$Zx$_5NVajDettpw.s['68']++;tmp=this.getBestMatch(this.otherDrops,true);__cov_o$ssUG$Zx$_5NVajDettpw.s['69']++;activeDrop=tmp[0];__cov_o$ssUG$Zx$_5NVajDettpw.s['70']++;other=tmp[1];}__cov_o$ssUG$Zx$_5NVajDettpw.s['71']++;activeDrag.get('node').removeClass(this.CSS_PREFIX+'-drag-over');__cov_o$ssUG$Zx$_5NVajDettpw.s['72']++;if(activeDrop){__cov_o$ssUG$Zx$_5NVajDettpw.b['24'][0]++;__cov_o$ssUG$Zx$_5NVajDettpw.s['73']++;activeDrop.fire('drop:hit',{drag:activeDrag,drop:activeDrop,others:other});__cov_o$ssUG$Zx$_5NVajDettpw.s['74']++;activeDrag.fire('drag:drophit',{drag:activeDrag,drop:activeDrop,others:other});}else{__cov_o$ssUG$Zx$_5NVajDettpw.b['24'][1]++;}}else{__cov_o$ssUG$Zx$_5NVajDettpw.b['21'][1]++;__cov_o$ssUG$Zx$_5NVajDettpw.s['75']++;if((__cov_o$ssUG$Zx$_5NVajDettpw.b['26'][0]++,activeDrag)&&(__cov_o$ssUG$Zx$_5NVajDettpw.b['26'][1]++,activeDrag.get('dragging'))){__cov_o$ssUG$Zx$_5NVajDettpw.b['25'][0]++;__cov_o$ssUG$Zx$_5NVajDettpw.s['76']++;activeDrag.get('node').removeClass(this.CSS_PREFIX+'-drag-over');__cov_o$ssUG$Zx$_5NVajDettpw.s['77']++;activeDrag.fire('drag:dropmiss',{pageX:activeDrag.lastXY[0],pageY:activeDrag.lastXY[1]});}else{__cov_o$ssUG$Zx$_5NVajDettpw.b['25'][1]++;}}__cov_o$ssUG$Zx$_5NVajDettpw.s['78']++;this.activeDrop=null;__cov_o$ssUG$Zx$_5NVajDettpw.s['79']++;Y.Array.each(this.targets,function(v){__cov_o$ssUG$Zx$_5NVajDettpw.f['20']++;__cov_o$ssUG$Zx$_5NVajDettpw.s['80']++;v._deactivateShim([]);},this);},_dropMove:function(){__cov_o$ssUG$Zx$_5NVajDettpw.f['21']++;__cov_o$ssUG$Zx$_5NVajDettpw.s['81']++;if(this._hasActiveShim()){__cov_o$ssUG$Zx$_5NVajDettpw.b['27'][0]++;__cov_o$ssUG$Zx$_5NVajDettpw.s['82']++;this._handleTargetOver();}else{__cov_o$ssUG$Zx$_5NVajDettpw.b['27'][1]++;__cov_o$ssUG$Zx$_5NVajDettpw.s['83']++;Y.Object.each(this.otherDrops,function(v){__cov_o$ssUG$Zx$_5NVajDettpw.f['22']++;__cov_o$ssUG$Zx$_5NVajDettpw.s['84']++;v._handleOut.apply(v,[]);});}},_lookup:function(){__cov_o$ssUG$Zx$_5NVajDettpw.f['23']++;__cov_o$ssUG$Zx$_5NVajDettpw.s['85']++;if((__cov_o$ssUG$Zx$_5NVajDettpw.b['29'][0]++,!this.useHash)||(__cov_o$ssUG$Zx$_5NVajDettpw.b['29'][1]++,this._noShim)){__cov_o$ssUG$Zx$_5NVajDettpw.b['28'][0]++;__cov_o$ssUG$Zx$_5NVajDettpw.s['86']++;return this.validDrops;}else{__cov_o$ssUG$Zx$_5NVajDettpw.b['28'][1]++;}__cov_o$ssUG$Zx$_5NVajDettpw.s['87']++;var drops=[];__cov_o$ssUG$Zx$_5NVajDettpw.s['88']++;Y.Array.each(this.validDrops,function(v){__cov_o$ssUG$Zx$_5NVajDettpw.f['24']++;__cov_o$ssUG$Zx$_5NVajDettpw.s['89']++;if((__cov_o$ssUG$Zx$_5NVajDettpw.b['31'][0]++,v.shim)&&(__cov_o$ssUG$Zx$_5NVajDettpw.b['31'][1]++,v.shim.inViewportRegion(false,v.region))){__cov_o$ssUG$Zx$_5NVajDettpw.b['30'][0]++;__cov_o$ssUG$Zx$_5NVajDettpw.s['90']++;drops.push(v);}else{__cov_o$ssUG$Zx$_5NVajDettpw.b['30'][1]++;}});__cov_o$ssUG$Zx$_5NVajDettpw.s['91']++;return drops;},_handleTargetOver:function(){__cov_o$ssUG$Zx$_5NVajDettpw.f['25']++;__cov_o$ssUG$Zx$_5NVajDettpw.s['92']++;var drops=this._lookup();__cov_o$ssUG$Zx$_5NVajDettpw.s['93']++;Y.Array.each(drops,function(v){__cov_o$ssUG$Zx$_5NVajDettpw.f['26']++;__cov_o$ssUG$Zx$_5NVajDettpw.s['94']++;v._handleTargetOver.call(v);},this);},_regTarget:function(t){__cov_o$ssUG$Zx$_5NVajDettpw.f['27']++;__cov_o$ssUG$Zx$_5NVajDettpw.s['95']++;this.targets.push(t);},_unregTarget:function(drop){__cov_o$ssUG$Zx$_5NVajDettpw.f['28']++;__cov_o$ssUG$Zx$_5NVajDettpw.s['96']++;var targets=[],vdrops;__cov_o$ssUG$Zx$_5NVajDettpw.s['97']++;Y.Array.each(this.targets,function(v){__cov_o$ssUG$Zx$_5NVajDettpw.f['29']++;__cov_o$ssUG$Zx$_5NVajDettpw.s['98']++;if(v!==drop){__cov_o$ssUG$Zx$_5NVajDettpw.b['32'][0]++;__cov_o$ssUG$Zx$_5NVajDettpw.s['99']++;targets.push(v);}else{__cov_o$ssUG$Zx$_5NVajDettpw.b['32'][1]++;}},this);__cov_o$ssUG$Zx$_5NVajDettpw.s['100']++;this.targets=targets;__cov_o$ssUG$Zx$_5NVajDettpw.s['101']++;vdrops=[];__cov_o$ssUG$Zx$_5NVajDettpw.s['102']++;Y.Array.each(this.validDrops,function(v){__cov_o$ssUG$Zx$_5NVajDettpw.f['30']++;__cov_o$ssUG$Zx$_5NVajDettpw.s['103']++;if(v!==drop){__cov_o$ssUG$Zx$_5NVajDettpw.b['33'][0]++;__cov_o$ssUG$Zx$_5NVajDettpw.s['104']++;vdrops.push(v);}else{__cov_o$ssUG$Zx$_5NVajDettpw.b['33'][1]++;}});__cov_o$ssUG$Zx$_5NVajDettpw.s['105']++;this.validDrops=vdrops;},getDrop:function(node){__cov_o$ssUG$Zx$_5NVajDettpw.f['31']++;__cov_o$ssUG$Zx$_5NVajDettpw.s['106']++;var drop=false,n=Y.one(node);__cov_o$ssUG$Zx$_5NVajDettpw.s['107']++;if(n instanceof Y.Node){__cov_o$ssUG$Zx$_5NVajDettpw.b['34'][0]++;__cov_o$ssUG$Zx$_5NVajDettpw.s['108']++;Y.Array.each(this.targets,function(v){__cov_o$ssUG$Zx$_5NVajDettpw.f['32']++;__cov_o$ssUG$Zx$_5NVajDettpw.s['109']++;if(n.compareTo(v.get('node'))){__cov_o$ssUG$Zx$_5NVajDettpw.b['35'][0]++;__cov_o$ssUG$Zx$_5NVajDettpw.s['110']++;drop=v;}else{__cov_o$ssUG$Zx$_5NVajDettpw.b['35'][1]++;}});}else{__cov_o$ssUG$Zx$_5NVajDettpw.b['34'][1]++;}__cov_o$ssUG$Zx$_5NVajDettpw.s['111']++;return drop;}},true);},'@VERSION@',{'requires':['dd-ddm']}); diff --git a/src/build/dd-ddm-drop/dd-ddm-drop-debug.js b/src/build/dd-ddm-drop/dd-ddm-drop-debug.js new file mode 100644 index 00000000000..ffd9564caf8 --- /dev/null +++ b/src/build/dd-ddm-drop/dd-ddm-drop-debug.js @@ -0,0 +1,399 @@ +YUI.add('dd-ddm-drop', function (Y, NAME) { + + + /** + * Extends the dd-ddm Class to add support for the placement of Drop Target + * shims inside the viewport shim. It also handles all Drop Target related events and interactions. + * @module dd + * @submodule dd-ddm-drop + * @for DDM + * @namespace DD + */ + + //TODO CSS class name for the bestMatch.. + Y.mix(Y.DD.DDM, { + /** + * This flag turns off the use of the mouseover/mouseout shim. It should not be used unless you know what you are doing. + * @private + * @property _noShim + * @type {Boolean} + */ + _noShim: false, + /** + * Placeholder for all active shims on the page + * @private + * @property _activeShims + * @type {Array} + */ + _activeShims: [], + /** + * This method checks the _activeShims Object to see if there is a shim active. + * @private + * @method _hasActiveShim + * @return {Boolean} + */ + _hasActiveShim: function() { + if (this._noShim) { + return true; + } + return this._activeShims.length; + }, + /** + * Adds a Drop Target to the list of active shims + * @private + * @method _addActiveShim + * @param {Object} d The Drop instance to add to the list. + */ + _addActiveShim: function(d) { + this._activeShims.push(d); + }, + /** + * Removes a Drop Target to the list of active shims + * @private + * @method _removeActiveShim + * @param {Object} d The Drop instance to remove from the list. + */ + _removeActiveShim: function(d) { + var s = []; + Y.Array.each(this._activeShims, function(v) { + if (v._yuid !== d._yuid) { + s.push(v); + } + + }); + this._activeShims = s; + }, + /** + * This method will sync the position of the shims on the Drop Targets that are currently active. + * @method syncActiveShims + * @param {Boolean} force Resize/sync all Targets. + */ + syncActiveShims: function(force) { + Y.later(0, this, function(force) { + var drops = ((force) ? this.targets : this._lookup()); + Y.Array.each(drops, function(v) { + v.sizeShim.call(v); + }, this); + }, force); + }, + /** + * The mode that the drag operations will run in 0 for Point, 1 for Intersect, 2 for Strict + * @private + * @property mode + * @type Number + */ + mode: 0, + /** + * In point mode, a Drop is targeted by the cursor being over the Target + * @private + * @property POINT + * @type Number + */ + POINT: 0, + /** + * In intersect mode, a Drop is targeted by "part" of the drag node being over the Target + * @private + * @property INTERSECT + * @type Number + */ + INTERSECT: 1, + /** + * In strict mode, a Drop is targeted by the "entire" drag node being over the Target + * @private + * @property STRICT + * @type Number + */ + STRICT: 2, + /** + * Should we only check targets that are in the viewport on drags (for performance), default: true + * @property useHash + * @type {Boolean} + */ + useHash: true, + /** + * A reference to the active Drop Target + * @property activeDrop + * @type {Object} + */ + activeDrop: null, + /** + * An array of the valid Drop Targets for this interaction. + * @property validDrops + * @type {Array} + */ + //TODO Change array/object literals to be in sync.. + validDrops: [], + /** + * An object literal of Other Drop Targets that we encountered during this interaction (in the case of overlapping Drop Targets) + * @property otherDrops + * @type {Object} + */ + otherDrops: {}, + /** + * All of the Targets + * @property targets + * @type {Array} + */ + targets: [], + /** + * Add a Drop Target to the list of Valid Targets. This list get's regenerated on each new drag operation. + * @private + * @method _addValid + * @param {Object} drop + * @chainable + */ + _addValid: function(drop) { + this.validDrops.push(drop); + return this; + }, + /** + * Removes a Drop Target from the list of Valid Targets. This list get's regenerated on each new drag operation. + * @private + * @method _removeValid + * @param {Object} drop + * @chainable + */ + _removeValid: function(drop) { + var drops = []; + Y.Array.each(this.validDrops, function(v) { + if (v !== drop) { + drops.push(v); + } + }); + + this.validDrops = drops; + return this; + }, + /** + * Check to see if the Drag element is over the target, method varies on current mode + * @method isOverTarget + * @param {Object} drop The drop to check against + * @return {Boolean} + */ + isOverTarget: function(drop) { + if (this.activeDrag && drop) { + var xy = this.activeDrag.mouseXY, r, dMode = this.activeDrag.get('dragMode'), + aRegion, node = drop.shim; + if (xy && this.activeDrag) { + aRegion = this.activeDrag.region; + if (dMode === this.STRICT) { + return this.activeDrag.get('dragNode').inRegion(drop.region, true, aRegion); + } + if (drop && drop.shim) { + if ((dMode === this.INTERSECT) && this._noShim) { + r = aRegion || this.activeDrag.get('node'); + return drop.get('node').intersect(r, drop.region).inRegion; + } + + if (this._noShim) { + node = drop.get('node'); + } + return node.intersect({ + top: xy[1], + bottom: xy[1], + left: xy[0], + right: xy[0] + }, drop.region).inRegion; + } + } + } + return false; + }, + /** + * Clears the cache data used for this interaction. + * @method clearCache + */ + clearCache: function() { + this.validDrops = []; + this.otherDrops = {}; + this._activeShims = []; + }, + /** + * Clear the cache and activate the shims of all the targets + * @private + * @method _activateTargets + */ + _activateTargets: function() { + this._noShim = true; + this.clearCache(); + Y.Array.each(this.targets, function(v) { + v._activateShim([]); + if (v.get('noShim') === true) { + this._noShim = false; + } + }, this); + this._handleTargetOver(); + + }, + /** + * This method will gather the area for all potential targets and see which has the hightest covered area and return it. + * @method getBestMatch + * @param {Array} drops An Array of drops to scan for the best match. + * @param {Boolean} all If present, it returns an Array. First item is best match, second is an Array of the other items in the original Array. + * @return {Object or Array} + */ + getBestMatch: function(drops, all) { + var biggest = null, area = 0, out; + + Y.Object.each(drops, function(v) { + var inter = this.activeDrag.get('dragNode').intersect(v.get('node')); + v.region.area = inter.area; + + if (inter.inRegion) { + if (inter.area > area) { + area = inter.area; + biggest = v; + } + } + }, this); + if (all) { + out = []; + //TODO Sort the others in numeric order by area covered.. + Y.Object.each(drops, function(v) { + if (v !== biggest) { + out.push(v); + } + }, this); + return [biggest, out]; + } + return biggest; + }, + /** + * This method fires the drop:hit, drag:drophit, drag:dropmiss methods and deactivates the shims.. + * @private + * @method _deactivateTargets + */ + _deactivateTargets: function() { + var other = [], tmp, + activeDrag = this.activeDrag, + activeDrop = this.activeDrop; + + //TODO why is this check so hard?? + if (activeDrag && activeDrop && this.otherDrops[activeDrop]) { + if (!activeDrag.get('dragMode')) { + //TODO otherDrops -- private.. + other = this.otherDrops; + delete other[activeDrop]; + } else { + tmp = this.getBestMatch(this.otherDrops, true); + activeDrop = tmp[0]; + other = tmp[1]; + } + activeDrag.get('node').removeClass(this.CSS_PREFIX + '-drag-over'); + if (activeDrop) { + activeDrop.fire('drop:hit', { drag: activeDrag, drop: activeDrop, others: other }); + activeDrag.fire('drag:drophit', { drag: activeDrag, drop: activeDrop, others: other }); + } + } else if (activeDrag && activeDrag.get('dragging')) { + activeDrag.get('node').removeClass(this.CSS_PREFIX + '-drag-over'); + activeDrag.fire('drag:dropmiss', { pageX: activeDrag.lastXY[0], pageY: activeDrag.lastXY[1] }); + } + + this.activeDrop = null; + + Y.Array.each(this.targets, function(v) { + v._deactivateShim([]); + }, this); + }, + /** + * This method is called when the move method is called on the Drag Object. + * @private + * @method _dropMove + */ + _dropMove: function() { + if (this._hasActiveShim()) { + this._handleTargetOver(); + } else { + Y.Object.each(this.otherDrops, function(v) { + v._handleOut.apply(v, []); + }); + } + }, + /** + * Filters the list of Drops down to those in the viewport. + * @private + * @method _lookup + * @return {Array} The valid Drop Targets that are in the viewport. + */ + _lookup: function() { + if (!this.useHash || this._noShim) { + return this.validDrops; + } + var drops = []; + //Only scan drop shims that are in the Viewport + Y.Array.each(this.validDrops, function(v) { + if (v.shim && v.shim.inViewportRegion(false, v.region)) { + drops.push(v); + } + }); + return drops; + + }, + /** + * This method execs _handleTargetOver on all valid Drop Targets + * @private + * @method _handleTargetOver + */ + _handleTargetOver: function() { + var drops = this._lookup(); + Y.Array.each(drops, function(v) { + v._handleTargetOver.call(v); + }, this); + }, + /** + * Add the passed in Target to the targets collection + * @private + * @method _regTarget + * @param {Object} t The Target to add to the targets collection + */ + _regTarget: function(t) { + this.targets.push(t); + }, + /** + * Remove the passed in Target from the targets collection + * @private + * @method _unregTarget + * @param {Object} drop The Target to remove from the targets collection + */ + _unregTarget: function(drop) { + var targets = [], vdrops; + Y.Array.each(this.targets, function(v) { + if (v !== drop) { + targets.push(v); + } + }, this); + this.targets = targets; + + vdrops = []; + Y.Array.each(this.validDrops, function(v) { + if (v !== drop) { + vdrops.push(v); + } + }); + + this.validDrops = vdrops; + }, + /** + * Get a valid Drop instance back from a Node or a selector string, false otherwise + * @method getDrop + * @param {String/Object} node The Node instance or Selector string to check for a valid Drop Object + * @return {Object} + */ + getDrop: function(node) { + var drop = false, + n = Y.one(node); + if (n instanceof Y.Node) { + Y.Array.each(this.targets, function(v) { + if (n.compareTo(v.get('node'))) { + drop = v; + } + }); + } + return drop; + } + }, true); + + + + +}, '@VERSION@', {"requires": ["dd-ddm"]}); diff --git a/src/build/dd-ddm-drop/dd-ddm-drop-min.js b/src/build/dd-ddm-drop/dd-ddm-drop-min.js new file mode 100644 index 00000000000..a1376102bcf --- /dev/null +++ b/src/build/dd-ddm-drop/dd-ddm-drop-min.js @@ -0,0 +1 @@ +YUI.add("dd-ddm-drop",function(e,t){e.mix(e.DD.DDM,{_noShim:!1,_activeShims:[],_hasActiveShim:function(){return this._noShim?!0:this._activeShims.length},_addActiveShim:function(e){this._activeShims.push(e)},_removeActiveShim:function(t){var n=[];e.Array.each(this._activeShims,function(e){e._yuid!==t._yuid&&n.push(e)}),this._activeShims=n},syncActiveShims:function(t){e.later(0,this,function(t){var n=t?this.targets:this._lookup();e.Array.each(n,function(e){e.sizeShim.call(e)},this)},t)},mode:0,POINT:0,INTERSECT:1,STRICT:2,useHash:!0,activeDrop:null,validDrops:[],otherDrops:{},targets:[],_addValid:function(e){return this.validDrops.push(e),this},_removeValid:function(t){var n=[];return e.Array.each(this.validDrops,function(e){e!==t&&n.push(e)}),this.validDrops=n,this},isOverTarget:function(e){if(this.activeDrag&&e){var t=this.activeDrag.mouseXY,n,r=this.activeDrag.get("dragMode"),i,s=e.shim;if(t&&this.activeDrag){i=this.activeDrag.region;if(r===this.STRICT)return this.activeDrag.get("dragNode").inRegion(e.region,!0,i);if(e&&e.shim)return r===this.INTERSECT&&this._noShim?(n=i||this.activeDrag.get("node"),e.get("node").intersect(n,e.region).inRegion):(this._noShim&&(s=e.get("node")),s.intersect({top:t[1],bottom:t[1],left:t[0],right:t[0]},e.region).inRegion)}}return!1},clearCache:function(){this.validDrops=[],this.otherDrops={},this._activeShims=[]},_activateTargets:function(){this._noShim=!0,this.clearCache(),e.Array.each(this.targets,function(e){e._activateShim([]),e.get("noShim")===!0&&(this._noShim=!1)},this),this._handleTargetOver()},getBestMatch:function(t,n){var r=null,i=0,s;return e.Object.each(t,function(e){var t=this.activeDrag.get("dragNode").intersect(e.get("node"));e.region.area=t.area,t.inRegion&&t.area>i&&(i=t.area,r=e)},this),n?(s=[],e.Object.each(t,function(e){e!==r&&s.push(e)},this),[r,s]):r},_deactivateTargets:function(){var t=[],n,r=this.activeDrag,i=this.activeDrop;r&&i&&this.otherDrops[i]?(r.get("dragMode")?(n=this.getBestMatch(this.otherDrops,!0),i=n[0],t=n[1]):(t=this.otherDrops,delete t[i]),r.get("node").removeClass(this.CSS_PREFIX+"-drag-over"),i&&(i.fire("drop:hit",{drag:r,drop:i,others:t}),r.fire("drag:drophit",{drag:r,drop:i,others:t}))):r&&r.get("dragging")&&(r.get("node").removeClass(this.CSS_PREFIX+"-drag-over"),r.fire("drag:dropmiss",{pageX:r.lastXY[0],pageY:r.lastXY[1]})),this.activeDrop=null,e.Array.each(this.targets,function(e){e._deactivateShim([])},this)},_dropMove:function(){this._hasActiveShim()?this._handleTargetOver():e.Object.each(this.otherDrops,function(e){e._handleOut.apply(e,[])})},_lookup:function(){if(!this.useHash||this._noShim)return this.validDrops;var t=[];return e.Array.each(this.validDrops,function(e){e.shim&&e.shim.inViewportRegion(!1,e.region)&&t.push(e)}),t},_handleTargetOver:function(){var t=this._lookup();e.Array.each(t,function(e){e._handleTargetOver.call(e)},this)},_regTarget:function(e){this.targets.push(e)},_unregTarget:function(t){var n=[],r;e.Array.each(this.targets,function(e){e!==t&&n.push(e)},this),this.targets=n,r=[],e.Array.each(this.validDrops,function(e){e!==t&&r.push(e)}),this.validDrops=r},getDrop:function(t){var n=!1,r=e.one(t);return r instanceof e.Node&&e.Array.each(this.targets,function(e){r.compareTo(e.get("node"))&&(n=e)}),n}},!0)},"@VERSION@",{requires:["dd-ddm"]}); diff --git a/src/build/dd-ddm-drop/dd-ddm-drop.js b/src/build/dd-ddm-drop/dd-ddm-drop.js new file mode 100644 index 00000000000..ffd9564caf8 --- /dev/null +++ b/src/build/dd-ddm-drop/dd-ddm-drop.js @@ -0,0 +1,399 @@ +YUI.add('dd-ddm-drop', function (Y, NAME) { + + + /** + * Extends the dd-ddm Class to add support for the placement of Drop Target + * shims inside the viewport shim. It also handles all Drop Target related events and interactions. + * @module dd + * @submodule dd-ddm-drop + * @for DDM + * @namespace DD + */ + + //TODO CSS class name for the bestMatch.. + Y.mix(Y.DD.DDM, { + /** + * This flag turns off the use of the mouseover/mouseout shim. It should not be used unless you know what you are doing. + * @private + * @property _noShim + * @type {Boolean} + */ + _noShim: false, + /** + * Placeholder for all active shims on the page + * @private + * @property _activeShims + * @type {Array} + */ + _activeShims: [], + /** + * This method checks the _activeShims Object to see if there is a shim active. + * @private + * @method _hasActiveShim + * @return {Boolean} + */ + _hasActiveShim: function() { + if (this._noShim) { + return true; + } + return this._activeShims.length; + }, + /** + * Adds a Drop Target to the list of active shims + * @private + * @method _addActiveShim + * @param {Object} d The Drop instance to add to the list. + */ + _addActiveShim: function(d) { + this._activeShims.push(d); + }, + /** + * Removes a Drop Target to the list of active shims + * @private + * @method _removeActiveShim + * @param {Object} d The Drop instance to remove from the list. + */ + _removeActiveShim: function(d) { + var s = []; + Y.Array.each(this._activeShims, function(v) { + if (v._yuid !== d._yuid) { + s.push(v); + } + + }); + this._activeShims = s; + }, + /** + * This method will sync the position of the shims on the Drop Targets that are currently active. + * @method syncActiveShims + * @param {Boolean} force Resize/sync all Targets. + */ + syncActiveShims: function(force) { + Y.later(0, this, function(force) { + var drops = ((force) ? this.targets : this._lookup()); + Y.Array.each(drops, function(v) { + v.sizeShim.call(v); + }, this); + }, force); + }, + /** + * The mode that the drag operations will run in 0 for Point, 1 for Intersect, 2 for Strict + * @private + * @property mode + * @type Number + */ + mode: 0, + /** + * In point mode, a Drop is targeted by the cursor being over the Target + * @private + * @property POINT + * @type Number + */ + POINT: 0, + /** + * In intersect mode, a Drop is targeted by "part" of the drag node being over the Target + * @private + * @property INTERSECT + * @type Number + */ + INTERSECT: 1, + /** + * In strict mode, a Drop is targeted by the "entire" drag node being over the Target + * @private + * @property STRICT + * @type Number + */ + STRICT: 2, + /** + * Should we only check targets that are in the viewport on drags (for performance), default: true + * @property useHash + * @type {Boolean} + */ + useHash: true, + /** + * A reference to the active Drop Target + * @property activeDrop + * @type {Object} + */ + activeDrop: null, + /** + * An array of the valid Drop Targets for this interaction. + * @property validDrops + * @type {Array} + */ + //TODO Change array/object literals to be in sync.. + validDrops: [], + /** + * An object literal of Other Drop Targets that we encountered during this interaction (in the case of overlapping Drop Targets) + * @property otherDrops + * @type {Object} + */ + otherDrops: {}, + /** + * All of the Targets + * @property targets + * @type {Array} + */ + targets: [], + /** + * Add a Drop Target to the list of Valid Targets. This list get's regenerated on each new drag operation. + * @private + * @method _addValid + * @param {Object} drop + * @chainable + */ + _addValid: function(drop) { + this.validDrops.push(drop); + return this; + }, + /** + * Removes a Drop Target from the list of Valid Targets. This list get's regenerated on each new drag operation. + * @private + * @method _removeValid + * @param {Object} drop + * @chainable + */ + _removeValid: function(drop) { + var drops = []; + Y.Array.each(this.validDrops, function(v) { + if (v !== drop) { + drops.push(v); + } + }); + + this.validDrops = drops; + return this; + }, + /** + * Check to see if the Drag element is over the target, method varies on current mode + * @method isOverTarget + * @param {Object} drop The drop to check against + * @return {Boolean} + */ + isOverTarget: function(drop) { + if (this.activeDrag && drop) { + var xy = this.activeDrag.mouseXY, r, dMode = this.activeDrag.get('dragMode'), + aRegion, node = drop.shim; + if (xy && this.activeDrag) { + aRegion = this.activeDrag.region; + if (dMode === this.STRICT) { + return this.activeDrag.get('dragNode').inRegion(drop.region, true, aRegion); + } + if (drop && drop.shim) { + if ((dMode === this.INTERSECT) && this._noShim) { + r = aRegion || this.activeDrag.get('node'); + return drop.get('node').intersect(r, drop.region).inRegion; + } + + if (this._noShim) { + node = drop.get('node'); + } + return node.intersect({ + top: xy[1], + bottom: xy[1], + left: xy[0], + right: xy[0] + }, drop.region).inRegion; + } + } + } + return false; + }, + /** + * Clears the cache data used for this interaction. + * @method clearCache + */ + clearCache: function() { + this.validDrops = []; + this.otherDrops = {}; + this._activeShims = []; + }, + /** + * Clear the cache and activate the shims of all the targets + * @private + * @method _activateTargets + */ + _activateTargets: function() { + this._noShim = true; + this.clearCache(); + Y.Array.each(this.targets, function(v) { + v._activateShim([]); + if (v.get('noShim') === true) { + this._noShim = false; + } + }, this); + this._handleTargetOver(); + + }, + /** + * This method will gather the area for all potential targets and see which has the hightest covered area and return it. + * @method getBestMatch + * @param {Array} drops An Array of drops to scan for the best match. + * @param {Boolean} all If present, it returns an Array. First item is best match, second is an Array of the other items in the original Array. + * @return {Object or Array} + */ + getBestMatch: function(drops, all) { + var biggest = null, area = 0, out; + + Y.Object.each(drops, function(v) { + var inter = this.activeDrag.get('dragNode').intersect(v.get('node')); + v.region.area = inter.area; + + if (inter.inRegion) { + if (inter.area > area) { + area = inter.area; + biggest = v; + } + } + }, this); + if (all) { + out = []; + //TODO Sort the others in numeric order by area covered.. + Y.Object.each(drops, function(v) { + if (v !== biggest) { + out.push(v); + } + }, this); + return [biggest, out]; + } + return biggest; + }, + /** + * This method fires the drop:hit, drag:drophit, drag:dropmiss methods and deactivates the shims.. + * @private + * @method _deactivateTargets + */ + _deactivateTargets: function() { + var other = [], tmp, + activeDrag = this.activeDrag, + activeDrop = this.activeDrop; + + //TODO why is this check so hard?? + if (activeDrag && activeDrop && this.otherDrops[activeDrop]) { + if (!activeDrag.get('dragMode')) { + //TODO otherDrops -- private.. + other = this.otherDrops; + delete other[activeDrop]; + } else { + tmp = this.getBestMatch(this.otherDrops, true); + activeDrop = tmp[0]; + other = tmp[1]; + } + activeDrag.get('node').removeClass(this.CSS_PREFIX + '-drag-over'); + if (activeDrop) { + activeDrop.fire('drop:hit', { drag: activeDrag, drop: activeDrop, others: other }); + activeDrag.fire('drag:drophit', { drag: activeDrag, drop: activeDrop, others: other }); + } + } else if (activeDrag && activeDrag.get('dragging')) { + activeDrag.get('node').removeClass(this.CSS_PREFIX + '-drag-over'); + activeDrag.fire('drag:dropmiss', { pageX: activeDrag.lastXY[0], pageY: activeDrag.lastXY[1] }); + } + + this.activeDrop = null; + + Y.Array.each(this.targets, function(v) { + v._deactivateShim([]); + }, this); + }, + /** + * This method is called when the move method is called on the Drag Object. + * @private + * @method _dropMove + */ + _dropMove: function() { + if (this._hasActiveShim()) { + this._handleTargetOver(); + } else { + Y.Object.each(this.otherDrops, function(v) { + v._handleOut.apply(v, []); + }); + } + }, + /** + * Filters the list of Drops down to those in the viewport. + * @private + * @method _lookup + * @return {Array} The valid Drop Targets that are in the viewport. + */ + _lookup: function() { + if (!this.useHash || this._noShim) { + return this.validDrops; + } + var drops = []; + //Only scan drop shims that are in the Viewport + Y.Array.each(this.validDrops, function(v) { + if (v.shim && v.shim.inViewportRegion(false, v.region)) { + drops.push(v); + } + }); + return drops; + + }, + /** + * This method execs _handleTargetOver on all valid Drop Targets + * @private + * @method _handleTargetOver + */ + _handleTargetOver: function() { + var drops = this._lookup(); + Y.Array.each(drops, function(v) { + v._handleTargetOver.call(v); + }, this); + }, + /** + * Add the passed in Target to the targets collection + * @private + * @method _regTarget + * @param {Object} t The Target to add to the targets collection + */ + _regTarget: function(t) { + this.targets.push(t); + }, + /** + * Remove the passed in Target from the targets collection + * @private + * @method _unregTarget + * @param {Object} drop The Target to remove from the targets collection + */ + _unregTarget: function(drop) { + var targets = [], vdrops; + Y.Array.each(this.targets, function(v) { + if (v !== drop) { + targets.push(v); + } + }, this); + this.targets = targets; + + vdrops = []; + Y.Array.each(this.validDrops, function(v) { + if (v !== drop) { + vdrops.push(v); + } + }); + + this.validDrops = vdrops; + }, + /** + * Get a valid Drop instance back from a Node or a selector string, false otherwise + * @method getDrop + * @param {String/Object} node The Node instance or Selector string to check for a valid Drop Object + * @return {Object} + */ + getDrop: function(node) { + var drop = false, + n = Y.one(node); + if (n instanceof Y.Node) { + Y.Array.each(this.targets, function(v) { + if (n.compareTo(v.get('node'))) { + drop = v; + } + }); + } + return drop; + } + }, true); + + + + +}, '@VERSION@', {"requires": ["dd-ddm"]}); diff --git a/src/build/dd-ddm/dd-ddm-coverage.js b/src/build/dd-ddm/dd-ddm-coverage.js new file mode 100644 index 00000000000..839e7b234ba --- /dev/null +++ b/src/build/dd-ddm/dd-ddm-coverage.js @@ -0,0 +1,6 @@ +if (typeof __coverage__ === 'undefined') { __coverage__ = {}; } +if (!__coverage__['build/dd-ddm/dd-ddm.js']) { + __coverage__['build/dd-ddm/dd-ddm.js'] = {"path":"build/dd-ddm/dd-ddm.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0},"b":{"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0]},"f":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":37}}},"2":{"name":"(anonymous_2)","line":28,"loc":{"start":{"line":28,"column":26},"end":{"line":28,"column":37}}},"3":{"name":"(anonymous_3)","line":29,"loc":{"start":{"line":29,"column":28},"end":{"line":29,"column":39}}},"4":{"name":"(anonymous_4)","line":30,"loc":{"start":{"line":30,"column":20},"end":{"line":30,"column":31}}},"5":{"name":"(anonymous_5)","line":37,"loc":{"start":{"line":37,"column":18},"end":{"line":37,"column":29}}},"6":{"name":"(anonymous_6)","line":46,"loc":{"start":{"line":46,"column":24},"end":{"line":46,"column":35}}},"7":{"name":"(anonymous_7)","line":54,"loc":{"start":{"line":54,"column":22},"end":{"line":54,"column":33}}},"8":{"name":"(anonymous_8)","line":80,"loc":{"start":{"line":80,"column":18},"end":{"line":80,"column":29}}},"9":{"name":"(anonymous_9)","line":96,"loc":{"start":{"line":96,"column":19},"end":{"line":96,"column":30}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":126,"column":63}},"2":{"start":{"line":13,"column":4},"end":{"line":121,"column":13}},"3":{"start":{"line":31,"column":12},"end":{"line":35,"column":13}},"4":{"start":{"line":32,"column":16},"end":{"line":32,"column":38}},"5":{"start":{"line":33,"column":16},"end":{"line":33,"column":36}},"6":{"start":{"line":34,"column":16},"end":{"line":34,"column":40}},"7":{"start":{"line":38,"column":12},"end":{"line":38,"column":34}},"8":{"start":{"line":39,"column":12},"end":{"line":39,"column":38}},"9":{"start":{"line":47,"column":12},"end":{"line":47,"column":49}},"10":{"start":{"line":55,"column":12},"end":{"line":57,"column":13}},"11":{"start":{"line":56,"column":16},"end":{"line":56,"column":33}},"12":{"start":{"line":58,"column":12},"end":{"line":58,"column":71}},"13":{"start":{"line":59,"column":12},"end":{"line":61,"column":13}},"14":{"start":{"line":60,"column":16},"end":{"line":60,"column":44}},"15":{"start":{"line":62,"column":12},"end":{"line":64,"column":13}},"16":{"start":{"line":63,"column":16},"end":{"line":63,"column":45}},"17":{"start":{"line":66,"column":12},"end":{"line":66,"column":28}},"18":{"start":{"line":67,"column":12},"end":{"line":73,"column":15}},"19":{"start":{"line":81,"column":12},"end":{"line":89,"column":13}},"20":{"start":{"line":82,"column":16},"end":{"line":84,"column":38}},"21":{"start":{"line":85,"column":16},"end":{"line":88,"column":19}},"22":{"start":{"line":97,"column":12},"end":{"line":98,"column":36}},"23":{"start":{"line":99,"column":12},"end":{"line":109,"column":15}},"24":{"start":{"line":110,"column":12},"end":{"line":110,"column":38}},"25":{"start":{"line":111,"column":12},"end":{"line":111,"column":55}},"26":{"start":{"line":112,"column":12},"end":{"line":112,"column":27}},"27":{"start":{"line":113,"column":12},"end":{"line":113,"column":26}},"28":{"start":{"line":114,"column":12},"end":{"line":114,"column":101}},"29":{"start":{"line":115,"column":12},"end":{"line":115,"column":60}},"30":{"start":{"line":117,"column":12},"end":{"line":117,"column":31}},"31":{"start":{"line":118,"column":12},"end":{"line":118,"column":63}},"32":{"start":{"line":119,"column":12},"end":{"line":119,"column":58}}},"branchMap":{"1":{"line":31,"type":"if","locations":[{"start":{"line":31,"column":12},"end":{"line":31,"column":12}},{"start":{"line":31,"column":12},"end":{"line":31,"column":12}}]},"2":{"line":31,"type":"binary-expr","locations":[{"start":{"line":31,"column":16},"end":{"line":31,"column":31}},{"start":{"line":31,"column":35},"end":{"line":31,"column":65}}]},"3":{"line":55,"type":"if","locations":[{"start":{"line":55,"column":12},"end":{"line":55,"column":12}},{"start":{"line":55,"column":12},"end":{"line":55,"column":12}}]},"4":{"line":59,"type":"if","locations":[{"start":{"line":59,"column":12},"end":{"line":59,"column":12}},{"start":{"line":59,"column":12},"end":{"line":59,"column":12}}]},"5":{"line":62,"type":"if","locations":[{"start":{"line":62,"column":12},"end":{"line":62,"column":12}},{"start":{"line":62,"column":12},"end":{"line":62,"column":12}}]},"6":{"line":71,"type":"cond-expr","locations":[{"start":{"line":71,"column":46},"end":{"line":71,"column":50}},{"start":{"line":71,"column":53},"end":{"line":71,"column":56}}]},"7":{"line":81,"type":"if","locations":[{"start":{"line":81,"column":12},"end":{"line":81,"column":12}},{"start":{"line":81,"column":12},"end":{"line":81,"column":12}}]}},"code":["(function () { YUI.add('dd-ddm', function (Y, NAME) {","",""," /**"," * Extends the dd-ddm-base Class to add support for the viewport shim to allow a draggable"," * anode to drag to be dragged over an iframe or any other node that traps mousemove events."," * It is also required to have Drop Targets enabled, as the viewport shim will contain the shims for the Drop Targets."," * @module dd"," * @submodule dd-ddm"," * @for DDM"," * @namespace DD"," */"," Y.mix(Y.DD.DDM, {"," /**"," * The shim placed over the screen to track the mousemove event."," * @private"," * @property _pg"," * @type {Node}"," */"," _pg: null,"," /**"," * Set this to true to set the shims opacity to .5 for debugging it, default: false."," * @private"," * @property _debugShim"," * @type {Boolean}"," */"," _debugShim: false,"," _activateTargets: function() { },"," _deactivateTargets: function() {},"," _startDrag: function() {"," if (this.activeDrag && this.activeDrag.get('useShim')) {"," this._shimming = true;"," this._pg_activate();"," this._activateTargets();"," }"," },"," _endDrag: function() {"," this._pg_deactivate();"," this._deactivateTargets();"," },"," /**"," * Deactivates the shim"," * @private"," * @method _pg_deactivate"," */"," _pg_deactivate: function() {"," this._pg.setStyle('display', 'none');"," },"," /**"," * Activates the shim"," * @private"," * @method _pg_activate"," */"," _pg_activate: function() {"," if (!this._pg) {"," this._createPG();"," }"," var ah = this.activeDrag.get('activeHandle'), cur = 'auto';"," if (ah) {"," cur = ah.getStyle('cursor');"," }"," if (cur === 'auto') {"," cur = this.get('dragCursor');"," }",""," this._pg_size();"," this._pg.setStyles({"," top: 0,"," left: 0,"," display: 'block',"," opacity: ((this._debugShim) ? '.5' : '0'),"," cursor: cur"," });"," },"," /**"," * Sizes the shim on: activatation, window:scroll, window:resize"," * @private"," * @method _pg_size"," */"," _pg_size: function() {"," if (this.activeDrag) {"," var b = Y.one('body'),"," h = b.get('docHeight'),"," w = b.get('docWidth');"," this._pg.setStyles({"," height: h + 'px',"," width: w + 'px'"," });"," }"," },"," /**"," * Creates the shim and adds it's listeners to it."," * @private"," * @method _createPG"," */"," _createPG: function() {"," var pg = Y.Node.create('
'),"," bd = Y.one('body'), win;"," pg.setStyles({"," top: '0',"," left: '0',"," position: 'absolute',"," zIndex: '9999',"," overflow: 'hidden',"," backgroundColor: 'red',"," display: 'none',"," height: '5px',"," width: '5px'"," });"," pg.set('id', Y.stamp(pg));"," pg.addClass(Y.DD.DDM.CSS_PREFIX + '-shim');"," bd.prepend(pg);"," this._pg = pg;"," this._pg.on('mousemove', Y.throttle(Y.bind(this._move, this), this.get('throttleTime')));"," this._pg.on('mouseup', Y.bind(this._end, this));",""," win = Y.one('win');"," Y.on('window:resize', Y.bind(this._pg_size, this));"," win.on('scroll', Y.bind(this._pg_size, this));"," }"," }, true);","","","","","}, '@VERSION@', {\"requires\": [\"dd-ddm-base\", \"event-resize\"]});","","}());"]}; +} +var __cov_9Br2mMEofVNi0vj7HFd23g = __coverage__['build/dd-ddm/dd-ddm.js']; +__cov_9Br2mMEofVNi0vj7HFd23g.s['1']++;YUI.add('dd-ddm',function(Y,NAME){__cov_9Br2mMEofVNi0vj7HFd23g.f['1']++;__cov_9Br2mMEofVNi0vj7HFd23g.s['2']++;Y.mix(Y.DD.DDM,{_pg:null,_debugShim:false,_activateTargets:function(){__cov_9Br2mMEofVNi0vj7HFd23g.f['2']++;},_deactivateTargets:function(){__cov_9Br2mMEofVNi0vj7HFd23g.f['3']++;},_startDrag:function(){__cov_9Br2mMEofVNi0vj7HFd23g.f['4']++;__cov_9Br2mMEofVNi0vj7HFd23g.s['3']++;if((__cov_9Br2mMEofVNi0vj7HFd23g.b['2'][0]++,this.activeDrag)&&(__cov_9Br2mMEofVNi0vj7HFd23g.b['2'][1]++,this.activeDrag.get('useShim'))){__cov_9Br2mMEofVNi0vj7HFd23g.b['1'][0]++;__cov_9Br2mMEofVNi0vj7HFd23g.s['4']++;this._shimming=true;__cov_9Br2mMEofVNi0vj7HFd23g.s['5']++;this._pg_activate();__cov_9Br2mMEofVNi0vj7HFd23g.s['6']++;this._activateTargets();}else{__cov_9Br2mMEofVNi0vj7HFd23g.b['1'][1]++;}},_endDrag:function(){__cov_9Br2mMEofVNi0vj7HFd23g.f['5']++;__cov_9Br2mMEofVNi0vj7HFd23g.s['7']++;this._pg_deactivate();__cov_9Br2mMEofVNi0vj7HFd23g.s['8']++;this._deactivateTargets();},_pg_deactivate:function(){__cov_9Br2mMEofVNi0vj7HFd23g.f['6']++;__cov_9Br2mMEofVNi0vj7HFd23g.s['9']++;this._pg.setStyle('display','none');},_pg_activate:function(){__cov_9Br2mMEofVNi0vj7HFd23g.f['7']++;__cov_9Br2mMEofVNi0vj7HFd23g.s['10']++;if(!this._pg){__cov_9Br2mMEofVNi0vj7HFd23g.b['3'][0]++;__cov_9Br2mMEofVNi0vj7HFd23g.s['11']++;this._createPG();}else{__cov_9Br2mMEofVNi0vj7HFd23g.b['3'][1]++;}__cov_9Br2mMEofVNi0vj7HFd23g.s['12']++;var ah=this.activeDrag.get('activeHandle'),cur='auto';__cov_9Br2mMEofVNi0vj7HFd23g.s['13']++;if(ah){__cov_9Br2mMEofVNi0vj7HFd23g.b['4'][0]++;__cov_9Br2mMEofVNi0vj7HFd23g.s['14']++;cur=ah.getStyle('cursor');}else{__cov_9Br2mMEofVNi0vj7HFd23g.b['4'][1]++;}__cov_9Br2mMEofVNi0vj7HFd23g.s['15']++;if(cur==='auto'){__cov_9Br2mMEofVNi0vj7HFd23g.b['5'][0]++;__cov_9Br2mMEofVNi0vj7HFd23g.s['16']++;cur=this.get('dragCursor');}else{__cov_9Br2mMEofVNi0vj7HFd23g.b['5'][1]++;}__cov_9Br2mMEofVNi0vj7HFd23g.s['17']++;this._pg_size();__cov_9Br2mMEofVNi0vj7HFd23g.s['18']++;this._pg.setStyles({top:0,left:0,display:'block',opacity:this._debugShim?(__cov_9Br2mMEofVNi0vj7HFd23g.b['6'][0]++,'.5'):(__cov_9Br2mMEofVNi0vj7HFd23g.b['6'][1]++,'0'),cursor:cur});},_pg_size:function(){__cov_9Br2mMEofVNi0vj7HFd23g.f['8']++;__cov_9Br2mMEofVNi0vj7HFd23g.s['19']++;if(this.activeDrag){__cov_9Br2mMEofVNi0vj7HFd23g.b['7'][0]++;__cov_9Br2mMEofVNi0vj7HFd23g.s['20']++;var b=Y.one('body'),h=b.get('docHeight'),w=b.get('docWidth');__cov_9Br2mMEofVNi0vj7HFd23g.s['21']++;this._pg.setStyles({height:h+'px',width:w+'px'});}else{__cov_9Br2mMEofVNi0vj7HFd23g.b['7'][1]++;}},_createPG:function(){__cov_9Br2mMEofVNi0vj7HFd23g.f['9']++;__cov_9Br2mMEofVNi0vj7HFd23g.s['22']++;var pg=Y.Node.create('
'),bd=Y.one('body'),win;__cov_9Br2mMEofVNi0vj7HFd23g.s['23']++;pg.setStyles({top:'0',left:'0',position:'absolute',zIndex:'9999',overflow:'hidden',backgroundColor:'red',display:'none',height:'5px',width:'5px'});__cov_9Br2mMEofVNi0vj7HFd23g.s['24']++;pg.set('id',Y.stamp(pg));__cov_9Br2mMEofVNi0vj7HFd23g.s['25']++;pg.addClass(Y.DD.DDM.CSS_PREFIX+'-shim');__cov_9Br2mMEofVNi0vj7HFd23g.s['26']++;bd.prepend(pg);__cov_9Br2mMEofVNi0vj7HFd23g.s['27']++;this._pg=pg;__cov_9Br2mMEofVNi0vj7HFd23g.s['28']++;this._pg.on('mousemove',Y.throttle(Y.bind(this._move,this),this.get('throttleTime')));__cov_9Br2mMEofVNi0vj7HFd23g.s['29']++;this._pg.on('mouseup',Y.bind(this._end,this));__cov_9Br2mMEofVNi0vj7HFd23g.s['30']++;win=Y.one('win');__cov_9Br2mMEofVNi0vj7HFd23g.s['31']++;Y.on('window:resize',Y.bind(this._pg_size,this));__cov_9Br2mMEofVNi0vj7HFd23g.s['32']++;win.on('scroll',Y.bind(this._pg_size,this));}},true);},'@VERSION@',{'requires':['dd-ddm-base','event-resize']}); diff --git a/src/build/dd-ddm/dd-ddm-debug.js b/src/build/dd-ddm/dd-ddm-debug.js new file mode 100644 index 00000000000..0c1bdea8d8a --- /dev/null +++ b/src/build/dd-ddm/dd-ddm-debug.js @@ -0,0 +1,126 @@ +YUI.add('dd-ddm', function (Y, NAME) { + + + /** + * Extends the dd-ddm-base Class to add support for the viewport shim to allow a draggable + * anode to drag to be dragged over an iframe or any other node that traps mousemove events. + * It is also required to have Drop Targets enabled, as the viewport shim will contain the shims for the Drop Targets. + * @module dd + * @submodule dd-ddm + * @for DDM + * @namespace DD + */ + Y.mix(Y.DD.DDM, { + /** + * The shim placed over the screen to track the mousemove event. + * @private + * @property _pg + * @type {Node} + */ + _pg: null, + /** + * Set this to true to set the shims opacity to .5 for debugging it, default: false. + * @private + * @property _debugShim + * @type {Boolean} + */ + _debugShim: false, + _activateTargets: function() { }, + _deactivateTargets: function() {}, + _startDrag: function() { + if (this.activeDrag && this.activeDrag.get('useShim')) { + this._shimming = true; + this._pg_activate(); + this._activateTargets(); + } + }, + _endDrag: function() { + this._pg_deactivate(); + this._deactivateTargets(); + }, + /** + * Deactivates the shim + * @private + * @method _pg_deactivate + */ + _pg_deactivate: function() { + this._pg.setStyle('display', 'none'); + }, + /** + * Activates the shim + * @private + * @method _pg_activate + */ + _pg_activate: function() { + if (!this._pg) { + this._createPG(); + } + var ah = this.activeDrag.get('activeHandle'), cur = 'auto'; + if (ah) { + cur = ah.getStyle('cursor'); + } + if (cur === 'auto') { + cur = this.get('dragCursor'); + } + + this._pg_size(); + this._pg.setStyles({ + top: 0, + left: 0, + display: 'block', + opacity: ((this._debugShim) ? '.5' : '0'), + cursor: cur + }); + }, + /** + * Sizes the shim on: activatation, window:scroll, window:resize + * @private + * @method _pg_size + */ + _pg_size: function() { + if (this.activeDrag) { + var b = Y.one('body'), + h = b.get('docHeight'), + w = b.get('docWidth'); + this._pg.setStyles({ + height: h + 'px', + width: w + 'px' + }); + } + }, + /** + * Creates the shim and adds it's listeners to it. + * @private + * @method _createPG + */ + _createPG: function() { + var pg = Y.Node.create('
'), + bd = Y.one('body'), win; + pg.setStyles({ + top: '0', + left: '0', + position: 'absolute', + zIndex: '9999', + overflow: 'hidden', + backgroundColor: 'red', + display: 'none', + height: '5px', + width: '5px' + }); + pg.set('id', Y.stamp(pg)); + pg.addClass(Y.DD.DDM.CSS_PREFIX + '-shim'); + bd.prepend(pg); + this._pg = pg; + this._pg.on('mousemove', Y.throttle(Y.bind(this._move, this), this.get('throttleTime'))); + this._pg.on('mouseup', Y.bind(this._end, this)); + + win = Y.one('win'); + Y.on('window:resize', Y.bind(this._pg_size, this)); + win.on('scroll', Y.bind(this._pg_size, this)); + } + }, true); + + + + +}, '@VERSION@', {"requires": ["dd-ddm-base", "event-resize"]}); diff --git a/src/build/dd-ddm/dd-ddm-min.js b/src/build/dd-ddm/dd-ddm-min.js new file mode 100644 index 00000000000..39fe0cda087 --- /dev/null +++ b/src/build/dd-ddm/dd-ddm-min.js @@ -0,0 +1 @@ +YUI.add("dd-ddm",function(e,t){e.mix(e.DD.DDM,{_pg:null,_debugShim:!1,_activateTargets:function(){},_deactivateTargets:function(){},_startDrag:function(){this.activeDrag&&this.activeDrag.get("useShim")&&(this._shimming=!0,this._pg_activate(),this._activateTargets())},_endDrag:function(){this._pg_deactivate(),this._deactivateTargets()},_pg_deactivate:function(){this._pg.setStyle("display","none")},_pg_activate:function(){this._pg||this._createPG();var e=this.activeDrag.get("activeHandle"),t="auto";e&&(t=e.getStyle("cursor")),t==="auto"&&(t=this.get("dragCursor")),this._pg_size(),this._pg.setStyles({top:0,left:0,display:"block",opacity:this._debugShim?".5":"0",cursor:t})},_pg_size:function(){if(this.activeDrag){var t=e.one("body"),n=t.get("docHeight"),r=t.get("docWidth");this._pg.setStyles({height:n+"px",width:r+"px"})}},_createPG:function(){var t=e.Node.create("
"),n=e.one("body"),r;t.setStyles({top:"0",left:"0",position:"absolute",zIndex:"9999",overflow:"hidden",backgroundColor:"red",display:"none",height:"5px",width:"5px"}),t.set("id",e.stamp(t)),t.addClass(e.DD.DDM.CSS_PREFIX+"-shim"),n.prepend(t),this._pg=t,this._pg.on("mousemove",e.throttle(e.bind(this._move,this),this.get("throttleTime"))),this._pg.on("mouseup",e.bind(this._end,this)),r=e.one("win"),e.on("window:resize",e.bind(this._pg_size,this)),r.on("scroll",e.bind(this._pg_size,this))}},!0)},"@VERSION@",{requires:["dd-ddm-base","event-resize"]}); diff --git a/src/build/dd-ddm/dd-ddm.js b/src/build/dd-ddm/dd-ddm.js new file mode 100644 index 00000000000..0c1bdea8d8a --- /dev/null +++ b/src/build/dd-ddm/dd-ddm.js @@ -0,0 +1,126 @@ +YUI.add('dd-ddm', function (Y, NAME) { + + + /** + * Extends the dd-ddm-base Class to add support for the viewport shim to allow a draggable + * anode to drag to be dragged over an iframe or any other node that traps mousemove events. + * It is also required to have Drop Targets enabled, as the viewport shim will contain the shims for the Drop Targets. + * @module dd + * @submodule dd-ddm + * @for DDM + * @namespace DD + */ + Y.mix(Y.DD.DDM, { + /** + * The shim placed over the screen to track the mousemove event. + * @private + * @property _pg + * @type {Node} + */ + _pg: null, + /** + * Set this to true to set the shims opacity to .5 for debugging it, default: false. + * @private + * @property _debugShim + * @type {Boolean} + */ + _debugShim: false, + _activateTargets: function() { }, + _deactivateTargets: function() {}, + _startDrag: function() { + if (this.activeDrag && this.activeDrag.get('useShim')) { + this._shimming = true; + this._pg_activate(); + this._activateTargets(); + } + }, + _endDrag: function() { + this._pg_deactivate(); + this._deactivateTargets(); + }, + /** + * Deactivates the shim + * @private + * @method _pg_deactivate + */ + _pg_deactivate: function() { + this._pg.setStyle('display', 'none'); + }, + /** + * Activates the shim + * @private + * @method _pg_activate + */ + _pg_activate: function() { + if (!this._pg) { + this._createPG(); + } + var ah = this.activeDrag.get('activeHandle'), cur = 'auto'; + if (ah) { + cur = ah.getStyle('cursor'); + } + if (cur === 'auto') { + cur = this.get('dragCursor'); + } + + this._pg_size(); + this._pg.setStyles({ + top: 0, + left: 0, + display: 'block', + opacity: ((this._debugShim) ? '.5' : '0'), + cursor: cur + }); + }, + /** + * Sizes the shim on: activatation, window:scroll, window:resize + * @private + * @method _pg_size + */ + _pg_size: function() { + if (this.activeDrag) { + var b = Y.one('body'), + h = b.get('docHeight'), + w = b.get('docWidth'); + this._pg.setStyles({ + height: h + 'px', + width: w + 'px' + }); + } + }, + /** + * Creates the shim and adds it's listeners to it. + * @private + * @method _createPG + */ + _createPG: function() { + var pg = Y.Node.create('
'), + bd = Y.one('body'), win; + pg.setStyles({ + top: '0', + left: '0', + position: 'absolute', + zIndex: '9999', + overflow: 'hidden', + backgroundColor: 'red', + display: 'none', + height: '5px', + width: '5px' + }); + pg.set('id', Y.stamp(pg)); + pg.addClass(Y.DD.DDM.CSS_PREFIX + '-shim'); + bd.prepend(pg); + this._pg = pg; + this._pg.on('mousemove', Y.throttle(Y.bind(this._move, this), this.get('throttleTime'))); + this._pg.on('mouseup', Y.bind(this._end, this)); + + win = Y.one('win'); + Y.on('window:resize', Y.bind(this._pg_size, this)); + win.on('scroll', Y.bind(this._pg_size, this)); + } + }, true); + + + + +}, '@VERSION@', {"requires": ["dd-ddm-base", "event-resize"]}); diff --git a/src/build/dd-delegate/dd-delegate-coverage.js b/src/build/dd-delegate/dd-delegate-coverage.js new file mode 100644 index 00000000000..0654eadc537 --- /dev/null +++ b/src/build/dd-delegate/dd-delegate-coverage.js @@ -0,0 +1,6 @@ +if (typeof __coverage__ === 'undefined') { __coverage__ = {}; } +if (!__coverage__['build/dd-delegate/dd-delegate.js']) { + __coverage__['build/dd-delegate/dd-delegate.js'] = {"path":"build/dd-delegate/dd-delegate.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0},"b":{"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0],"8":[0,0],"9":[0,0],"10":[0,0],"11":[0,0],"12":[0,0],"13":[0,0],"14":[0,0],"15":[0,0],"16":[0,0]},"f":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":42}}},"2":{"name":"(anonymous_2)","line":18,"loc":{"start":{"line":18,"column":19},"end":{"line":18,"column":30}}},"3":{"name":"(anonymous_3)","line":56,"loc":{"start":{"line":56,"column":23},"end":{"line":56,"column":35}}},"4":{"name":"(anonymous_4)","line":65,"loc":{"start":{"line":65,"column":23},"end":{"line":65,"column":34}}},"5":{"name":"(anonymous_5)","line":79,"loc":{"start":{"line":79,"column":23},"end":{"line":79,"column":35}}},"6":{"name":"(anonymous_6)","line":107,"loc":{"start":{"line":107,"column":23},"end":{"line":107,"column":34}}},"7":{"name":"(anonymous_7)","line":117,"loc":{"start":{"line":117,"column":23},"end":{"line":117,"column":34}}},"8":{"name":"(anonymous_8)","line":120,"loc":{"start":{"line":120,"column":21},"end":{"line":120,"column":32}}},"9":{"name":"(anonymous_9)","line":139,"loc":{"start":{"line":139,"column":42},"end":{"line":139,"column":53}}},"10":{"name":"(anonymous_10)","line":158,"loc":{"start":{"line":158,"column":21},"end":{"line":158,"column":32}}},"11":{"name":"(anonymous_11)","line":173,"loc":{"start":{"line":173,"column":27},"end":{"line":173,"column":39}}},"12":{"name":"(anonymous_12)","line":186,"loc":{"start":{"line":186,"column":20},"end":{"line":186,"column":43}}},"13":{"name":"(anonymous_13)","line":198,"loc":{"start":{"line":198,"column":20},"end":{"line":198,"column":31}}},"14":{"name":"(anonymous_14)","line":206,"loc":{"start":{"line":206,"column":40},"end":{"line":206,"column":52}}},"15":{"name":"(anonymous_15)","line":310,"loc":{"start":{"line":310,"column":21},"end":{"line":310,"column":35}}},"16":{"name":"(anonymous_16)","line":319,"loc":{"start":{"line":319,"column":21},"end":{"line":319,"column":36}}},"17":{"name":"(anonymous_17)","line":322,"loc":{"start":{"line":322,"column":42},"end":{"line":322,"column":54}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":337,"column":81}},"2":{"start":{"line":18,"column":4},"end":{"line":23,"column":53}},"3":{"start":{"line":19,"column":8},"end":{"line":19,"column":63}},"4":{"start":{"line":26,"column":4},"end":{"line":294,"column":7}},"5":{"start":{"line":57,"column":12},"end":{"line":57,"column":43}},"6":{"start":{"line":66,"column":12},"end":{"line":66,"column":47}},"7":{"start":{"line":68,"column":12},"end":{"line":68,"column":54}},"8":{"start":{"line":69,"column":12},"end":{"line":69,"column":80}},"9":{"start":{"line":70,"column":12},"end":{"line":70,"column":30}},"10":{"start":{"line":71,"column":12},"end":{"line":71,"column":42}},"11":{"start":{"line":80,"column":12},"end":{"line":83,"column":48}},"12":{"start":{"line":85,"column":12},"end":{"line":99,"column":13}},"13":{"start":{"line":86,"column":16},"end":{"line":86,"column":51}},"14":{"start":{"line":87,"column":16},"end":{"line":87,"column":40}},"15":{"start":{"line":88,"column":16},"end":{"line":88,"column":45}},"16":{"start":{"line":89,"column":16},"end":{"line":89,"column":36}},"17":{"start":{"line":90,"column":16},"end":{"line":94,"column":17}},"18":{"start":{"line":91,"column":20},"end":{"line":91,"column":44}},"19":{"start":{"line":92,"column":23},"end":{"line":94,"column":17}},"20":{"start":{"line":93,"column":20},"end":{"line":93,"column":44}},"21":{"start":{"line":95,"column":16},"end":{"line":95,"column":42}},"22":{"start":{"line":96,"column":16},"end":{"line":96,"column":27}},"23":{"start":{"line":98,"column":16},"end":{"line":98,"column":53}},"24":{"start":{"line":108,"column":12},"end":{"line":108,"column":47}},"25":{"start":{"line":109,"column":12},"end":{"line":109,"column":36}},"26":{"start":{"line":118,"column":12},"end":{"line":118,"column":47}},"27":{"start":{"line":121,"column":12},"end":{"line":121,"column":31}},"28":{"start":{"line":124,"column":12},"end":{"line":125,"column":38}},"29":{"start":{"line":127,"column":12},"end":{"line":127,"column":49}},"30":{"start":{"line":128,"column":12},"end":{"line":128,"column":38}},"31":{"start":{"line":130,"column":12},"end":{"line":132,"column":13}},"32":{"start":{"line":131,"column":16},"end":{"line":131,"column":51}},"33":{"start":{"line":134,"column":12},"end":{"line":134,"column":42}},"34":{"start":{"line":137,"column":12},"end":{"line":137,"column":72}},"35":{"start":{"line":138,"column":12},"end":{"line":138,"column":75}},"36":{"start":{"line":139,"column":12},"end":{"line":141,"column":15}},"37":{"start":{"line":140,"column":16},"end":{"line":140,"column":31}},"38":{"start":{"line":144,"column":12},"end":{"line":144,"column":123}},"39":{"start":{"line":146,"column":12},"end":{"line":146,"column":91}},"40":{"start":{"line":148,"column":12},"end":{"line":148,"column":91}},"41":{"start":{"line":150,"column":12},"end":{"line":150,"column":48}},"42":{"start":{"line":151,"column":12},"end":{"line":151,"column":39}},"43":{"start":{"line":159,"column":12},"end":{"line":161,"column":13}},"44":{"start":{"line":160,"column":16},"end":{"line":160,"column":23}},"45":{"start":{"line":162,"column":12},"end":{"line":162,"column":38}},"46":{"start":{"line":164,"column":12},"end":{"line":176,"column":13}},"47":{"start":{"line":165,"column":16},"end":{"line":165,"column":67}},"48":{"start":{"line":166,"column":16},"end":{"line":166,"column":47}},"49":{"start":{"line":167,"column":16},"end":{"line":167,"column":48}},"50":{"start":{"line":169,"column":16},"end":{"line":171,"column":17}},"51":{"start":{"line":170,"column":20},"end":{"line":170,"column":43}},"52":{"start":{"line":173,"column":16},"end":{"line":175,"column":25}},"53":{"start":{"line":174,"column":20},"end":{"line":174,"column":47}},"54":{"start":{"line":177,"column":12},"end":{"line":177,"column":24}},"55":{"start":{"line":187,"column":12},"end":{"line":190,"column":14}},"56":{"start":{"line":192,"column":12},"end":{"line":194,"column":13}},"57":{"start":{"line":193,"column":16},"end":{"line":193,"column":49}},"58":{"start":{"line":195,"column":12},"end":{"line":195,"column":44}},"59":{"start":{"line":196,"column":12},"end":{"line":196,"column":24}},"60":{"start":{"line":199,"column":12},"end":{"line":201,"column":13}},"61":{"start":{"line":200,"column":16},"end":{"line":200,"column":34}},"62":{"start":{"line":202,"column":12},"end":{"line":205,"column":13}},"63":{"start":{"line":203,"column":16},"end":{"line":203,"column":73}},"64":{"start":{"line":204,"column":16},"end":{"line":204,"column":46}},"65":{"start":{"line":206,"column":12},"end":{"line":208,"column":15}},"66":{"start":{"line":207,"column":16},"end":{"line":207,"column":27}},"67":{"start":{"line":296,"column":4},"end":{"line":329,"column":7}},"68":{"start":{"line":311,"column":12},"end":{"line":311,"column":38}},"69":{"start":{"line":320,"column":12},"end":{"line":320,"column":27}},"70":{"start":{"line":321,"column":12},"end":{"line":321,"column":31}},"71":{"start":{"line":322,"column":12},"end":{"line":326,"column":21}},"72":{"start":{"line":323,"column":16},"end":{"line":325,"column":17}},"73":{"start":{"line":324,"column":20},"end":{"line":324,"column":28}},"74":{"start":{"line":327,"column":12},"end":{"line":327,"column":23}},"75":{"start":{"line":331,"column":4},"end":{"line":331,"column":22}},"76":{"start":{"line":332,"column":4},"end":{"line":332,"column":29}}},"branchMap":{"1":{"line":85,"type":"if","locations":[{"start":{"line":85,"column":12},"end":{"line":85,"column":12}},{"start":{"line":85,"column":12},"end":{"line":85,"column":12}}]},"2":{"line":85,"type":"binary-expr","locations":[{"start":{"line":85,"column":16},"end":{"line":85,"column":41}},{"start":{"line":85,"column":45},"end":{"line":85,"column":75}}]},"3":{"line":90,"type":"if","locations":[{"start":{"line":90,"column":16},"end":{"line":90,"column":16}},{"start":{"line":90,"column":16},"end":{"line":90,"column":16}}]},"4":{"line":90,"type":"binary-expr","locations":[{"start":{"line":90,"column":20},"end":{"line":90,"column":26}},{"start":{"line":90,"column":30},"end":{"line":90,"column":45}}]},"5":{"line":92,"type":"if","locations":[{"start":{"line":92,"column":23},"end":{"line":92,"column":23}},{"start":{"line":92,"column":23},"end":{"line":92,"column":23}}]},"6":{"line":124,"type":"binary-expr","locations":[{"start":{"line":124,"column":23},"end":{"line":124,"column":45}},{"start":{"line":124,"column":49},"end":{"line":124,"column":51}}]},"7":{"line":130,"type":"if","locations":[{"start":{"line":130,"column":12},"end":{"line":130,"column":12}},{"start":{"line":130,"column":12},"end":{"line":130,"column":12}}]},"8":{"line":159,"type":"if","locations":[{"start":{"line":159,"column":12},"end":{"line":159,"column":12}},{"start":{"line":159,"column":12},"end":{"line":159,"column":12}}]},"9":{"line":159,"type":"binary-expr","locations":[{"start":{"line":159,"column":16},"end":{"line":159,"column":30}},{"start":{"line":159,"column":34},"end":{"line":159,"column":55}}]},"10":{"line":164,"type":"if","locations":[{"start":{"line":164,"column":12},"end":{"line":164,"column":12}},{"start":{"line":164,"column":12},"end":{"line":164,"column":12}}]},"11":{"line":169,"type":"if","locations":[{"start":{"line":169,"column":16},"end":{"line":169,"column":16}},{"start":{"line":169,"column":16},"end":{"line":169,"column":16}}]},"12":{"line":169,"type":"binary-expr","locations":[{"start":{"line":169,"column":20},"end":{"line":169,"column":26}},{"start":{"line":169,"column":30},"end":{"line":169,"column":43}}]},"13":{"line":192,"type":"if","locations":[{"start":{"line":192,"column":12},"end":{"line":192,"column":12}},{"start":{"line":192,"column":12},"end":{"line":192,"column":12}}]},"14":{"line":199,"type":"if","locations":[{"start":{"line":199,"column":12},"end":{"line":199,"column":12}},{"start":{"line":199,"column":12},"end":{"line":199,"column":12}}]},"15":{"line":202,"type":"if","locations":[{"start":{"line":202,"column":12},"end":{"line":202,"column":12}},{"start":{"line":202,"column":12},"end":{"line":202,"column":12}}]},"16":{"line":323,"type":"if","locations":[{"start":{"line":323,"column":16},"end":{"line":323,"column":16}},{"start":{"line":323,"column":16},"end":{"line":323,"column":16}}]}},"code":["(function () { YUI.add('dd-delegate', function (Y, NAME) {","",""," /**"," * Provides the ability to drag multiple nodes under a container element using only one Y.DD.Drag instance as a delegate."," * @module dd"," * @submodule dd-delegate"," */"," /**"," * Provides the ability to drag multiple nodes under a container element using only one Y.DD.Drag instance as a delegate."," * @class Delegate"," * @extends Base"," * @constructor"," * @namespace DD"," */","",""," var Delegate = function() {"," Delegate.superclass.constructor.apply(this, arguments);"," },"," CONT = 'container',"," NODES = 'nodes',"," _tmpNode = Y.Node.create('
Temp Node
');","",""," Y.extend(Delegate, Y.Base, {"," /**"," * The default bubbleTarget for this object. Default: Y.DD.DDM"," * @private"," * @property _bubbleTargets"," */"," _bubbleTargets: Y.DD.DDM,"," /**"," * A reference to the temporary dd instance used under the hood."," * @property dd"," */"," dd: null,"," /**"," * The state of the Y.DD.DDM._noShim property to it can be reset."," * @property _shimState"," * @private"," */"," _shimState: null,"," /**"," * Array of event handles to be destroyed"," * @private"," * @property _handles"," */"," _handles: null,"," /**"," * Listens to the nodeChange event and sets the dragNode on the temp dd instance."," * @private"," * @method _onNodeChange"," * @param {Event} e The Event."," */"," _onNodeChange: function(e) {"," this.set('dragNode', e.newVal);"," },"," /**"," * Listens for the drag:end event and updates the temp dd instance."," * @private"," * @method _afterDragEnd"," * @param {Event} e The Event."," */"," _afterDragEnd: function() {"," Y.DD.DDM._noShim = this._shimState;",""," this.set('lastNode', this.dd.get('node'));"," this.get('lastNode').removeClass(Y.DD.DDM.CSS_PREFIX + '-dragging');"," this.dd._unprep();"," this.dd.set('node', _tmpNode);"," },"," /**"," * The callback for the Y.DD.Delegate instance used"," * @private"," * @method _delMouseDown"," * @param {Event} e The MouseDown Event."," */"," _delMouseDown: function(e) {"," var tar = e.currentTarget,"," dd = this.dd,"," dNode = tar,"," config = this.get('dragConfig');",""," if (tar.test(this.get(NODES)) && !tar.test(this.get('invalid'))) {"," this._shimState = Y.DD.DDM._noShim;"," Y.DD.DDM._noShim = true;"," this.set('currentNode', tar);"," dd.set('node', tar);"," if (config && config.dragNode) {"," dNode = config.dragNode;"," } else if (dd.proxy) {"," dNode = Y.DD.DDM._proxy;"," }"," dd.set('dragNode', dNode);"," dd._prep();",""," dd.fire('drag:mouseDown', { ev: e });"," }"," },"," /**"," * Sets the target shim state"," * @private"," * @method _onMouseEnter"," * @param {Event} e The MouseEnter Event"," */"," _onMouseEnter: function() {"," this._shimState = Y.DD.DDM._noShim;"," Y.DD.DDM._noShim = true;"," },"," /**"," * Resets the target shim state"," * @private"," * @method _onMouseLeave"," * @param {Event} e The MouseLeave Event"," */"," _onMouseLeave: function() {"," Y.DD.DDM._noShim = this._shimState;"," },"," initializer: function() {"," this._handles = [];"," //Create a tmp DD instance under the hood."," //var conf = Y.clone(this.get('dragConfig') || {}),"," var conf = this.get('dragConfig') || {},"," cont = this.get(CONT);",""," conf.node = _tmpNode.cloneNode(true);"," conf.bubbleTargets = this;",""," if (this.get('handles')) {"," conf.handles = this.get('handles');"," }",""," this.dd = new Y.DD.Drag(conf);",""," //On end drag, detach the listeners"," this.dd.after('drag:end', Y.bind(this._afterDragEnd, this));"," this.dd.on('dragNodeChange', Y.bind(this._onNodeChange, this));"," this.dd.after('drag:mouseup', function() {"," this._unprep();"," });",""," //Attach the delegate to the container"," this._handles.push(Y.delegate(Y.DD.Drag.START_EVENT, Y.bind(this._delMouseDown, this), cont, this.get(NODES)));",""," this._handles.push(Y.on('mouseenter', Y.bind(this._onMouseEnter, this), cont));",""," this._handles.push(Y.on('mouseleave', Y.bind(this._onMouseLeave, this), cont));",""," Y.later(50, this, this.syncTargets);"," Y.DD.DDM.regDelegate(this);"," },"," /**"," * Applies the Y.Plugin.Drop to all nodes matching the cont + nodes selector query."," * @method syncTargets"," * @chainable"," */"," syncTargets: function() {"," if (!Y.Plugin.Drop || this.get('destroyed')) {"," return;"," }"," var items, groups, config;",""," if (this.get('target')) {"," items = Y.one(this.get(CONT)).all(this.get(NODES));"," groups = this.dd.get('groups');"," config = this.get('dragConfig');",""," if (config && config.groups) {"," groups = config.groups;"," }",""," items.each(function(i) {"," this.createDrop(i, groups);"," }, this);"," }"," return this;"," },"," /**"," * Apply the Drop plugin to this node"," * @method createDrop"," * @param {Node} node The Node to apply the plugin to"," * @param {Array} groups The default groups to assign this target to."," * @return Node"," */"," createDrop: function(node, groups) {"," var config = {"," useShim: false,"," bubbleTargets: this"," };",""," if (!node.drop) {"," node.plug(Y.Plugin.Drop, config);"," }"," node.drop.set('groups', groups);"," return node;"," },"," destructor: function() {"," if (this.dd) {"," this.dd.destroy();"," }"," if (Y.Plugin.Drop) {"," var targets = Y.one(this.get(CONT)).all(this.get(NODES));"," targets.unplug(Y.Plugin.Drop);"," }"," Y.Array.each(this._handles, function(v) {"," v.detach();"," });"," }"," }, {"," NAME: 'delegate',"," ATTRS: {"," /**"," * A selector query to get the container to listen for mousedown events on. All \"nodes\" should be a child of this container."," * @attribute container"," * @type String"," */"," container: {"," value: 'body'"," },"," /**"," * A selector query to get the children of the \"container\" to make draggable elements from."," * @attribute nodes"," * @type String"," */"," nodes: {"," value: '.dd-draggable'"," },"," /**"," * A selector query to test a node to see if it's an invalid item."," * @attribute invalid"," * @type String"," */"," invalid: {"," value: 'input, select, button, a, textarea'"," },"," /**"," * Y.Node instance of the last item dragged."," * @attribute lastNode"," * @type Node"," */"," lastNode: {"," value: _tmpNode"," },"," /**"," * Y.Node instance of the dd node."," * @attribute currentNode"," * @type Node"," */"," currentNode: {"," value: _tmpNode"," },"," /**"," * Y.Node instance of the dd dragNode."," * @attribute dragNode"," * @type Node"," */"," dragNode: {"," value: _tmpNode"," },"," /**"," * Is the mouse currently over the container"," * @attribute over"," * @type Boolean"," */"," over: {"," value: false"," },"," /**"," * Should the items also be a drop target."," * @attribute target"," * @type Boolean"," */"," target: {"," value: false"," },"," /**"," * The default config to be used when creating the DD instance."," * @attribute dragConfig"," * @type Object"," */"," dragConfig: {"," value: null"," },"," /**"," * The handles config option added to the temp DD instance."," * @attribute handles"," * @type Array"," */"," handles: {"," value: null"," }"," }"," });",""," Y.mix(Y.DD.DDM, {"," /**"," * Holder for all Y.DD.Delegate instances"," * @private"," * @for DDM"," * @property _delegates"," * @type Array"," */"," _delegates: [],"," /**"," * Register a Delegate with the DDM"," * @for DDM"," * @method regDelegate"," */"," regDelegate: function(del) {"," this._delegates.push(del);"," },"," /**"," * Get a delegate instance from a container node"," * @for DDM"," * @method getDelegate"," * @return Y.DD.Delegate"," */"," getDelegate: function(node) {"," var del = null;"," node = Y.one(node);"," Y.Array.each(this._delegates, function(v) {"," if (node.test(v.get(CONT))) {"," del = v;"," }"," }, this);"," return del;"," }"," });",""," Y.namespace('DD');"," Y.DD.Delegate = Delegate;","","","","","}, '@VERSION@', {\"requires\": [\"dd-drag\", \"dd-drop-plugin\", \"event-mouseenter\"]});","","}());"]}; +} +var __cov_gudzmr64nR2l4_Co1Wlh9w = __coverage__['build/dd-delegate/dd-delegate.js']; +__cov_gudzmr64nR2l4_Co1Wlh9w.s['1']++;YUI.add('dd-delegate',function(Y,NAME){__cov_gudzmr64nR2l4_Co1Wlh9w.f['1']++;__cov_gudzmr64nR2l4_Co1Wlh9w.s['2']++;var Delegate=function(){__cov_gudzmr64nR2l4_Co1Wlh9w.f['2']++;__cov_gudzmr64nR2l4_Co1Wlh9w.s['3']++;Delegate.superclass.constructor.apply(this,arguments);},CONT='container',NODES='nodes',_tmpNode=Y.Node.create('
Temp Node
');__cov_gudzmr64nR2l4_Co1Wlh9w.s['4']++;Y.extend(Delegate,Y.Base,{_bubbleTargets:Y.DD.DDM,dd:null,_shimState:null,_handles:null,_onNodeChange:function(e){__cov_gudzmr64nR2l4_Co1Wlh9w.f['3']++;__cov_gudzmr64nR2l4_Co1Wlh9w.s['5']++;this.set('dragNode',e.newVal);},_afterDragEnd:function(){__cov_gudzmr64nR2l4_Co1Wlh9w.f['4']++;__cov_gudzmr64nR2l4_Co1Wlh9w.s['6']++;Y.DD.DDM._noShim=this._shimState;__cov_gudzmr64nR2l4_Co1Wlh9w.s['7']++;this.set('lastNode',this.dd.get('node'));__cov_gudzmr64nR2l4_Co1Wlh9w.s['8']++;this.get('lastNode').removeClass(Y.DD.DDM.CSS_PREFIX+'-dragging');__cov_gudzmr64nR2l4_Co1Wlh9w.s['9']++;this.dd._unprep();__cov_gudzmr64nR2l4_Co1Wlh9w.s['10']++;this.dd.set('node',_tmpNode);},_delMouseDown:function(e){__cov_gudzmr64nR2l4_Co1Wlh9w.f['5']++;__cov_gudzmr64nR2l4_Co1Wlh9w.s['11']++;var tar=e.currentTarget,dd=this.dd,dNode=tar,config=this.get('dragConfig');__cov_gudzmr64nR2l4_Co1Wlh9w.s['12']++;if((__cov_gudzmr64nR2l4_Co1Wlh9w.b['2'][0]++,tar.test(this.get(NODES)))&&(__cov_gudzmr64nR2l4_Co1Wlh9w.b['2'][1]++,!tar.test(this.get('invalid')))){__cov_gudzmr64nR2l4_Co1Wlh9w.b['1'][0]++;__cov_gudzmr64nR2l4_Co1Wlh9w.s['13']++;this._shimState=Y.DD.DDM._noShim;__cov_gudzmr64nR2l4_Co1Wlh9w.s['14']++;Y.DD.DDM._noShim=true;__cov_gudzmr64nR2l4_Co1Wlh9w.s['15']++;this.set('currentNode',tar);__cov_gudzmr64nR2l4_Co1Wlh9w.s['16']++;dd.set('node',tar);__cov_gudzmr64nR2l4_Co1Wlh9w.s['17']++;if((__cov_gudzmr64nR2l4_Co1Wlh9w.b['4'][0]++,config)&&(__cov_gudzmr64nR2l4_Co1Wlh9w.b['4'][1]++,config.dragNode)){__cov_gudzmr64nR2l4_Co1Wlh9w.b['3'][0]++;__cov_gudzmr64nR2l4_Co1Wlh9w.s['18']++;dNode=config.dragNode;}else{__cov_gudzmr64nR2l4_Co1Wlh9w.b['3'][1]++;__cov_gudzmr64nR2l4_Co1Wlh9w.s['19']++;if(dd.proxy){__cov_gudzmr64nR2l4_Co1Wlh9w.b['5'][0]++;__cov_gudzmr64nR2l4_Co1Wlh9w.s['20']++;dNode=Y.DD.DDM._proxy;}else{__cov_gudzmr64nR2l4_Co1Wlh9w.b['5'][1]++;}}__cov_gudzmr64nR2l4_Co1Wlh9w.s['21']++;dd.set('dragNode',dNode);__cov_gudzmr64nR2l4_Co1Wlh9w.s['22']++;dd._prep();__cov_gudzmr64nR2l4_Co1Wlh9w.s['23']++;dd.fire('drag:mouseDown',{ev:e});}else{__cov_gudzmr64nR2l4_Co1Wlh9w.b['1'][1]++;}},_onMouseEnter:function(){__cov_gudzmr64nR2l4_Co1Wlh9w.f['6']++;__cov_gudzmr64nR2l4_Co1Wlh9w.s['24']++;this._shimState=Y.DD.DDM._noShim;__cov_gudzmr64nR2l4_Co1Wlh9w.s['25']++;Y.DD.DDM._noShim=true;},_onMouseLeave:function(){__cov_gudzmr64nR2l4_Co1Wlh9w.f['7']++;__cov_gudzmr64nR2l4_Co1Wlh9w.s['26']++;Y.DD.DDM._noShim=this._shimState;},initializer:function(){__cov_gudzmr64nR2l4_Co1Wlh9w.f['8']++;__cov_gudzmr64nR2l4_Co1Wlh9w.s['27']++;this._handles=[];__cov_gudzmr64nR2l4_Co1Wlh9w.s['28']++;var conf=(__cov_gudzmr64nR2l4_Co1Wlh9w.b['6'][0]++,this.get('dragConfig'))||(__cov_gudzmr64nR2l4_Co1Wlh9w.b['6'][1]++,{}),cont=this.get(CONT);__cov_gudzmr64nR2l4_Co1Wlh9w.s['29']++;conf.node=_tmpNode.cloneNode(true);__cov_gudzmr64nR2l4_Co1Wlh9w.s['30']++;conf.bubbleTargets=this;__cov_gudzmr64nR2l4_Co1Wlh9w.s['31']++;if(this.get('handles')){__cov_gudzmr64nR2l4_Co1Wlh9w.b['7'][0]++;__cov_gudzmr64nR2l4_Co1Wlh9w.s['32']++;conf.handles=this.get('handles');}else{__cov_gudzmr64nR2l4_Co1Wlh9w.b['7'][1]++;}__cov_gudzmr64nR2l4_Co1Wlh9w.s['33']++;this.dd=new Y.DD.Drag(conf);__cov_gudzmr64nR2l4_Co1Wlh9w.s['34']++;this.dd.after('drag:end',Y.bind(this._afterDragEnd,this));__cov_gudzmr64nR2l4_Co1Wlh9w.s['35']++;this.dd.on('dragNodeChange',Y.bind(this._onNodeChange,this));__cov_gudzmr64nR2l4_Co1Wlh9w.s['36']++;this.dd.after('drag:mouseup',function(){__cov_gudzmr64nR2l4_Co1Wlh9w.f['9']++;__cov_gudzmr64nR2l4_Co1Wlh9w.s['37']++;this._unprep();});__cov_gudzmr64nR2l4_Co1Wlh9w.s['38']++;this._handles.push(Y.delegate(Y.DD.Drag.START_EVENT,Y.bind(this._delMouseDown,this),cont,this.get(NODES)));__cov_gudzmr64nR2l4_Co1Wlh9w.s['39']++;this._handles.push(Y.on('mouseenter',Y.bind(this._onMouseEnter,this),cont));__cov_gudzmr64nR2l4_Co1Wlh9w.s['40']++;this._handles.push(Y.on('mouseleave',Y.bind(this._onMouseLeave,this),cont));__cov_gudzmr64nR2l4_Co1Wlh9w.s['41']++;Y.later(50,this,this.syncTargets);__cov_gudzmr64nR2l4_Co1Wlh9w.s['42']++;Y.DD.DDM.regDelegate(this);},syncTargets:function(){__cov_gudzmr64nR2l4_Co1Wlh9w.f['10']++;__cov_gudzmr64nR2l4_Co1Wlh9w.s['43']++;if((__cov_gudzmr64nR2l4_Co1Wlh9w.b['9'][0]++,!Y.Plugin.Drop)||(__cov_gudzmr64nR2l4_Co1Wlh9w.b['9'][1]++,this.get('destroyed'))){__cov_gudzmr64nR2l4_Co1Wlh9w.b['8'][0]++;__cov_gudzmr64nR2l4_Co1Wlh9w.s['44']++;return;}else{__cov_gudzmr64nR2l4_Co1Wlh9w.b['8'][1]++;}__cov_gudzmr64nR2l4_Co1Wlh9w.s['45']++;var items,groups,config;__cov_gudzmr64nR2l4_Co1Wlh9w.s['46']++;if(this.get('target')){__cov_gudzmr64nR2l4_Co1Wlh9w.b['10'][0]++;__cov_gudzmr64nR2l4_Co1Wlh9w.s['47']++;items=Y.one(this.get(CONT)).all(this.get(NODES));__cov_gudzmr64nR2l4_Co1Wlh9w.s['48']++;groups=this.dd.get('groups');__cov_gudzmr64nR2l4_Co1Wlh9w.s['49']++;config=this.get('dragConfig');__cov_gudzmr64nR2l4_Co1Wlh9w.s['50']++;if((__cov_gudzmr64nR2l4_Co1Wlh9w.b['12'][0]++,config)&&(__cov_gudzmr64nR2l4_Co1Wlh9w.b['12'][1]++,config.groups)){__cov_gudzmr64nR2l4_Co1Wlh9w.b['11'][0]++;__cov_gudzmr64nR2l4_Co1Wlh9w.s['51']++;groups=config.groups;}else{__cov_gudzmr64nR2l4_Co1Wlh9w.b['11'][1]++;}__cov_gudzmr64nR2l4_Co1Wlh9w.s['52']++;items.each(function(i){__cov_gudzmr64nR2l4_Co1Wlh9w.f['11']++;__cov_gudzmr64nR2l4_Co1Wlh9w.s['53']++;this.createDrop(i,groups);},this);}else{__cov_gudzmr64nR2l4_Co1Wlh9w.b['10'][1]++;}__cov_gudzmr64nR2l4_Co1Wlh9w.s['54']++;return this;},createDrop:function(node,groups){__cov_gudzmr64nR2l4_Co1Wlh9w.f['12']++;__cov_gudzmr64nR2l4_Co1Wlh9w.s['55']++;var config={useShim:false,bubbleTargets:this};__cov_gudzmr64nR2l4_Co1Wlh9w.s['56']++;if(!node.drop){__cov_gudzmr64nR2l4_Co1Wlh9w.b['13'][0]++;__cov_gudzmr64nR2l4_Co1Wlh9w.s['57']++;node.plug(Y.Plugin.Drop,config);}else{__cov_gudzmr64nR2l4_Co1Wlh9w.b['13'][1]++;}__cov_gudzmr64nR2l4_Co1Wlh9w.s['58']++;node.drop.set('groups',groups);__cov_gudzmr64nR2l4_Co1Wlh9w.s['59']++;return node;},destructor:function(){__cov_gudzmr64nR2l4_Co1Wlh9w.f['13']++;__cov_gudzmr64nR2l4_Co1Wlh9w.s['60']++;if(this.dd){__cov_gudzmr64nR2l4_Co1Wlh9w.b['14'][0]++;__cov_gudzmr64nR2l4_Co1Wlh9w.s['61']++;this.dd.destroy();}else{__cov_gudzmr64nR2l4_Co1Wlh9w.b['14'][1]++;}__cov_gudzmr64nR2l4_Co1Wlh9w.s['62']++;if(Y.Plugin.Drop){__cov_gudzmr64nR2l4_Co1Wlh9w.b['15'][0]++;__cov_gudzmr64nR2l4_Co1Wlh9w.s['63']++;var targets=Y.one(this.get(CONT)).all(this.get(NODES));__cov_gudzmr64nR2l4_Co1Wlh9w.s['64']++;targets.unplug(Y.Plugin.Drop);}else{__cov_gudzmr64nR2l4_Co1Wlh9w.b['15'][1]++;}__cov_gudzmr64nR2l4_Co1Wlh9w.s['65']++;Y.Array.each(this._handles,function(v){__cov_gudzmr64nR2l4_Co1Wlh9w.f['14']++;__cov_gudzmr64nR2l4_Co1Wlh9w.s['66']++;v.detach();});}},{NAME:'delegate',ATTRS:{container:{value:'body'},nodes:{value:'.dd-draggable'},invalid:{value:'input, select, button, a, textarea'},lastNode:{value:_tmpNode},currentNode:{value:_tmpNode},dragNode:{value:_tmpNode},over:{value:false},target:{value:false},dragConfig:{value:null},handles:{value:null}}});__cov_gudzmr64nR2l4_Co1Wlh9w.s['67']++;Y.mix(Y.DD.DDM,{_delegates:[],regDelegate:function(del){__cov_gudzmr64nR2l4_Co1Wlh9w.f['15']++;__cov_gudzmr64nR2l4_Co1Wlh9w.s['68']++;this._delegates.push(del);},getDelegate:function(node){__cov_gudzmr64nR2l4_Co1Wlh9w.f['16']++;__cov_gudzmr64nR2l4_Co1Wlh9w.s['69']++;var del=null;__cov_gudzmr64nR2l4_Co1Wlh9w.s['70']++;node=Y.one(node);__cov_gudzmr64nR2l4_Co1Wlh9w.s['71']++;Y.Array.each(this._delegates,function(v){__cov_gudzmr64nR2l4_Co1Wlh9w.f['17']++;__cov_gudzmr64nR2l4_Co1Wlh9w.s['72']++;if(node.test(v.get(CONT))){__cov_gudzmr64nR2l4_Co1Wlh9w.b['16'][0]++;__cov_gudzmr64nR2l4_Co1Wlh9w.s['73']++;del=v;}else{__cov_gudzmr64nR2l4_Co1Wlh9w.b['16'][1]++;}},this);__cov_gudzmr64nR2l4_Co1Wlh9w.s['74']++;return del;}});__cov_gudzmr64nR2l4_Co1Wlh9w.s['75']++;Y.namespace('DD');__cov_gudzmr64nR2l4_Co1Wlh9w.s['76']++;Y.DD.Delegate=Delegate;},'@VERSION@',{'requires':['dd-drag','dd-drop-plugin','event-mouseenter']}); diff --git a/src/build/dd-delegate/dd-delegate-debug.js b/src/build/dd-delegate/dd-delegate-debug.js new file mode 100644 index 00000000000..46382cd1cc0 --- /dev/null +++ b/src/build/dd-delegate/dd-delegate-debug.js @@ -0,0 +1,337 @@ +YUI.add('dd-delegate', function (Y, NAME) { + + + /** + * Provides the ability to drag multiple nodes under a container element using only one Y.DD.Drag instance as a delegate. + * @module dd + * @submodule dd-delegate + */ + /** + * Provides the ability to drag multiple nodes under a container element using only one Y.DD.Drag instance as a delegate. + * @class Delegate + * @extends Base + * @constructor + * @namespace DD + */ + + + var Delegate = function() { + Delegate.superclass.constructor.apply(this, arguments); + }, + CONT = 'container', + NODES = 'nodes', + _tmpNode = Y.Node.create('
Temp Node
'); + + + Y.extend(Delegate, Y.Base, { + /** + * The default bubbleTarget for this object. Default: Y.DD.DDM + * @private + * @property _bubbleTargets + */ + _bubbleTargets: Y.DD.DDM, + /** + * A reference to the temporary dd instance used under the hood. + * @property dd + */ + dd: null, + /** + * The state of the Y.DD.DDM._noShim property to it can be reset. + * @property _shimState + * @private + */ + _shimState: null, + /** + * Array of event handles to be destroyed + * @private + * @property _handles + */ + _handles: null, + /** + * Listens to the nodeChange event and sets the dragNode on the temp dd instance. + * @private + * @method _onNodeChange + * @param {Event} e The Event. + */ + _onNodeChange: function(e) { + this.set('dragNode', e.newVal); + }, + /** + * Listens for the drag:end event and updates the temp dd instance. + * @private + * @method _afterDragEnd + * @param {Event} e The Event. + */ + _afterDragEnd: function() { + Y.DD.DDM._noShim = this._shimState; + + this.set('lastNode', this.dd.get('node')); + this.get('lastNode').removeClass(Y.DD.DDM.CSS_PREFIX + '-dragging'); + this.dd._unprep(); + this.dd.set('node', _tmpNode); + }, + /** + * The callback for the Y.DD.Delegate instance used + * @private + * @method _delMouseDown + * @param {Event} e The MouseDown Event. + */ + _delMouseDown: function(e) { + var tar = e.currentTarget, + dd = this.dd, + dNode = tar, + config = this.get('dragConfig'); + + if (tar.test(this.get(NODES)) && !tar.test(this.get('invalid'))) { + this._shimState = Y.DD.DDM._noShim; + Y.DD.DDM._noShim = true; + this.set('currentNode', tar); + dd.set('node', tar); + if (config && config.dragNode) { + dNode = config.dragNode; + } else if (dd.proxy) { + dNode = Y.DD.DDM._proxy; + } + dd.set('dragNode', dNode); + dd._prep(); + + dd.fire('drag:mouseDown', { ev: e }); + } + }, + /** + * Sets the target shim state + * @private + * @method _onMouseEnter + * @param {Event} e The MouseEnter Event + */ + _onMouseEnter: function() { + this._shimState = Y.DD.DDM._noShim; + Y.DD.DDM._noShim = true; + }, + /** + * Resets the target shim state + * @private + * @method _onMouseLeave + * @param {Event} e The MouseLeave Event + */ + _onMouseLeave: function() { + Y.DD.DDM._noShim = this._shimState; + }, + initializer: function() { + this._handles = []; + //Create a tmp DD instance under the hood. + //var conf = Y.clone(this.get('dragConfig') || {}), + var conf = this.get('dragConfig') || {}, + cont = this.get(CONT); + + conf.node = _tmpNode.cloneNode(true); + conf.bubbleTargets = this; + + if (this.get('handles')) { + conf.handles = this.get('handles'); + } + + this.dd = new Y.DD.Drag(conf); + + //On end drag, detach the listeners + this.dd.after('drag:end', Y.bind(this._afterDragEnd, this)); + this.dd.on('dragNodeChange', Y.bind(this._onNodeChange, this)); + this.dd.after('drag:mouseup', function() { + this._unprep(); + }); + + //Attach the delegate to the container + this._handles.push(Y.delegate(Y.DD.Drag.START_EVENT, Y.bind(this._delMouseDown, this), cont, this.get(NODES))); + + this._handles.push(Y.on('mouseenter', Y.bind(this._onMouseEnter, this), cont)); + + this._handles.push(Y.on('mouseleave', Y.bind(this._onMouseLeave, this), cont)); + + Y.later(50, this, this.syncTargets); + Y.DD.DDM.regDelegate(this); + }, + /** + * Applies the Y.Plugin.Drop to all nodes matching the cont + nodes selector query. + * @method syncTargets + * @chainable + */ + syncTargets: function() { + if (!Y.Plugin.Drop || this.get('destroyed')) { + return; + } + var items, groups, config; + + if (this.get('target')) { + items = Y.one(this.get(CONT)).all(this.get(NODES)); + groups = this.dd.get('groups'); + config = this.get('dragConfig'); + + if (config && config.groups) { + groups = config.groups; + } + + items.each(function(i) { + this.createDrop(i, groups); + }, this); + } + return this; + }, + /** + * Apply the Drop plugin to this node + * @method createDrop + * @param {Node} node The Node to apply the plugin to + * @param {Array} groups The default groups to assign this target to. + * @return Node + */ + createDrop: function(node, groups) { + var config = { + useShim: false, + bubbleTargets: this + }; + + if (!node.drop) { + node.plug(Y.Plugin.Drop, config); + } + node.drop.set('groups', groups); + return node; + }, + destructor: function() { + if (this.dd) { + this.dd.destroy(); + } + if (Y.Plugin.Drop) { + var targets = Y.one(this.get(CONT)).all(this.get(NODES)); + targets.unplug(Y.Plugin.Drop); + } + Y.Array.each(this._handles, function(v) { + v.detach(); + }); + } + }, { + NAME: 'delegate', + ATTRS: { + /** + * A selector query to get the container to listen for mousedown events on. All "nodes" should be a child of this container. + * @attribute container + * @type String + */ + container: { + value: 'body' + }, + /** + * A selector query to get the children of the "container" to make draggable elements from. + * @attribute nodes + * @type String + */ + nodes: { + value: '.dd-draggable' + }, + /** + * A selector query to test a node to see if it's an invalid item. + * @attribute invalid + * @type String + */ + invalid: { + value: 'input, select, button, a, textarea' + }, + /** + * Y.Node instance of the last item dragged. + * @attribute lastNode + * @type Node + */ + lastNode: { + value: _tmpNode + }, + /** + * Y.Node instance of the dd node. + * @attribute currentNode + * @type Node + */ + currentNode: { + value: _tmpNode + }, + /** + * Y.Node instance of the dd dragNode. + * @attribute dragNode + * @type Node + */ + dragNode: { + value: _tmpNode + }, + /** + * Is the mouse currently over the container + * @attribute over + * @type Boolean + */ + over: { + value: false + }, + /** + * Should the items also be a drop target. + * @attribute target + * @type Boolean + */ + target: { + value: false + }, + /** + * The default config to be used when creating the DD instance. + * @attribute dragConfig + * @type Object + */ + dragConfig: { + value: null + }, + /** + * The handles config option added to the temp DD instance. + * @attribute handles + * @type Array + */ + handles: { + value: null + } + } + }); + + Y.mix(Y.DD.DDM, { + /** + * Holder for all Y.DD.Delegate instances + * @private + * @for DDM + * @property _delegates + * @type Array + */ + _delegates: [], + /** + * Register a Delegate with the DDM + * @for DDM + * @method regDelegate + */ + regDelegate: function(del) { + this._delegates.push(del); + }, + /** + * Get a delegate instance from a container node + * @for DDM + * @method getDelegate + * @return Y.DD.Delegate + */ + getDelegate: function(node) { + var del = null; + node = Y.one(node); + Y.Array.each(this._delegates, function(v) { + if (node.test(v.get(CONT))) { + del = v; + } + }, this); + return del; + } + }); + + Y.namespace('DD'); + Y.DD.Delegate = Delegate; + + + + +}, '@VERSION@', {"requires": ["dd-drag", "dd-drop-plugin", "event-mouseenter"]}); diff --git a/src/build/dd-delegate/dd-delegate-min.js b/src/build/dd-delegate/dd-delegate-min.js new file mode 100644 index 00000000000..38fe26e68ac --- /dev/null +++ b/src/build/dd-delegate/dd-delegate-min.js @@ -0,0 +1 @@ +YUI.add("dd-delegate",function(e,t){var n=function(){n.superclass.constructor.apply(this,arguments)},r="container",i="nodes",s=e.Node.create("
Temp Node
");e.extend(n,e.Base,{_bubbleTargets:e.DD.DDM,dd:null,_shimState:null,_handles:null,_onNodeChange:function(e){this.set("dragNode",e.newVal)},_afterDragEnd:function(){e.DD.DDM._noShim=this._shimState,this.set("lastNode",this.dd.get("node")),this.get("lastNode").removeClass(e.DD.DDM.CSS_PREFIX+"-dragging"),this.dd._unprep(),this.dd.set("node",s)},_delMouseDown:function(t){var n=t.currentTarget,r=this.dd,s=n,o=this.get("dragConfig");n.test(this.get(i))&&!n.test(this.get("invalid"))&&(this._shimState=e.DD.DDM._noShim,e.DD.DDM._noShim=!0,this.set("currentNode",n),r.set("node",n),o&&o.dragNode?s=o.dragNode:r.proxy&&(s=e.DD.DDM._proxy),r.set("dragNode",s),r._prep(),r.fire("drag:mouseDown",{ev:t}))},_onMouseEnter:function(){this._shimState=e.DD.DDM._noShim,e.DD.DDM._noShim=!0},_onMouseLeave:function(){e.DD.DDM._noShim=this._shimState},initializer:function(){this._handles=[];var t=this.get("dragConfig")||{},n=this.get(r);t.node=s.cloneNode(!0),t.bubbleTargets=this,this.get("handles")&&(t.handles=this.get("handles")),this.dd=new e.DD.Drag(t),this.dd.after("drag:end",e.bind(this._afterDragEnd,this)),this.dd.on("dragNodeChange",e.bind(this._onNodeChange,this)),this.dd.after("drag:mouseup",function(){this._unprep()}),this._handles.push(e.delegate(e.DD.Drag.START_EVENT,e.bind(this._delMouseDown,this),n,this.get(i))),this._handles.push(e.on("mouseenter",e.bind(this._onMouseEnter,this),n)),this._handles.push(e.on("mouseleave",e.bind(this._onMouseLeave,this),n)),e.later(50,this,this.syncTargets),e.DD.DDM.regDelegate(this)},syncTargets:function(){if(!e.Plugin.Drop||this.get("destroyed"))return;var t,n,s;return this.get("target")&&(t=e.one(this.get(r)).all(this.get(i)),n=this.dd.get("groups"),s=this.get("dragConfig"),s&&s.groups&&(n=s.groups),t.each(function(e){this.createDrop(e,n)},this)),this},createDrop:function(t,n){var r={useShim:!1,bubbleTargets:this};return t.drop||t.plug(e.Plugin.Drop,r),t.drop.set("groups",n),t},destructor:function(){this.dd&&this.dd.destroy();if(e.Plugin.Drop){var t=e.one(this.get(r)).all(this.get(i));t.unplug(e.Plugin.Drop)}e.Array.each(this._handles,function(e){e.detach()})}},{NAME:"delegate",ATTRS:{container:{value:"body"},nodes:{value:".dd-draggable"},invalid:{value:"input, select, button, a, textarea"},lastNode:{value:s},currentNode:{value:s},dragNode:{value:s},over:{value:!1},target:{value:!1},dragConfig:{value:null},handles:{value:null}}}),e.mix(e.DD.DDM,{_delegates:[],regDelegate:function(e){this._delegates.push(e)},getDelegate:function(t){var n=null;return t=e.one(t),e.Array.each(this._delegates,function(e){t.test(e.get(r))&&(n=e)},this),n}}),e.namespace("DD"),e.DD.Delegate=n},"@VERSION@",{requires:["dd-drag","dd-drop-plugin","event-mouseenter"]}); diff --git a/src/build/dd-delegate/dd-delegate.js b/src/build/dd-delegate/dd-delegate.js new file mode 100644 index 00000000000..46382cd1cc0 --- /dev/null +++ b/src/build/dd-delegate/dd-delegate.js @@ -0,0 +1,337 @@ +YUI.add('dd-delegate', function (Y, NAME) { + + + /** + * Provides the ability to drag multiple nodes under a container element using only one Y.DD.Drag instance as a delegate. + * @module dd + * @submodule dd-delegate + */ + /** + * Provides the ability to drag multiple nodes under a container element using only one Y.DD.Drag instance as a delegate. + * @class Delegate + * @extends Base + * @constructor + * @namespace DD + */ + + + var Delegate = function() { + Delegate.superclass.constructor.apply(this, arguments); + }, + CONT = 'container', + NODES = 'nodes', + _tmpNode = Y.Node.create('
Temp Node
'); + + + Y.extend(Delegate, Y.Base, { + /** + * The default bubbleTarget for this object. Default: Y.DD.DDM + * @private + * @property _bubbleTargets + */ + _bubbleTargets: Y.DD.DDM, + /** + * A reference to the temporary dd instance used under the hood. + * @property dd + */ + dd: null, + /** + * The state of the Y.DD.DDM._noShim property to it can be reset. + * @property _shimState + * @private + */ + _shimState: null, + /** + * Array of event handles to be destroyed + * @private + * @property _handles + */ + _handles: null, + /** + * Listens to the nodeChange event and sets the dragNode on the temp dd instance. + * @private + * @method _onNodeChange + * @param {Event} e The Event. + */ + _onNodeChange: function(e) { + this.set('dragNode', e.newVal); + }, + /** + * Listens for the drag:end event and updates the temp dd instance. + * @private + * @method _afterDragEnd + * @param {Event} e The Event. + */ + _afterDragEnd: function() { + Y.DD.DDM._noShim = this._shimState; + + this.set('lastNode', this.dd.get('node')); + this.get('lastNode').removeClass(Y.DD.DDM.CSS_PREFIX + '-dragging'); + this.dd._unprep(); + this.dd.set('node', _tmpNode); + }, + /** + * The callback for the Y.DD.Delegate instance used + * @private + * @method _delMouseDown + * @param {Event} e The MouseDown Event. + */ + _delMouseDown: function(e) { + var tar = e.currentTarget, + dd = this.dd, + dNode = tar, + config = this.get('dragConfig'); + + if (tar.test(this.get(NODES)) && !tar.test(this.get('invalid'))) { + this._shimState = Y.DD.DDM._noShim; + Y.DD.DDM._noShim = true; + this.set('currentNode', tar); + dd.set('node', tar); + if (config && config.dragNode) { + dNode = config.dragNode; + } else if (dd.proxy) { + dNode = Y.DD.DDM._proxy; + } + dd.set('dragNode', dNode); + dd._prep(); + + dd.fire('drag:mouseDown', { ev: e }); + } + }, + /** + * Sets the target shim state + * @private + * @method _onMouseEnter + * @param {Event} e The MouseEnter Event + */ + _onMouseEnter: function() { + this._shimState = Y.DD.DDM._noShim; + Y.DD.DDM._noShim = true; + }, + /** + * Resets the target shim state + * @private + * @method _onMouseLeave + * @param {Event} e The MouseLeave Event + */ + _onMouseLeave: function() { + Y.DD.DDM._noShim = this._shimState; + }, + initializer: function() { + this._handles = []; + //Create a tmp DD instance under the hood. + //var conf = Y.clone(this.get('dragConfig') || {}), + var conf = this.get('dragConfig') || {}, + cont = this.get(CONT); + + conf.node = _tmpNode.cloneNode(true); + conf.bubbleTargets = this; + + if (this.get('handles')) { + conf.handles = this.get('handles'); + } + + this.dd = new Y.DD.Drag(conf); + + //On end drag, detach the listeners + this.dd.after('drag:end', Y.bind(this._afterDragEnd, this)); + this.dd.on('dragNodeChange', Y.bind(this._onNodeChange, this)); + this.dd.after('drag:mouseup', function() { + this._unprep(); + }); + + //Attach the delegate to the container + this._handles.push(Y.delegate(Y.DD.Drag.START_EVENT, Y.bind(this._delMouseDown, this), cont, this.get(NODES))); + + this._handles.push(Y.on('mouseenter', Y.bind(this._onMouseEnter, this), cont)); + + this._handles.push(Y.on('mouseleave', Y.bind(this._onMouseLeave, this), cont)); + + Y.later(50, this, this.syncTargets); + Y.DD.DDM.regDelegate(this); + }, + /** + * Applies the Y.Plugin.Drop to all nodes matching the cont + nodes selector query. + * @method syncTargets + * @chainable + */ + syncTargets: function() { + if (!Y.Plugin.Drop || this.get('destroyed')) { + return; + } + var items, groups, config; + + if (this.get('target')) { + items = Y.one(this.get(CONT)).all(this.get(NODES)); + groups = this.dd.get('groups'); + config = this.get('dragConfig'); + + if (config && config.groups) { + groups = config.groups; + } + + items.each(function(i) { + this.createDrop(i, groups); + }, this); + } + return this; + }, + /** + * Apply the Drop plugin to this node + * @method createDrop + * @param {Node} node The Node to apply the plugin to + * @param {Array} groups The default groups to assign this target to. + * @return Node + */ + createDrop: function(node, groups) { + var config = { + useShim: false, + bubbleTargets: this + }; + + if (!node.drop) { + node.plug(Y.Plugin.Drop, config); + } + node.drop.set('groups', groups); + return node; + }, + destructor: function() { + if (this.dd) { + this.dd.destroy(); + } + if (Y.Plugin.Drop) { + var targets = Y.one(this.get(CONT)).all(this.get(NODES)); + targets.unplug(Y.Plugin.Drop); + } + Y.Array.each(this._handles, function(v) { + v.detach(); + }); + } + }, { + NAME: 'delegate', + ATTRS: { + /** + * A selector query to get the container to listen for mousedown events on. All "nodes" should be a child of this container. + * @attribute container + * @type String + */ + container: { + value: 'body' + }, + /** + * A selector query to get the children of the "container" to make draggable elements from. + * @attribute nodes + * @type String + */ + nodes: { + value: '.dd-draggable' + }, + /** + * A selector query to test a node to see if it's an invalid item. + * @attribute invalid + * @type String + */ + invalid: { + value: 'input, select, button, a, textarea' + }, + /** + * Y.Node instance of the last item dragged. + * @attribute lastNode + * @type Node + */ + lastNode: { + value: _tmpNode + }, + /** + * Y.Node instance of the dd node. + * @attribute currentNode + * @type Node + */ + currentNode: { + value: _tmpNode + }, + /** + * Y.Node instance of the dd dragNode. + * @attribute dragNode + * @type Node + */ + dragNode: { + value: _tmpNode + }, + /** + * Is the mouse currently over the container + * @attribute over + * @type Boolean + */ + over: { + value: false + }, + /** + * Should the items also be a drop target. + * @attribute target + * @type Boolean + */ + target: { + value: false + }, + /** + * The default config to be used when creating the DD instance. + * @attribute dragConfig + * @type Object + */ + dragConfig: { + value: null + }, + /** + * The handles config option added to the temp DD instance. + * @attribute handles + * @type Array + */ + handles: { + value: null + } + } + }); + + Y.mix(Y.DD.DDM, { + /** + * Holder for all Y.DD.Delegate instances + * @private + * @for DDM + * @property _delegates + * @type Array + */ + _delegates: [], + /** + * Register a Delegate with the DDM + * @for DDM + * @method regDelegate + */ + regDelegate: function(del) { + this._delegates.push(del); + }, + /** + * Get a delegate instance from a container node + * @for DDM + * @method getDelegate + * @return Y.DD.Delegate + */ + getDelegate: function(node) { + var del = null; + node = Y.one(node); + Y.Array.each(this._delegates, function(v) { + if (node.test(v.get(CONT))) { + del = v; + } + }, this); + return del; + } + }); + + Y.namespace('DD'); + Y.DD.Delegate = Delegate; + + + + +}, '@VERSION@', {"requires": ["dd-drag", "dd-drop-plugin", "event-mouseenter"]}); diff --git a/src/build/dd-drag/dd-drag-coverage.js b/src/build/dd-drag/dd-drag-coverage.js new file mode 100644 index 00000000000..800e5289c87 --- /dev/null +++ b/src/build/dd-drag/dd-drag-coverage.js @@ -0,0 +1,6 @@ +if (typeof __coverage__ === 'undefined') { __coverage__ = {}; } +if (!__coverage__['build/dd-drag/dd-drag.js']) { + __coverage__['build/dd-drag/dd-drag.js'] = {"path":"build/dd-drag/dd-drag.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0,"106":0,"107":0,"108":0,"109":0,"110":0,"111":0,"112":0,"113":0,"114":0,"115":0,"116":0,"117":0,"118":0,"119":0,"120":0,"121":0,"122":0,"123":0,"124":0,"125":0,"126":0,"127":0,"128":0,"129":0,"130":0,"131":0,"132":0,"133":0,"134":0,"135":0,"136":0,"137":0,"138":0,"139":0,"140":0,"141":0,"142":0,"143":0,"144":0,"145":0,"146":0,"147":0,"148":0,"149":0,"150":0,"151":0,"152":0,"153":0,"154":0,"155":0,"156":0,"157":0,"158":0,"159":0,"160":0,"161":0,"162":0,"163":0,"164":0,"165":0,"166":0,"167":0,"168":0,"169":0,"170":0,"171":0,"172":0,"173":0,"174":0,"175":0,"176":0,"177":0,"178":0,"179":0,"180":0,"181":0,"182":0,"183":0,"184":0,"185":0,"186":0,"187":0,"188":0,"189":0,"190":0,"191":0,"192":0,"193":0,"194":0,"195":0,"196":0,"197":0,"198":0,"199":0,"200":0,"201":0,"202":0,"203":0,"204":0,"205":0,"206":0,"207":0,"208":0,"209":0,"210":0,"211":0,"212":0,"213":0,"214":0,"215":0,"216":0,"217":0,"218":0,"219":0,"220":0,"221":0,"222":0,"223":0,"224":0,"225":0,"226":0,"227":0,"228":0,"229":0,"230":0,"231":0,"232":0,"233":0,"234":0,"235":0,"236":0,"237":0,"238":0,"239":0,"240":0,"241":0,"242":0,"243":0,"244":0,"245":0,"246":0,"247":0,"248":0,"249":0,"250":0,"251":0,"252":0,"253":0,"254":0,"255":0,"256":0,"257":0,"258":0,"259":0,"260":0,"261":0,"262":0,"263":0,"264":0,"265":0,"266":0,"267":0,"268":0,"269":0,"270":0,"271":0,"272":0,"273":0,"274":0},"b":{"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0],"8":[0,0],"9":[0,0],"10":[0,0],"11":[0,0],"12":[0,0,0,0,0],"13":[0,0],"14":[0,0],"15":[0,0],"16":[0,0],"17":[0,0],"18":[0,0],"19":[0,0],"20":[0,0],"21":[0,0],"22":[0,0],"23":[0,0],"24":[0,0],"25":[0,0],"26":[0,0],"27":[0,0],"28":[0,0],"29":[0,0],"30":[0,0],"31":[0,0],"32":[0,0],"33":[0,0],"34":[0,0],"35":[0,0],"36":[0,0],"37":[0,0],"38":[0,0],"39":[0,0],"40":[0,0],"41":[0,0],"42":[0,0],"43":[0,0],"44":[0,0],"45":[0,0],"46":[0,0,0],"47":[0,0],"48":[0,0],"49":[0,0,0],"50":[0,0],"51":[0,0],"52":[0,0],"53":[0,0],"54":[0,0],"55":[0,0],"56":[0,0],"57":[0,0],"58":[0,0],"59":[0,0],"60":[0,0],"61":[0,0],"62":[0,0],"63":[0,0],"64":[0,0],"65":[0,0],"66":[0,0],"67":[0,0],"68":[0,0],"69":[0,0],"70":[0,0],"71":[0,0],"72":[0,0],"73":[0,0],"74":[0,0],"75":[0,0],"76":[0,0],"77":[0,0],"78":[0,0],"79":[0,0]},"f":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":38}}},"2":{"name":"(anonymous_2)","line":194,"loc":{"start":{"line":194,"column":11},"end":{"line":194,"column":23}}},"3":{"name":"(anonymous_3)","line":220,"loc":{"start":{"line":220,"column":20},"end":{"line":220,"column":35}}},"4":{"name":"(anonymous_4)","line":237,"loc":{"start":{"line":237,"column":20},"end":{"line":237,"column":35}}},"5":{"name":"(anonymous_5)","line":287,"loc":{"start":{"line":287,"column":20},"end":{"line":287,"column":35}}},"6":{"name":"(anonymous_6)","line":355,"loc":{"start":{"line":355,"column":20},"end":{"line":355,"column":37}}},"7":{"name":"(anonymous_7)","line":367,"loc":{"start":{"line":367,"column":20},"end":{"line":367,"column":35}}},"8":{"name":"(anonymous_8)","line":378,"loc":{"start":{"line":378,"column":20},"end":{"line":378,"column":31}}},"9":{"name":"(anonymous_9)","line":386,"loc":{"start":{"line":386,"column":20},"end":{"line":386,"column":32}}},"10":{"name":"(anonymous_10)","line":398,"loc":{"start":{"line":398,"column":20},"end":{"line":398,"column":32}}},"11":{"name":"(anonymous_11)","line":401,"loc":{"start":{"line":401,"column":36},"end":{"line":401,"column":48}}},"12":{"name":"(anonymous_12)","line":421,"loc":{"start":{"line":421,"column":20},"end":{"line":421,"column":32}}},"13":{"name":"(anonymous_13)","line":446,"loc":{"start":{"line":446,"column":18},"end":{"line":446,"column":30}}},"14":{"name":"(anonymous_14)","line":464,"loc":{"start":{"line":464,"column":20},"end":{"line":464,"column":32}}},"15":{"name":"(anonymous_15)","line":475,"loc":{"start":{"line":475,"column":25},"end":{"line":475,"column":37}}},"16":{"name":"(anonymous_16)","line":492,"loc":{"start":{"line":492,"column":23},"end":{"line":492,"column":40}}},"17":{"name":"(anonymous_17)","line":522,"loc":{"start":{"line":522,"column":23},"end":{"line":522,"column":34}}},"18":{"name":"(anonymous_18)","line":571,"loc":{"start":{"line":571,"column":29},"end":{"line":571,"column":41}}},"19":{"name":"(anonymous_19)","line":699,"loc":{"start":{"line":699,"column":24},"end":{"line":699,"column":35}}},"20":{"name":"(anonymous_20)","line":713,"loc":{"start":{"line":713,"column":23},"end":{"line":713,"column":35}}},"21":{"name":"(anonymous_21)","line":723,"loc":{"start":{"line":723,"column":22},"end":{"line":723,"column":33}}},"22":{"name":"(anonymous_22)","line":737,"loc":{"start":{"line":737,"column":25},"end":{"line":737,"column":36}}},"23":{"name":"(anonymous_23)","line":748,"loc":{"start":{"line":748,"column":23},"end":{"line":748,"column":34}}},"24":{"name":"(anonymous_24)","line":759,"loc":{"start":{"line":759,"column":31},"end":{"line":759,"column":44}}},"25":{"name":"(anonymous_25)","line":768,"loc":{"start":{"line":768,"column":25},"end":{"line":768,"column":37}}},"26":{"name":"(anonymous_26)","line":804,"loc":{"start":{"line":804,"column":20},"end":{"line":804,"column":33}}},"27":{"name":"(anonymous_27)","line":812,"loc":{"start":{"line":812,"column":45},"end":{"line":812,"column":60}}},"28":{"name":"(anonymous_28)","line":819,"loc":{"start":{"line":819,"column":39},"end":{"line":819,"column":52}}},"29":{"name":"(anonymous_29)","line":841,"loc":{"start":{"line":841,"column":50},"end":{"line":841,"column":65}}},"30":{"name":"(anonymous_30)","line":855,"loc":{"start":{"line":855,"column":29},"end":{"line":855,"column":41}}},"31":{"name":"(anonymous_31)","line":873,"loc":{"start":{"line":873,"column":27},"end":{"line":873,"column":40}}},"32":{"name":"(anonymous_32)","line":889,"loc":{"start":{"line":889,"column":23},"end":{"line":889,"column":34}}},"33":{"name":"(anonymous_33)","line":902,"loc":{"start":{"line":902,"column":22},"end":{"line":902,"column":36}}},"34":{"name":"(anonymous_34)","line":919,"loc":{"start":{"line":919,"column":19},"end":{"line":919,"column":33}}},"35":{"name":"(anonymous_35)","line":937,"loc":{"start":{"line":937,"column":23},"end":{"line":937,"column":37}}},"36":{"name":"(anonymous_36)","line":951,"loc":{"start":{"line":951,"column":20},"end":{"line":951,"column":34}}},"37":{"name":"(anonymous_37)","line":963,"loc":{"start":{"line":963,"column":21},"end":{"line":963,"column":32}}},"38":{"name":"(anonymous_38)","line":994,"loc":{"start":{"line":994,"column":15},"end":{"line":994,"column":26}}},"39":{"name":"(anonymous_39)","line":1007,"loc":{"start":{"line":1007,"column":17},"end":{"line":1007,"column":28}}},"40":{"name":"(anonymous_40)","line":1026,"loc":{"start":{"line":1026,"column":15},"end":{"line":1026,"column":26}}},"41":{"name":"(anonymous_41)","line":1067,"loc":{"start":{"line":1067,"column":13},"end":{"line":1067,"column":24}}},"42":{"name":"(anonymous_42)","line":1093,"loc":{"start":{"line":1093,"column":19},"end":{"line":1093,"column":30}}},"43":{"name":"(anonymous_43)","line":1102,"loc":{"start":{"line":1102,"column":20},"end":{"line":1102,"column":31}}},"44":{"name":"(anonymous_44)","line":1115,"loc":{"start":{"line":1115,"column":16},"end":{"line":1115,"column":29}}},"45":{"name":"(anonymous_45)","line":1124,"loc":{"start":{"line":1124,"column":21},"end":{"line":1124,"column":33}}},"46":{"name":"(anonymous_46)","line":1133,"loc":{"start":{"line":1133,"column":20},"end":{"line":1133,"column":42}}},"47":{"name":"(anonymous_47)","line":1144,"loc":{"start":{"line":1144,"column":19},"end":{"line":1144,"column":36}}},"48":{"name":"(anonymous_48)","line":1187,"loc":{"start":{"line":1187,"column":20},"end":{"line":1187,"column":32}}},"49":{"name":"(anonymous_49)","line":1209,"loc":{"start":{"line":1209,"column":15},"end":{"line":1209,"column":28}}},"50":{"name":"(anonymous_50)","line":1239,"loc":{"start":{"line":1239,"column":18},"end":{"line":1239,"column":29}}},"51":{"name":"(anonymous_51)","line":1250,"loc":{"start":{"line":1250,"column":20},"end":{"line":1250,"column":31}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":1264,"column":47}},"2":{"start":{"line":17,"column":4},"end":{"line":202,"column":6}},"3":{"start":{"line":195,"column":8},"end":{"line":195,"column":35}},"4":{"start":{"line":196,"column":8},"end":{"line":196,"column":59}},"5":{"start":{"line":198,"column":8},"end":{"line":198,"column":39}},"6":{"start":{"line":199,"column":8},"end":{"line":201,"column":9}},"7":{"start":{"line":200,"column":12},"end":{"line":200,"column":74}},"8":{"start":{"line":204,"column":4},"end":{"line":204,"column":23}},"9":{"start":{"line":211,"column":4},"end":{"line":211,"column":35}},"10":{"start":{"line":213,"column":4},"end":{"line":434,"column":6}},"11":{"start":{"line":221,"column":16},"end":{"line":223,"column":17}},"12":{"start":{"line":222,"column":20},"end":{"line":222,"column":32}},"13":{"start":{"line":224,"column":16},"end":{"line":224,"column":36}},"14":{"start":{"line":225,"column":16},"end":{"line":227,"column":17}},"15":{"start":{"line":226,"column":20},"end":{"line":226,"column":68}},"16":{"start":{"line":228,"column":16},"end":{"line":228,"column":25}},"17":{"start":{"line":238,"column":16},"end":{"line":240,"column":17}},"18":{"start":{"line":239,"column":20},"end":{"line":239,"column":32}},"19":{"start":{"line":241,"column":16},"end":{"line":241,"column":36}},"20":{"start":{"line":242,"column":16},"end":{"line":244,"column":17}},"21":{"start":{"line":243,"column":20},"end":{"line":243,"column":72}},"22":{"start":{"line":245,"column":16},"end":{"line":245,"column":25}},"23":{"start":{"line":288,"column":16},"end":{"line":292,"column":17}},"24":{"start":{"line":289,"column":20},"end":{"line":289,"column":72}},"25":{"start":{"line":291,"column":20},"end":{"line":291,"column":75}},"26":{"start":{"line":293,"column":16},"end":{"line":293,"column":28}},"27":{"start":{"line":356,"column":16},"end":{"line":356,"column":43}},"28":{"start":{"line":357,"column":16},"end":{"line":357,"column":30}},"29":{"start":{"line":368,"column":16},"end":{"line":368,"column":46}},"30":{"start":{"line":379,"column":16},"end":{"line":382,"column":17}},"31":{"start":{"line":380,"column":20},"end":{"line":380,"column":38}},"32":{"start":{"line":381,"column":20},"end":{"line":381,"column":30}},"33":{"start":{"line":384,"column":16},"end":{"line":384,"column":51}},"34":{"start":{"line":387,"column":16},"end":{"line":387,"column":47}},"35":{"start":{"line":388,"column":16},"end":{"line":388,"column":25}},"36":{"start":{"line":399,"column":16},"end":{"line":410,"column":17}},"37":{"start":{"line":400,"column":20},"end":{"line":400,"column":39}},"38":{"start":{"line":401,"column":20},"end":{"line":407,"column":29}},"39":{"start":{"line":402,"column":24},"end":{"line":402,"column":36}},"40":{"start":{"line":403,"column":24},"end":{"line":405,"column":25}},"41":{"start":{"line":404,"column":28},"end":{"line":404,"column":42}},"42":{"start":{"line":406,"column":24},"end":{"line":406,"column":47}},"43":{"start":{"line":409,"column":20},"end":{"line":409,"column":41}},"44":{"start":{"line":411,"column":16},"end":{"line":411,"column":25}},"45":{"start":{"line":422,"column":16},"end":{"line":422,"column":34}},"46":{"start":{"line":423,"column":16},"end":{"line":423,"column":25}},"47":{"start":{"line":436,"column":4},"end":{"line":1257,"column":7}},"48":{"start":{"line":447,"column":12},"end":{"line":449,"column":13}},"49":{"start":{"line":448,"column":16},"end":{"line":448,"column":28}},"50":{"start":{"line":450,"column":12},"end":{"line":450,"column":25}},"51":{"start":{"line":465,"column":12},"end":{"line":465,"column":35}},"52":{"start":{"line":466,"column":12},"end":{"line":466,"column":35}},"53":{"start":{"line":467,"column":12},"end":{"line":467,"column":24}},"54":{"start":{"line":476,"column":12},"end":{"line":476,"column":35}},"55":{"start":{"line":477,"column":12},"end":{"line":477,"column":35}},"56":{"start":{"line":478,"column":12},"end":{"line":478,"column":24}},"57":{"start":{"line":493,"column":12},"end":{"line":508,"column":13}},"58":{"start":{"line":494,"column":16},"end":{"line":507,"column":17}},"59":{"start":{"line":495,"column":20},"end":{"line":498,"column":21}},"60":{"start":{"line":496,"column":24},"end":{"line":496,"column":54}},"61":{"start":{"line":497,"column":24},"end":{"line":497,"column":43}},"62":{"start":{"line":500,"column":20},"end":{"line":502,"column":21}},"63":{"start":{"line":501,"column":24},"end":{"line":501,"column":36}},"64":{"start":{"line":503,"column":20},"end":{"line":503,"column":85}},"65":{"start":{"line":504,"column":20},"end":{"line":504,"column":49}},"66":{"start":{"line":505,"column":20},"end":{"line":505,"column":72}},"67":{"start":{"line":506,"column":20},"end":{"line":506,"column":56}},"68":{"start":{"line":524,"column":12},"end":{"line":530,"column":15}},"69":{"start":{"line":532,"column":12},"end":{"line":538,"column":15}},"70":{"start":{"line":540,"column":12},"end":{"line":546,"column":15}},"71":{"start":{"line":548,"column":12},"end":{"line":555,"column":15}},"72":{"start":{"line":557,"column":12},"end":{"line":569,"column":14}},"73":{"start":{"line":571,"column":12},"end":{"line":580,"column":21}},"74":{"start":{"line":572,"column":16},"end":{"line":579,"column":19}},"75":{"start":{"line":700,"column":12},"end":{"line":700,"column":38}},"76":{"start":{"line":701,"column":12},"end":{"line":701,"column":33}},"77":{"start":{"line":702,"column":12},"end":{"line":704,"column":13}},"78":{"start":{"line":703,"column":16},"end":{"line":703,"column":27}},"79":{"start":{"line":714,"column":12},"end":{"line":716,"column":13}},"80":{"start":{"line":715,"column":16},"end":{"line":715,"column":35}},"81":{"start":{"line":724,"column":12},"end":{"line":724,"column":25}},"82":{"start":{"line":738,"column":12},"end":{"line":741,"column":13}},"83":{"start":{"line":739,"column":16},"end":{"line":739,"column":69}},"84":{"start":{"line":740,"column":16},"end":{"line":740,"column":68}},"85":{"start":{"line":749,"column":12},"end":{"line":751,"column":13}},"86":{"start":{"line":750,"column":16},"end":{"line":750,"column":69}},"87":{"start":{"line":760,"column":12},"end":{"line":760,"column":49}},"88":{"start":{"line":769,"column":12},"end":{"line":769,"column":26}},"89":{"start":{"line":771,"column":12},"end":{"line":771,"column":40}},"90":{"start":{"line":772,"column":12},"end":{"line":772,"column":29}},"91":{"start":{"line":774,"column":12},"end":{"line":776,"column":13}},"92":{"start":{"line":775,"column":16},"end":{"line":775,"column":29}},"93":{"start":{"line":777,"column":12},"end":{"line":793,"column":13}},"94":{"start":{"line":778,"column":16},"end":{"line":778,"column":41}},"95":{"start":{"line":779,"column":16},"end":{"line":786,"column":17}},"96":{"start":{"line":781,"column":20},"end":{"line":785,"column":21}},"97":{"start":{"line":782,"column":24},"end":{"line":782,"column":34}},"98":{"start":{"line":784,"column":24},"end":{"line":784,"column":44}},"99":{"start":{"line":788,"column":16},"end":{"line":788,"column":61}},"100":{"start":{"line":790,"column":16},"end":{"line":790,"column":38}},"101":{"start":{"line":792,"column":16},"end":{"line":792,"column":100}},"102":{"start":{"line":794,"column":12},"end":{"line":794,"column":55}},"103":{"start":{"line":805,"column":12},"end":{"line":810,"column":24}},"104":{"start":{"line":811,"column":12},"end":{"line":838,"column":13}},"105":{"start":{"line":812,"column":16},"end":{"line":832,"column":19}},"106":{"start":{"line":813,"column":20},"end":{"line":831,"column":21}},"107":{"start":{"line":814,"column":24},"end":{"line":824,"column":25}},"108":{"start":{"line":815,"column":28},"end":{"line":815,"column":38}},"109":{"start":{"line":816,"column":28},"end":{"line":818,"column":29}},"110":{"start":{"line":817,"column":32},"end":{"line":817,"column":64}},"111":{"start":{"line":819,"column":28},"end":{"line":823,"column":31}},"112":{"start":{"line":820,"column":32},"end":{"line":822,"column":33}},"113":{"start":{"line":821,"column":36},"end":{"line":821,"column":45}},"114":{"start":{"line":825,"column":27},"end":{"line":831,"column":21}},"115":{"start":{"line":827,"column":24},"end":{"line":830,"column":25}},"116":{"start":{"line":828,"column":28},"end":{"line":828,"column":38}},"117":{"start":{"line":829,"column":28},"end":{"line":829,"column":37}},"118":{"start":{"line":834,"column":16},"end":{"line":834,"column":35}},"119":{"start":{"line":835,"column":16},"end":{"line":837,"column":17}},"120":{"start":{"line":836,"column":20},"end":{"line":836,"column":29}},"121":{"start":{"line":839,"column":12},"end":{"line":850,"column":13}},"122":{"start":{"line":840,"column":16},"end":{"line":849,"column":17}},"123":{"start":{"line":841,"column":20},"end":{"line":848,"column":23}},"124":{"start":{"line":842,"column":24},"end":{"line":847,"column":25}},"125":{"start":{"line":844,"column":28},"end":{"line":846,"column":29}},"126":{"start":{"line":845,"column":32},"end":{"line":845,"column":42}},"127":{"start":{"line":851,"column":12},"end":{"line":864,"column":13}},"128":{"start":{"line":852,"column":16},"end":{"line":863,"column":17}},"129":{"start":{"line":853,"column":20},"end":{"line":853,"column":54}},"130":{"start":{"line":854,"column":20},"end":{"line":854,"column":32}},"131":{"start":{"line":855,"column":20},"end":{"line":860,"column":29}},"132":{"start":{"line":856,"column":24},"end":{"line":859,"column":25}},"133":{"start":{"line":857,"column":28},"end":{"line":857,"column":39}},"134":{"start":{"line":858,"column":28},"end":{"line":858,"column":56}},"135":{"start":{"line":862,"column":20},"end":{"line":862,"column":61}},"136":{"start":{"line":865,"column":12},"end":{"line":865,"column":21}},"137":{"start":{"line":874,"column":12},"end":{"line":874,"column":30}},"138":{"start":{"line":876,"column":12},"end":{"line":876,"column":77}},"139":{"start":{"line":878,"column":12},"end":{"line":882,"column":13}},"140":{"start":{"line":879,"column":16},"end":{"line":879,"column":104}},"141":{"start":{"line":881,"column":16},"end":{"line":881,"column":38}},"142":{"start":{"line":890,"column":12},"end":{"line":894,"column":13}},"143":{"start":{"line":891,"column":16},"end":{"line":891,"column":63}},"144":{"start":{"line":892,"column":16},"end":{"line":892,"column":29}},"145":{"start":{"line":893,"column":16},"end":{"line":893,"column":78}},"146":{"start":{"line":903,"column":12},"end":{"line":903,"column":26}},"147":{"start":{"line":904,"column":12},"end":{"line":906,"column":13}},"148":{"start":{"line":905,"column":16},"end":{"line":905,"column":32}},"149":{"start":{"line":907,"column":12},"end":{"line":910,"column":13}},"150":{"start":{"line":908,"column":16},"end":{"line":908,"column":42}},"151":{"start":{"line":909,"column":16},"end":{"line":909,"column":61}},"152":{"start":{"line":911,"column":12},"end":{"line":911,"column":24}},"153":{"start":{"line":920,"column":12},"end":{"line":922,"column":13}},"154":{"start":{"line":921,"column":16},"end":{"line":921,"column":35}},"155":{"start":{"line":923,"column":12},"end":{"line":923,"column":26}},"156":{"start":{"line":924,"column":12},"end":{"line":926,"column":13}},"157":{"start":{"line":925,"column":16},"end":{"line":925,"column":32}},"158":{"start":{"line":927,"column":12},"end":{"line":927,"column":37}},"159":{"start":{"line":928,"column":12},"end":{"line":928,"column":54}},"160":{"start":{"line":929,"column":12},"end":{"line":929,"column":24}},"161":{"start":{"line":938,"column":12},"end":{"line":942,"column":13}},"162":{"start":{"line":939,"column":16},"end":{"line":939,"column":43}},"163":{"start":{"line":940,"column":16},"end":{"line":940,"column":43}},"164":{"start":{"line":941,"column":16},"end":{"line":941,"column":62}},"165":{"start":{"line":943,"column":12},"end":{"line":943,"column":24}},"166":{"start":{"line":952,"column":12},"end":{"line":955,"column":13}},"167":{"start":{"line":953,"column":16},"end":{"line":953,"column":43}},"168":{"start":{"line":954,"column":16},"end":{"line":954,"column":59}},"169":{"start":{"line":956,"column":12},"end":{"line":956,"column":24}},"170":{"start":{"line":965,"column":12},"end":{"line":965,"column":37}},"171":{"start":{"line":967,"column":12},"end":{"line":970,"column":13}},"172":{"start":{"line":968,"column":16},"end":{"line":968,"column":49}},"173":{"start":{"line":969,"column":16},"end":{"line":969,"column":45}},"174":{"start":{"line":972,"column":12},"end":{"line":972,"column":28}},"175":{"start":{"line":974,"column":12},"end":{"line":974,"column":66}},"176":{"start":{"line":976,"column":12},"end":{"line":976,"column":33}},"177":{"start":{"line":978,"column":12},"end":{"line":980,"column":13}},"178":{"start":{"line":979,"column":16},"end":{"line":979,"column":52}},"179":{"start":{"line":984,"column":12},"end":{"line":984,"column":67}},"180":{"start":{"line":987,"column":12},"end":{"line":987,"column":51}},"181":{"start":{"line":995,"column":12},"end":{"line":995,"column":40}},"182":{"start":{"line":996,"column":12},"end":{"line":996,"column":38}},"183":{"start":{"line":997,"column":12},"end":{"line":997,"column":57}},"184":{"start":{"line":998,"column":12},"end":{"line":998,"column":80}},"185":{"start":{"line":999,"column":12},"end":{"line":999,"column":66}},"186":{"start":{"line":1000,"column":12},"end":{"line":1000,"column":67}},"187":{"start":{"line":1008,"column":12},"end":{"line":1008,"column":38}},"188":{"start":{"line":1009,"column":12},"end":{"line":1009,"column":60}},"189":{"start":{"line":1010,"column":12},"end":{"line":1010,"column":38}},"190":{"start":{"line":1011,"column":12},"end":{"line":1011,"column":40}},"191":{"start":{"line":1012,"column":12},"end":{"line":1012,"column":45}},"192":{"start":{"line":1013,"column":12},"end":{"line":1013,"column":30}},"193":{"start":{"line":1014,"column":12},"end":{"line":1014,"column":33}},"194":{"start":{"line":1015,"column":12},"end":{"line":1015,"column":30}},"195":{"start":{"line":1016,"column":12},"end":{"line":1016,"column":29}},"196":{"start":{"line":1017,"column":12},"end":{"line":1017,"column":29}},"197":{"start":{"line":1018,"column":12},"end":{"line":1018,"column":28}},"198":{"start":{"line":1019,"column":12},"end":{"line":1019,"column":29}},"199":{"start":{"line":1027,"column":12},"end":{"line":1059,"column":13}},"200":{"start":{"line":1028,"column":16},"end":{"line":1028,"column":54}},"201":{"start":{"line":1029,"column":16},"end":{"line":1029,"column":57}},"202":{"start":{"line":1031,"column":16},"end":{"line":1031,"column":29}},"203":{"start":{"line":1032,"column":16},"end":{"line":1032,"column":60}},"204":{"start":{"line":1033,"column":16},"end":{"line":1037,"column":19}},"205":{"start":{"line":1038,"column":16},"end":{"line":1038,"column":43}},"206":{"start":{"line":1039,"column":16},"end":{"line":1039,"column":33}},"207":{"start":{"line":1041,"column":16},"end":{"line":1041,"column":44}},"208":{"start":{"line":1042,"column":16},"end":{"line":1042,"column":45}},"209":{"start":{"line":1044,"column":16},"end":{"line":1046,"column":17}},"210":{"start":{"line":1045,"column":20},"end":{"line":1045,"column":81}},"211":{"start":{"line":1049,"column":16},"end":{"line":1057,"column":18}},"212":{"start":{"line":1058,"column":16},"end":{"line":1058,"column":41}},"213":{"start":{"line":1060,"column":12},"end":{"line":1060,"column":24}},"214":{"start":{"line":1068,"column":12},"end":{"line":1068,"column":51}},"215":{"start":{"line":1069,"column":12},"end":{"line":1071,"column":13}},"216":{"start":{"line":1070,"column":16},"end":{"line":1070,"column":44}},"217":{"start":{"line":1072,"column":12},"end":{"line":1072,"column":60}},"218":{"start":{"line":1074,"column":12},"end":{"line":1081,"column":13}},"219":{"start":{"line":1075,"column":16},"end":{"line":1080,"column":19}},"220":{"start":{"line":1082,"column":12},"end":{"line":1082,"column":69}},"221":{"start":{"line":1083,"column":12},"end":{"line":1083,"column":38}},"222":{"start":{"line":1084,"column":12},"end":{"line":1084,"column":34}},"223":{"start":{"line":1086,"column":12},"end":{"line":1086,"column":24}},"224":{"start":{"line":1094,"column":12},"end":{"line":1094,"column":33}},"225":{"start":{"line":1095,"column":12},"end":{"line":1095,"column":31}},"226":{"start":{"line":1103,"column":12},"end":{"line":1103,"column":33}},"227":{"start":{"line":1105,"column":12},"end":{"line":1105,"column":51}},"228":{"start":{"line":1106,"column":12},"end":{"line":1106,"column":31}},"229":{"start":{"line":1107,"column":12},"end":{"line":1107,"column":31}},"230":{"start":{"line":1116,"column":12},"end":{"line":1116,"column":63}},"231":{"start":{"line":1125,"column":12},"end":{"line":1125,"column":80}},"232":{"start":{"line":1134,"column":12},"end":{"line":1134,"column":29}},"233":{"start":{"line":1135,"column":12},"end":{"line":1137,"column":13}},"234":{"start":{"line":1136,"column":16},"end":{"line":1136,"column":33}},"235":{"start":{"line":1148,"column":12},"end":{"line":1148,"column":82}},"236":{"start":{"line":1150,"column":12},"end":{"line":1150,"column":49}},"237":{"start":{"line":1151,"column":12},"end":{"line":1151,"column":49}},"238":{"start":{"line":1153,"column":12},"end":{"line":1153,"column":50}},"239":{"start":{"line":1154,"column":12},"end":{"line":1154,"column":50}},"240":{"start":{"line":1157,"column":12},"end":{"line":1165,"column":14}},"241":{"start":{"line":1167,"column":12},"end":{"line":1177,"column":15}},"242":{"start":{"line":1179,"column":12},"end":{"line":1179,"column":29}},"243":{"start":{"line":1188,"column":12},"end":{"line":1201,"column":13}},"244":{"start":{"line":1189,"column":16},"end":{"line":1198,"column":17}},"245":{"start":{"line":1190,"column":20},"end":{"line":1190,"column":61}},"246":{"start":{"line":1192,"column":20},"end":{"line":1197,"column":21}},"247":{"start":{"line":1193,"column":24},"end":{"line":1193,"column":70}},"248":{"start":{"line":1195,"column":24},"end":{"line":1195,"column":69}},"249":{"start":{"line":1196,"column":24},"end":{"line":1196,"column":71}},"250":{"start":{"line":1199,"column":16},"end":{"line":1199,"column":62}},"251":{"start":{"line":1200,"column":16},"end":{"line":1200,"column":49}},"252":{"start":{"line":1210,"column":12},"end":{"line":1212,"column":13}},"253":{"start":{"line":1211,"column":16},"end":{"line":1211,"column":29}},"254":{"start":{"line":1214,"column":12},"end":{"line":1214,"column":48}},"255":{"start":{"line":1215,"column":12},"end":{"line":1232,"column":13}},"256":{"start":{"line":1216,"column":16},"end":{"line":1217,"column":61}},"257":{"start":{"line":1218,"column":16},"end":{"line":1226,"column":17}},"258":{"start":{"line":1219,"column":20},"end":{"line":1219,"column":47}},"259":{"start":{"line":1220,"column":20},"end":{"line":1220,"column":33}},"260":{"start":{"line":1222,"column":20},"end":{"line":1224,"column":21}},"261":{"start":{"line":1223,"column":24},"end":{"line":1223,"column":44}},"262":{"start":{"line":1225,"column":20},"end":{"line":1225,"column":58}},"263":{"start":{"line":1228,"column":16},"end":{"line":1230,"column":17}},"264":{"start":{"line":1229,"column":20},"end":{"line":1229,"column":48}},"265":{"start":{"line":1231,"column":16},"end":{"line":1231,"column":54}},"266":{"start":{"line":1240,"column":12},"end":{"line":1242,"column":13}},"267":{"start":{"line":1241,"column":16},"end":{"line":1241,"column":27}},"268":{"start":{"line":1243,"column":12},"end":{"line":1243,"column":24}},"269":{"start":{"line":1251,"column":12},"end":{"line":1251,"column":27}},"270":{"start":{"line":1252,"column":12},"end":{"line":1254,"column":13}},"271":{"start":{"line":1253,"column":16},"end":{"line":1253,"column":38}},"272":{"start":{"line":1255,"column":12},"end":{"line":1255,"column":33}},"273":{"start":{"line":1258,"column":4},"end":{"line":1258,"column":22}},"274":{"start":{"line":1259,"column":4},"end":{"line":1259,"column":21}}},"branchMap":{"1":{"line":199,"type":"if","locations":[{"start":{"line":199,"column":8},"end":{"line":199,"column":8}},{"start":{"line":199,"column":8},"end":{"line":199,"column":8}}]},"2":{"line":221,"type":"if","locations":[{"start":{"line":221,"column":16},"end":{"line":221,"column":16}},{"start":{"line":221,"column":16},"end":{"line":221,"column":16}}]},"3":{"line":225,"type":"if","locations":[{"start":{"line":225,"column":16},"end":{"line":225,"column":16}},{"start":{"line":225,"column":16},"end":{"line":225,"column":16}}]},"4":{"line":238,"type":"if","locations":[{"start":{"line":238,"column":16},"end":{"line":238,"column":16}},{"start":{"line":238,"column":16},"end":{"line":238,"column":16}}]},"5":{"line":242,"type":"if","locations":[{"start":{"line":242,"column":16},"end":{"line":242,"column":16}},{"start":{"line":242,"column":16},"end":{"line":242,"column":16}}]},"6":{"line":288,"type":"if","locations":[{"start":{"line":288,"column":16},"end":{"line":288,"column":16}},{"start":{"line":288,"column":16},"end":{"line":288,"column":16}}]},"7":{"line":379,"type":"if","locations":[{"start":{"line":379,"column":16},"end":{"line":379,"column":16}},{"start":{"line":379,"column":16},"end":{"line":379,"column":16}}]},"8":{"line":399,"type":"if","locations":[{"start":{"line":399,"column":16},"end":{"line":399,"column":16}},{"start":{"line":399,"column":16},"end":{"line":399,"column":16}}]},"9":{"line":403,"type":"if","locations":[{"start":{"line":403,"column":24},"end":{"line":403,"column":24}},{"start":{"line":403,"column":24},"end":{"line":403,"column":24}}]},"10":{"line":403,"type":"binary-expr","locations":[{"start":{"line":403,"column":28},"end":{"line":403,"column":47}},{"start":{"line":403,"column":51},"end":{"line":403,"column":74}}]},"11":{"line":447,"type":"if","locations":[{"start":{"line":447,"column":12},"end":{"line":447,"column":12}},{"start":{"line":447,"column":12},"end":{"line":447,"column":12}}]},"12":{"line":447,"type":"binary-expr","locations":[{"start":{"line":447,"column":16},"end":{"line":447,"column":17}},{"start":{"line":447,"column":21},"end":{"line":447,"column":28}},{"start":{"line":447,"column":32},"end":{"line":447,"column":39}},{"start":{"line":447,"column":43},"end":{"line":447,"column":49}},{"start":{"line":447,"column":53},"end":{"line":447,"column":63}}]},"13":{"line":493,"type":"if","locations":[{"start":{"line":493,"column":12},"end":{"line":493,"column":12}},{"start":{"line":493,"column":12},"end":{"line":493,"column":12}}]},"14":{"line":494,"type":"if","locations":[{"start":{"line":494,"column":16},"end":{"line":494,"column":16}},{"start":{"line":494,"column":16},"end":{"line":494,"column":16}}]},"15":{"line":495,"type":"if","locations":[{"start":{"line":495,"column":20},"end":{"line":495,"column":20}},{"start":{"line":495,"column":20},"end":{"line":495,"column":20}}]},"16":{"line":500,"type":"if","locations":[{"start":{"line":500,"column":20},"end":{"line":500,"column":20}},{"start":{"line":500,"column":20},"end":{"line":500,"column":20}}]},"17":{"line":503,"type":"binary-expr","locations":[{"start":{"line":503,"column":43},"end":{"line":503,"column":63}},{"start":{"line":503,"column":67},"end":{"line":503,"column":84}}]},"18":{"line":505,"type":"binary-expr","locations":[{"start":{"line":505,"column":36},"end":{"line":505,"column":49}},{"start":{"line":505,"column":53},"end":{"line":505,"column":71}}]},"19":{"line":702,"type":"if","locations":[{"start":{"line":702,"column":12},"end":{"line":702,"column":12}},{"start":{"line":702,"column":12},"end":{"line":702,"column":12}}]},"20":{"line":714,"type":"if","locations":[{"start":{"line":714,"column":12},"end":{"line":714,"column":12}},{"start":{"line":714,"column":12},"end":{"line":714,"column":12}}]},"21":{"line":738,"type":"if","locations":[{"start":{"line":738,"column":12},"end":{"line":738,"column":12}},{"start":{"line":738,"column":12},"end":{"line":738,"column":12}}]},"22":{"line":749,"type":"if","locations":[{"start":{"line":749,"column":12},"end":{"line":749,"column":12}},{"start":{"line":749,"column":12},"end":{"line":749,"column":12}}]},"23":{"line":774,"type":"if","locations":[{"start":{"line":774,"column":12},"end":{"line":774,"column":12}},{"start":{"line":774,"column":12},"end":{"line":774,"column":12}}]},"24":{"line":774,"type":"binary-expr","locations":[{"start":{"line":774,"column":16},"end":{"line":774,"column":45}},{"start":{"line":774,"column":49},"end":{"line":774,"column":62}}]},"25":{"line":777,"type":"if","locations":[{"start":{"line":777,"column":12},"end":{"line":777,"column":12}},{"start":{"line":777,"column":12},"end":{"line":777,"column":12}}]},"26":{"line":779,"type":"if","locations":[{"start":{"line":779,"column":16},"end":{"line":779,"column":16}},{"start":{"line":779,"column":16},"end":{"line":779,"column":16}}]},"27":{"line":781,"type":"if","locations":[{"start":{"line":781,"column":20},"end":{"line":781,"column":20}},{"start":{"line":781,"column":20},"end":{"line":781,"column":20}}]},"28":{"line":811,"type":"if","locations":[{"start":{"line":811,"column":12},"end":{"line":811,"column":12}},{"start":{"line":811,"column":12},"end":{"line":811,"column":12}}]},"29":{"line":813,"type":"if","locations":[{"start":{"line":813,"column":20},"end":{"line":813,"column":20}},{"start":{"line":813,"column":20},"end":{"line":813,"column":20}}]},"30":{"line":813,"type":"binary-expr","locations":[{"start":{"line":813,"column":24},"end":{"line":813,"column":43}},{"start":{"line":813,"column":47},"end":{"line":813,"column":70}}]},"31":{"line":814,"type":"if","locations":[{"start":{"line":814,"column":24},"end":{"line":814,"column":24}},{"start":{"line":814,"column":24},"end":{"line":814,"column":24}}]},"32":{"line":816,"type":"if","locations":[{"start":{"line":816,"column":28},"end":{"line":816,"column":28}},{"start":{"line":816,"column":28},"end":{"line":816,"column":28}}]},"33":{"line":820,"type":"if","locations":[{"start":{"line":820,"column":32},"end":{"line":820,"column":32}},{"start":{"line":820,"column":32},"end":{"line":820,"column":32}}]},"34":{"line":825,"type":"if","locations":[{"start":{"line":825,"column":27},"end":{"line":825,"column":27}},{"start":{"line":825,"column":27},"end":{"line":825,"column":27}}]},"35":{"line":827,"type":"if","locations":[{"start":{"line":827,"column":24},"end":{"line":827,"column":24}},{"start":{"line":827,"column":24},"end":{"line":827,"column":24}}]},"36":{"line":827,"type":"binary-expr","locations":[{"start":{"line":827,"column":28},"end":{"line":827,"column":57}},{"start":{"line":827,"column":61},"end":{"line":827,"column":67}}]},"37":{"line":835,"type":"if","locations":[{"start":{"line":835,"column":16},"end":{"line":835,"column":16}},{"start":{"line":835,"column":16},"end":{"line":835,"column":16}}]},"38":{"line":835,"type":"binary-expr","locations":[{"start":{"line":835,"column":20},"end":{"line":835,"column":35}},{"start":{"line":835,"column":39},"end":{"line":835,"column":55}}]},"39":{"line":839,"type":"if","locations":[{"start":{"line":839,"column":12},"end":{"line":839,"column":12}},{"start":{"line":839,"column":12},"end":{"line":839,"column":12}}]},"40":{"line":840,"type":"if","locations":[{"start":{"line":840,"column":16},"end":{"line":840,"column":16}},{"start":{"line":840,"column":16},"end":{"line":840,"column":16}}]},"41":{"line":842,"type":"if","locations":[{"start":{"line":842,"column":24},"end":{"line":842,"column":24}},{"start":{"line":842,"column":24},"end":{"line":842,"column":24}}]},"42":{"line":844,"type":"if","locations":[{"start":{"line":844,"column":28},"end":{"line":844,"column":28}},{"start":{"line":844,"column":28},"end":{"line":844,"column":28}}]},"43":{"line":851,"type":"if","locations":[{"start":{"line":851,"column":12},"end":{"line":851,"column":12}},{"start":{"line":851,"column":12},"end":{"line":851,"column":12}}]},"44":{"line":852,"type":"if","locations":[{"start":{"line":852,"column":16},"end":{"line":852,"column":16}},{"start":{"line":852,"column":16},"end":{"line":852,"column":16}}]},"45":{"line":856,"type":"if","locations":[{"start":{"line":856,"column":24},"end":{"line":856,"column":24}},{"start":{"line":856,"column":24},"end":{"line":856,"column":24}}]},"46":{"line":856,"type":"binary-expr","locations":[{"start":{"line":856,"column":29},"end":{"line":856,"column":44}},{"start":{"line":856,"column":48},"end":{"line":856,"column":64}},{"start":{"line":856,"column":69},"end":{"line":856,"column":73}}]},"47":{"line":878,"type":"if","locations":[{"start":{"line":878,"column":12},"end":{"line":878,"column":12}},{"start":{"line":878,"column":12},"end":{"line":878,"column":12}}]},"48":{"line":890,"type":"if","locations":[{"start":{"line":890,"column":12},"end":{"line":890,"column":12}},{"start":{"line":890,"column":12},"end":{"line":890,"column":12}}]},"49":{"line":890,"type":"binary-expr","locations":[{"start":{"line":890,"column":16},"end":{"line":890,"column":33}},{"start":{"line":890,"column":37},"end":{"line":890,"column":57}},{"start":{"line":890,"column":61},"end":{"line":890,"column":72}}]},"50":{"line":904,"type":"if","locations":[{"start":{"line":904,"column":12},"end":{"line":904,"column":12}},{"start":{"line":904,"column":12},"end":{"line":904,"column":12}}]},"51":{"line":904,"type":"binary-expr","locations":[{"start":{"line":904,"column":16},"end":{"line":904,"column":37}},{"start":{"line":904,"column":41},"end":{"line":904,"column":66}}]},"52":{"line":907,"type":"if","locations":[{"start":{"line":907,"column":12},"end":{"line":907,"column":12}},{"start":{"line":907,"column":12},"end":{"line":907,"column":12}}]},"53":{"line":920,"type":"if","locations":[{"start":{"line":920,"column":12},"end":{"line":920,"column":12}},{"start":{"line":920,"column":12},"end":{"line":920,"column":12}}]},"54":{"line":924,"type":"if","locations":[{"start":{"line":924,"column":12},"end":{"line":924,"column":12}},{"start":{"line":924,"column":12},"end":{"line":924,"column":12}}]},"55":{"line":924,"type":"binary-expr","locations":[{"start":{"line":924,"column":16},"end":{"line":924,"column":37}},{"start":{"line":924,"column":41},"end":{"line":924,"column":66}}]},"56":{"line":938,"type":"if","locations":[{"start":{"line":938,"column":12},"end":{"line":938,"column":12}},{"start":{"line":938,"column":12},"end":{"line":938,"column":12}}]},"57":{"line":952,"type":"if","locations":[{"start":{"line":952,"column":12},"end":{"line":952,"column":12}},{"start":{"line":952,"column":12},"end":{"line":952,"column":12}}]},"58":{"line":967,"type":"if","locations":[{"start":{"line":967,"column":12},"end":{"line":967,"column":12}},{"start":{"line":967,"column":12},"end":{"line":967,"column":12}}]},"59":{"line":978,"type":"if","locations":[{"start":{"line":978,"column":12},"end":{"line":978,"column":12}},{"start":{"line":978,"column":12},"end":{"line":978,"column":12}}]},"60":{"line":1027,"type":"if","locations":[{"start":{"line":1027,"column":12},"end":{"line":1027,"column":12}},{"start":{"line":1027,"column":12},"end":{"line":1027,"column":12}}]},"61":{"line":1027,"type":"binary-expr","locations":[{"start":{"line":1027,"column":16},"end":{"line":1027,"column":33}},{"start":{"line":1027,"column":37},"end":{"line":1027,"column":56}}]},"62":{"line":1044,"type":"if","locations":[{"start":{"line":1044,"column":16},"end":{"line":1044,"column":16}},{"start":{"line":1044,"column":16},"end":{"line":1044,"column":16}}]},"63":{"line":1069,"type":"if","locations":[{"start":{"line":1069,"column":12},"end":{"line":1069,"column":12}},{"start":{"line":1069,"column":12},"end":{"line":1069,"column":12}}]},"64":{"line":1074,"type":"if","locations":[{"start":{"line":1074,"column":12},"end":{"line":1074,"column":12}},{"start":{"line":1074,"column":12},"end":{"line":1074,"column":12}}]},"65":{"line":1074,"type":"binary-expr","locations":[{"start":{"line":1074,"column":16},"end":{"line":1074,"column":33}},{"start":{"line":1074,"column":37},"end":{"line":1074,"column":55}}]},"66":{"line":1135,"type":"if","locations":[{"start":{"line":1135,"column":12},"end":{"line":1135,"column":12}},{"start":{"line":1135,"column":12},"end":{"line":1135,"column":12}}]},"67":{"line":1188,"type":"if","locations":[{"start":{"line":1188,"column":12},"end":{"line":1188,"column":12}},{"start":{"line":1188,"column":12},"end":{"line":1188,"column":12}}]},"68":{"line":1189,"type":"if","locations":[{"start":{"line":1189,"column":16},"end":{"line":1189,"column":16}},{"start":{"line":1189,"column":16},"end":{"line":1189,"column":16}}]},"69":{"line":1189,"type":"binary-expr","locations":[{"start":{"line":1189,"column":20},"end":{"line":1189,"column":28}},{"start":{"line":1189,"column":32},"end":{"line":1189,"column":45}}]},"70":{"line":1192,"type":"if","locations":[{"start":{"line":1192,"column":20},"end":{"line":1192,"column":20}},{"start":{"line":1192,"column":20},"end":{"line":1192,"column":20}}]},"71":{"line":1210,"type":"if","locations":[{"start":{"line":1210,"column":12},"end":{"line":1210,"column":12}},{"start":{"line":1210,"column":12},"end":{"line":1210,"column":12}}]},"72":{"line":1215,"type":"if","locations":[{"start":{"line":1215,"column":12},"end":{"line":1215,"column":12}},{"start":{"line":1215,"column":12},"end":{"line":1215,"column":12}}]},"73":{"line":1218,"type":"if","locations":[{"start":{"line":1218,"column":16},"end":{"line":1218,"column":16}},{"start":{"line":1218,"column":16},"end":{"line":1218,"column":16}}]},"74":{"line":1218,"type":"binary-expr","locations":[{"start":{"line":1218,"column":20},"end":{"line":1218,"column":56}},{"start":{"line":1218,"column":60},"end":{"line":1218,"column":96}}]},"75":{"line":1222,"type":"if","locations":[{"start":{"line":1222,"column":20},"end":{"line":1222,"column":20}},{"start":{"line":1222,"column":20},"end":{"line":1222,"column":20}}]},"76":{"line":1222,"type":"binary-expr","locations":[{"start":{"line":1222,"column":24},"end":{"line":1222,"column":26}},{"start":{"line":1222,"column":30},"end":{"line":1222,"column":47}}]},"77":{"line":1228,"type":"if","locations":[{"start":{"line":1228,"column":16},"end":{"line":1228,"column":16}},{"start":{"line":1228,"column":16},"end":{"line":1228,"column":16}}]},"78":{"line":1240,"type":"if","locations":[{"start":{"line":1240,"column":12},"end":{"line":1240,"column":12}},{"start":{"line":1240,"column":12},"end":{"line":1240,"column":12}}]},"79":{"line":1252,"type":"if","locations":[{"start":{"line":1252,"column":12},"end":{"line":1252,"column":12}},{"start":{"line":1252,"column":12},"end":{"line":1252,"column":12}}]}},"code":["(function () { YUI.add('dd-drag', function (Y, NAME) {","",""," /**"," * Provides the ability to drag a Node."," * @module dd"," * @submodule dd-drag"," */"," /**"," * Provides the ability to drag a Node."," * @class Drag"," * @extends Base"," * @constructor"," * @namespace DD"," */",""," var DDM = Y.DD.DDM,"," NODE = 'node',"," DRAGGING = 'dragging',"," DRAG_NODE = 'dragNode',"," OFFSET_HEIGHT = 'offsetHeight',"," OFFSET_WIDTH = 'offsetWidth',"," /**"," * Handles the mouseup DOM event, does nothing internally just fires."," * @event drag:mouseup"," * @bubbles DDM"," * @type {CustomEvent}"," */"," /**"," * Handles the mousedown DOM event, checks to see if you have a valid handle then starts the drag timers."," * @event drag:mouseDown"," * @preventable _defMouseDownFn"," * @param {EventFacade} event An Event Facade object with the following specific property added:"," *
ev
The original mousedown event.
"," * @bubbles DDM"," * @type {CustomEvent}"," */"," EV_MOUSE_DOWN = 'drag:mouseDown',"," /**"," * Fires after the mousedown event has been cleared."," * @event drag:afterMouseDown"," * @param {EventFacade} event An Event Facade object with the following specific property added:"," *
ev
The original mousedown event.
"," * @bubbles DDM"," * @type {CustomEvent}"," */"," EV_AFTER_MOUSE_DOWN = 'drag:afterMouseDown',"," /**"," * Fires after a handle is removed."," * @event drag:removeHandle"," * @param {EventFacade} event An Event Facade object with the following specific property added:"," *
handle
The handle that was removed.
"," * @bubbles DDM"," * @type {CustomEvent}"," */"," EV_REMOVE_HANDLE = 'drag:removeHandle',"," /**"," * Fires after a handle is added."," * @event drag:addHandle"," * @param {EventFacade} event An Event Facade object with the following specific property added:"," *
handle
The handle that was added.
"," * @bubbles DDM"," * @type {CustomEvent}"," */"," EV_ADD_HANDLE = 'drag:addHandle',"," /**"," * Fires after an invalid selector is removed."," * @event drag:removeInvalid"," * @param {EventFacade} event An Event Facade object with the following specific property added:"," *
handle
The handle that was removed.
"," * @bubbles DDM"," * @type {CustomEvent}"," */"," EV_REMOVE_INVALID = 'drag:removeInvalid',"," /**"," * Fires after an invalid selector is added."," * @event drag:addInvalid"," * @param {EventFacade} event An Event Facade object with the following specific property added:"," *
handle
The handle that was added.
"," * @bubbles DDM"," * @type {CustomEvent}"," */"," EV_ADD_INVALID = 'drag:addInvalid',"," /**"," * Fires at the start of a drag operation."," * @event drag:start"," * @param {EventFacade} event An Event Facade object with the following specific property added:"," *
"," *
pageX
The original node position X.
"," *
pageY
The original node position Y.
"," *
startTime
The startTime of the event. getTime on the current Date object.
"," *
"," * @bubbles DDM"," * @type {CustomEvent}"," */"," EV_START = 'drag:start',"," /**"," * Fires at the end of a drag operation."," * @event drag:end"," * @param {EventFacade} event An Event Facade object with the following specific property added:"," *
"," *
pageX
The current node position X.
"," *
pageY
The current node position Y.
"," *
startTime
The startTime of the event, from the start event.
"," *
endTime
The endTime of the event. getTime on the current Date object.
"," *
"," * @bubbles DDM"," * @type {CustomEvent}"," */"," EV_END = 'drag:end',"," /**"," * Fires every mousemove during a drag operation."," * @event drag:drag"," * @param {EventFacade} event An Event Facade object with the following specific property added:"," *
"," *
pageX
The current node position X.
"," *
pageY
The current node position Y.
"," *
scroll
Should a scroll action occur.
"," *
info
Object hash containing calculated XY arrays: start, xy, delta, offset
"," *
"," * @bubbles DDM"," * @type {CustomEvent}"," */"," EV_DRAG = 'drag:drag',"," /**"," * Fires when this node is aligned."," * @event drag:align"," * @preventable _defAlignFn"," * @param {EventFacade} event An Event Facade object with the following specific property added:"," *
"," *
pageX
The current node position X.
"," *
pageY
The current node position Y.
"," *
"," * @bubbles DDM"," * @type {CustomEvent}"," */"," EV_ALIGN = 'drag:align',"," /**"," * Fires when this node is over a Drop Target. (Fired from dd-drop)"," * @event drag:over"," * @param {EventFacade} event An Event Facade object with the following specific property added:"," *
"," *
drop
The drop object at the time of the event.
"," *
drag
The drag object at the time of the event.
"," *
"," * @bubbles DDM"," * @type {CustomEvent}"," */"," /**"," * Fires when this node enters a Drop Target. (Fired from dd-drop)"," * @event drag:enter"," * @param {EventFacade} event An Event Facade object with the following specific property added:"," *
"," *
drop
The drop object at the time of the event.
"," *
drag
The drag object at the time of the event.
"," *
"," * @bubbles DDM"," * @type {CustomEvent}"," */"," /**"," * Fires when this node exits a Drop Target. (Fired from dd-drop)"," * @event drag:exit"," * @param {EventFacade} event An Event Facade object with the following specific property added:"," *
"," *
drop
The drop object at the time of the event.
"," *
"," * @bubbles DDM"," * @type {CustomEvent}"," */"," /**"," * Fires when this node is dropped on a valid Drop Target. (Fired from dd-ddm-drop)"," * @event drag:drophit"," * @param {EventFacade} event An Event Facade object with the following specific property added:"," *
"," *
drop
The best guess on what was dropped on.
"," *
drag
The drag object at the time of the event.
"," *
others
An array of all the other drop targets that was dropped on.
"," *
"," * @bubbles DDM"," * @type {CustomEvent}"," */"," /**"," * Fires when this node is dropped on an invalid Drop Target. (Fired from dd-ddm-drop)"," * @event drag:dropmiss"," * @param {EventFacade} event An Event Facade object with the following specific property added:"," *
"," *
pageX
The current node position X.
"," *
pageY
The current node position Y.
"," *
"," * @bubbles DDM"," * @type {CustomEvent}"," */",""," Drag = function(o) {"," this._lazyAddAttrs = false;"," Drag.superclass.constructor.apply(this, arguments);",""," var valid = DDM._regDrag(this);"," if (!valid) {"," Y.error('Failed to register node, already in use: ' + o.node);"," }"," };",""," Drag.NAME = 'drag';",""," /**"," * This property defaults to \"mousedown\", but when drag-gestures is loaded, it is changed to \"gesturemovestart\""," * @static"," * @property START_EVENT"," */"," Drag.START_EVENT = 'mousedown';",""," Drag.ATTRS = {"," /**"," * Y.Node instance to use as the element to initiate a drag operation"," * @attribute node"," * @type Node"," */"," node: {"," setter: function(node) {"," if (this._canDrag(node)) {"," return node;"," }"," var n = Y.one(node);"," if (!n) {"," Y.error('DD.Drag: Invalid Node Given: ' + node);"," }"," return n;"," }"," },"," /**"," * Y.Node instance to use as the draggable element, defaults to node"," * @attribute dragNode"," * @type Node"," */"," dragNode: {"," setter: function(node) {"," if (this._canDrag(node)) {"," return node;"," }"," var n = Y.one(node);"," if (!n) {"," Y.error('DD.Drag: Invalid dragNode Given: ' + node);"," }"," return n;"," }"," },"," /**"," * Offset the drag element by the difference in cursor position: default true"," * @attribute offsetNode"," * @type Boolean"," */"," offsetNode: {"," value: true"," },"," /**"," * Center the dragNode to the mouse position on drag:start: default false"," * @attribute startCentered"," * @type Boolean"," */"," startCentered: {"," value: false"," },"," /**"," * The number of pixels to move to start a drag operation, default is 3."," * @attribute clickPixelThresh"," * @type Number"," */"," clickPixelThresh: {"," value: DDM.get('clickPixelThresh')"," },"," /**"," * The number of milliseconds a mousedown has to pass to start a drag operation, default is 1000."," * @attribute clickTimeThresh"," * @type Number"," */"," clickTimeThresh: {"," value: DDM.get('clickTimeThresh')"," },"," /**"," * Set to lock this drag element so that it can't be dragged: default false."," * @attribute lock"," * @type Boolean"," */"," lock: {"," value: false,"," setter: function(lock) {"," if (lock) {"," this.get(NODE).addClass(DDM.CSS_PREFIX + '-locked');"," } else {"," this.get(NODE).removeClass(DDM.CSS_PREFIX + '-locked');"," }"," return lock;"," }"," },"," /**"," * A payload holder to store arbitrary data about this drag object, can be used to store any value."," * @attribute data"," * @type Mixed"," */"," data: {"," value: false"," },"," /**"," * If this is false, the drag element will not move with the cursor: default true. Can be used to \"resize\" the element."," * @attribute move"," * @type Boolean"," */"," move: {"," value: true"," },"," /**"," * Use the protective shim on all drag operations: default true. Only works with dd-ddm, not dd-ddm-base."," * @attribute useShim"," * @type Boolean"," */"," useShim: {"," value: true"," },"," /**"," * Config option is set by Drag to inform you of which handle fired the drag event (in the case that there are several handles): default false."," * @attribute activeHandle"," * @type Node"," */"," activeHandle: {"," value: false"," },"," /**"," * By default a drag operation will only begin if the mousedown occurred with the primary mouse button."," * Setting this to false will allow for all mousedown events to trigger a drag."," * @attribute primaryButtonOnly"," * @type Boolean"," */"," primaryButtonOnly: {"," value: true"," },"," /**"," * This attribute is not meant to be used by the implementor, it is meant to be used as an Event tracker so you can listen for it to change."," * @attribute dragging"," * @type Boolean"," */"," dragging: {"," value: false"," },"," parent: {"," value: false"," },"," /**"," * This attribute only works if the dd-drop module has been loaded. It will make this node a drop target as well as draggable."," * @attribute target"," * @type Boolean"," */"," target: {"," value: false,"," setter: function(config) {"," this._handleTarget(config);"," return config;"," }"," },"," /**"," * This attribute only works if the dd-drop module is active. It will set the dragMode (point, intersect, strict) of this Drag instance."," * @attribute dragMode"," * @type String"," */"," dragMode: {"," value: null,"," setter: function(mode) {"," return DDM._setDragMode(mode);"," }"," },"," /**"," * Array of groups to add this drag into."," * @attribute groups"," * @type Array"," */"," groups: {"," value: ['default'],"," getter: function() {"," if (!this._groups) {"," this._groups = {};"," return [];"," }",""," return Y.Object.keys(this._groups);"," },"," setter: function(g) {"," this._groups = Y.Array.hash(g);"," return g;"," }"," },"," /**"," * Array of valid handles to add. Adding something here will set all handles, even if previously added with addHandle"," * @attribute handles"," * @type Array"," */"," handles: {"," value: null,"," setter: function(g) {"," if (g) {"," this._handles = {};"," Y.Array.each(g, function(v) {"," var key = v;"," if (v instanceof Y.Node || v instanceof Y.NodeList) {"," key = v._yuid;"," }"," this._handles[key] = v;"," }, this);"," } else {"," this._handles = null;"," }"," return g;"," }"," },"," /**"," * Controls the default bubble parent for this Drag instance. Default: Y.DD.DDM. Set to false to disable bubbling. Use bubbleTargets in config"," * @deprecated"," * @attribute bubbles"," * @type Object"," */"," bubbles: {"," setter: function(t) {"," this.addTarget(t);"," return t;"," }"," },"," /**"," * Should the mousedown event be halted. Default: true"," * @attribute haltDown"," * @type Boolean"," */"," haltDown: {"," value: true"," }"," };",""," Y.extend(Drag, Y.Base, {"," /**"," * Checks the object for the methods needed to drag the object around."," * Normally this would be a node instance, but in the case of Graphics, it"," * may be an SVG node or something similar."," * @method _canDrag"," * @private"," * @param {Object} n The object to check"," * @return {Boolean} True or false if the Object contains the methods needed to Drag"," */"," _canDrag: function(n) {"," if (n && n.setXY && n.getXY && n.test && n.contains) {"," return true;"," }"," return false;"," },"," /**"," * The default bubbleTarget for this object. Default: Y.DD.DDM"," * @private"," * @property _bubbleTargets"," */"," _bubbleTargets: Y.DD.DDM,"," /**"," * Add this Drag instance to a group, this should be used for on-the-fly group additions."," * @method addToGroup"," * @param {String} g The group to add this Drag Instance to."," * @chainable"," */"," addToGroup: function(g) {"," this._groups[g] = true;"," DDM._activateTargets();"," return this;"," },"," /**"," * Remove this Drag instance from a group, this should be used for on-the-fly group removals."," * @method removeFromGroup"," * @param {String} g The group to remove this Drag Instance from."," * @chainable"," */"," removeFromGroup: function(g) {"," delete this._groups[g];"," DDM._activateTargets();"," return this;"," },"," /**"," * This will be a reference to the Drop instance associated with this drag if the target: true config attribute is set.."," * @property target"," * @type {Object}"," */"," target: null,"," /**"," * Attribute handler for the target config attribute."," * @private"," * @method _handleTarget"," * @param {Boolean/Object} config The Config"," */"," _handleTarget: function(config) {"," if (Y.DD.Drop) {"," if (config === false) {"," if (this.target) {"," DDM._unregTarget(this.target);"," this.target = null;"," }"," } else {"," if (!Y.Lang.isObject(config)) {"," config = {};"," }"," config.bubbleTargets = config.bubbleTargets || this.getTargets();"," config.node = this.get(NODE);"," config.groups = config.groups || this.get('groups');"," this.target = new Y.DD.Drop(config);"," }"," }"," },"," /**"," * Storage Array for the groups this drag belongs to."," * @private"," * @property _groups"," * @type {Array}"," */"," _groups: null,"," /**"," * This method creates all the events for this Event Target and publishes them so we get Event Bubbling."," * @private"," * @method _createEvents"," */"," _createEvents: function() {",""," this.publish(EV_MOUSE_DOWN, {"," defaultFn: this._defMouseDownFn,"," queuable: false,"," emitFacade: true,"," bubbles: true,"," prefix: 'drag'"," });",""," this.publish(EV_ALIGN, {"," defaultFn: this._defAlignFn,"," queuable: false,"," emitFacade: true,"," bubbles: true,"," prefix: 'drag'"," });",""," this.publish(EV_DRAG, {"," defaultFn: this._defDragFn,"," queuable: false,"," emitFacade: true,"," bubbles: true,"," prefix: 'drag'"," });",""," this.publish(EV_END, {"," defaultFn: this._defEndFn,"," preventedFn: this._prevEndFn,"," queuable: false,"," emitFacade: true,"," bubbles: true,"," prefix: 'drag'"," });",""," var ev = ["," EV_AFTER_MOUSE_DOWN,"," EV_REMOVE_HANDLE,"," EV_ADD_HANDLE,"," EV_REMOVE_INVALID,"," EV_ADD_INVALID,"," EV_START,"," 'drag:drophit',"," 'drag:dropmiss',"," 'drag:over',"," 'drag:enter',"," 'drag:exit'"," ];",""," Y.Array.each(ev, function(v) {"," this.publish(v, {"," type: v,"," emitFacade: true,"," bubbles: true,"," preventable: false,"," queuable: false,"," prefix: 'drag'"," });"," }, this);"," },"," /**"," * A private reference to the mousedown DOM event"," * @private"," * @property _ev_md"," * @type {EventFacade}"," */"," _ev_md: null,"," /**"," * The getTime of the mousedown event. Not used, just here in case someone wants/needs to use it."," * @private"," * @property _startTime"," * @type Date"," */"," _startTime: null,"," /**"," * The getTime of the mouseup event. Not used, just here in case someone wants/needs to use it."," * @private"," * @property _endTime"," * @type Date"," */"," _endTime: null,"," /**"," * A private hash of the valid drag handles"," * @private"," * @property _handles"," * @type {Object}"," */"," _handles: null,"," /**"," * A private hash of the invalid selector strings"," * @private"," * @property _invalids"," * @type {Object}"," */"," _invalids: null,"," /**"," * A private hash of the default invalid selector strings: {'textarea': true, 'input': true, 'a': true, 'button': true, 'select': true}"," * @private"," * @property _invalidsDefault"," * @type {Object}"," */"," _invalidsDefault: {'textarea': true, 'input': true, 'a': true, 'button': true, 'select': true },"," /**"," * Private flag to see if the drag threshhold was met"," * @private"," * @property _dragThreshMet"," * @type {Boolean}"," */"," _dragThreshMet: null,"," /**"," * Flag to determine if the drag operation came from a timeout"," * @private"," * @property _fromTimeout"," * @type {Boolean}"," */"," _fromTimeout: null,"," /**"," * Holder for the setTimeout call"," * @private"," * @property _clickTimeout"," * @type {Boolean}"," */"," _clickTimeout: null,"," /**"," * The offset of the mouse position to the element's position"," * @property deltaXY"," * @type {Array}"," */"," deltaXY: null,"," /**"," * The initial mouse position"," * @property startXY"," * @type {Array}"," */"," startXY: null,"," /**"," * The initial element position"," * @property nodeXY"," * @type {Array}"," */"," nodeXY: null,"," /**"," * The position of the element as it's moving (for offset calculations)"," * @property lastXY"," * @type {Array}"," */"," lastXY: null,"," /**"," * The xy that the node will be set to. Changing this will alter the position as it's dragged."," * @property actXY"," * @type {Array}"," */"," actXY: null,"," /**"," * The real xy position of the node."," * @property realXY"," * @type {Array}"," */"," realXY: null,"," /**"," * The XY coords of the mousemove"," * @property mouseXY"," * @type {Array}"," */"," mouseXY: null,"," /**"," * A region object associated with this drag, used for checking regions while dragging."," * @property region"," * @type Object"," */"," region: null,"," /**"," * Handler for the mouseup DOM event"," * @private"," * @method _handleMouseUp"," * @param {EventFacade} ev The Event"," */"," _handleMouseUp: function() {"," this.fire('drag:mouseup');"," this._fixIEMouseUp();"," if (DDM.activeDrag) {"," DDM._end();"," }"," },"," /**"," * The function we use as the ondragstart handler when we start a drag"," * in Internet Explorer. This keeps IE from blowing up on images as drag handles."," * @private"," * @method _fixDragStart"," * @param {Event} e The Event"," */"," _fixDragStart: function(e) {"," if (this.validClick(e)) {"," e.preventDefault();"," }"," },"," /**"," * The function we use as the onselectstart handler when we start a drag in Internet Explorer"," * @private"," * @method _ieSelectFix"," */"," _ieSelectFix: function() {"," return false;"," },"," /**"," * We will hold a copy of the current \"onselectstart\" method on this property, and reset it after we are done using it."," * @private"," * @property _ieSelectBack"," */"," _ieSelectBack: null,"," /**"," * This method copies the onselectstart listner on the document to the _ieSelectFix property"," * @private"," * @method _fixIEMouseDown"," */"," _fixIEMouseDown: function() {"," if (Y.UA.ie) {"," this._ieSelectBack = Y.config.doc.body.onselectstart;"," Y.config.doc.body.onselectstart = this._ieSelectFix;"," }"," },"," /**"," * This method copies the _ieSelectFix property back to the onselectstart listner on the document."," * @private"," * @method _fixIEMouseUp"," */"," _fixIEMouseUp: function() {"," if (Y.UA.ie) {"," Y.config.doc.body.onselectstart = this._ieSelectBack;"," }"," },"," /**"," * Handler for the mousedown DOM event"," * @private"," * @method _handleMouseDownEvent"," * @param {EventFacade} ev The Event"," */"," _handleMouseDownEvent: function(ev) {"," this.fire(EV_MOUSE_DOWN, { ev: ev });"," },"," /**"," * Handler for the mousedown DOM event"," * @private"," * @method _defMouseDownFn"," * @param {EventFacade} e The Event"," */"," _defMouseDownFn: function(e) {"," var ev = e.ev;",""," this._dragThreshMet = false;"," this._ev_md = ev;",""," if (this.get('primaryButtonOnly') && ev.button > 1) {"," return false;"," }"," if (this.validClick(ev)) {"," this._fixIEMouseDown(ev);"," if (Drag.START_EVENT.indexOf('gesture') !== 0) {"," //Only do these if it's not a gesture"," if (this.get('haltDown')) {"," ev.halt();"," } else {"," ev.preventDefault();"," }"," }",""," this._setStartPosition([ev.pageX, ev.pageY]);",""," DDM.activeDrag = this;",""," this._clickTimeout = Y.later(this.get('clickTimeThresh'), this, this._timeoutCheck);"," }"," this.fire(EV_AFTER_MOUSE_DOWN, { ev: ev });"," },"," /**"," * Method first checks to see if we have handles, if so it validates the click"," * against the handle. Then if it finds a valid handle, it checks it against"," * the invalid handles list. Returns true if a good handle was used, false otherwise."," * @method validClick"," * @param {EventFacade} ev The Event"," * @return {Boolean}"," */"," validClick: function(ev) {"," var r = false, n = false,"," tar = ev.target,"," hTest = null,"," els = null,"," nlist = null,"," set = false;"," if (this._handles) {"," Y.Object.each(this._handles, function(i, n) {"," if (i instanceof Y.Node || i instanceof Y.NodeList) {"," if (!r) {"," nlist = i;"," if (nlist instanceof Y.Node) {"," nlist = new Y.NodeList(i._node);"," }"," nlist.each(function(nl) {"," if (nl.contains(tar)) {"," r = true;"," }"," });"," }"," } else if (Y.Lang.isString(n)) {"," //Am I this or am I inside this"," if (tar.test(n + ', ' + n + ' *') && !hTest) {"," hTest = n;"," r = true;"," }"," }"," });"," } else {"," n = this.get(NODE);"," if (n.contains(tar) || n.compareTo(tar)) {"," r = true;"," }"," }"," if (r) {"," if (this._invalids) {"," Y.Object.each(this._invalids, function(i, n) {"," if (Y.Lang.isString(n)) {"," //Am I this or am I inside this"," if (tar.test(n + ', ' + n + ' *')) {"," r = false;"," }"," }"," });"," }"," }"," if (r) {"," if (hTest) {"," els = ev.currentTarget.all(hTest);"," set = false;"," els.each(function(n) {"," if ((n.contains(tar) || n.compareTo(tar)) && !set) {"," set = true;"," this.set('activeHandle', n);"," }"," }, this);"," } else {"," this.set('activeHandle', this.get(NODE));"," }"," }"," return r;"," },"," /**"," * Sets the current position of the Element and calculates the offset"," * @private"," * @method _setStartPosition"," * @param {Array} xy The XY coords to set the position to."," */"," _setStartPosition: function(xy) {"," this.startXY = xy;",""," this.nodeXY = this.lastXY = this.realXY = this.get(NODE).getXY();",""," if (this.get('offsetNode')) {"," this.deltaXY = [(this.startXY[0] - this.nodeXY[0]), (this.startXY[1] - this.nodeXY[1])];"," } else {"," this.deltaXY = [0, 0];"," }"," },"," /**"," * The method passed to setTimeout to determine if the clickTimeThreshold was met."," * @private"," * @method _timeoutCheck"," */"," _timeoutCheck: function() {"," if (!this.get('lock') && !this._dragThreshMet && this._ev_md) {"," this._fromTimeout = this._dragThreshMet = true;"," this.start();"," this._alignNode([this._ev_md.pageX, this._ev_md.pageY], true);"," }"," },"," /**"," * Remove a Selector added by addHandle"," * @method removeHandle"," * @param {String} str The selector for the handle to be removed."," * @chainable"," */"," removeHandle: function(str) {"," var key = str;"," if (str instanceof Y.Node || str instanceof Y.NodeList) {"," key = str._yuid;"," }"," if (this._handles[key]) {"," delete this._handles[key];"," this.fire(EV_REMOVE_HANDLE, { handle: str });"," }"," return this;"," },"," /**"," * Add a handle to a drag element. Drag only initiates when a mousedown happens on this element."," * @method addHandle"," * @param {String} str The selector to test for a valid handle. Must be a child of the element."," * @chainable"," */"," addHandle: function(str) {"," if (!this._handles) {"," this._handles = {};"," }"," var key = str;"," if (str instanceof Y.Node || str instanceof Y.NodeList) {"," key = str._yuid;"," }"," this._handles[key] = str;"," this.fire(EV_ADD_HANDLE, { handle: str });"," return this;"," },"," /**"," * Remove an invalid handle added by addInvalid"," * @method removeInvalid"," * @param {String} str The invalid handle to remove from the internal list."," * @chainable"," */"," removeInvalid: function(str) {"," if (this._invalids[str]) {"," this._invalids[str] = null;"," delete this._invalids[str];"," this.fire(EV_REMOVE_INVALID, { handle: str });"," }"," return this;"," },"," /**"," * Add a selector string to test the handle against. If the test passes the drag operation will not continue."," * @method addInvalid"," * @param {String} str The selector to test against to determine if this is an invalid drag handle."," * @chainable"," */"," addInvalid: function(str) {"," if (Y.Lang.isString(str)) {"," this._invalids[str] = true;"," this.fire(EV_ADD_INVALID, { handle: str });"," }"," return this;"," },"," /**"," * Internal init handler"," * @private"," * @method initializer"," */"," initializer: function() {",""," this.get(NODE).dd = this;",""," if (!this.get(NODE).get('id')) {"," var id = Y.stamp(this.get(NODE));"," this.get(NODE).set('id', id);"," }",""," this.actXY = [];",""," this._invalids = Y.clone(this._invalidsDefault, true);",""," this._createEvents();",""," if (!this.get(DRAG_NODE)) {"," this.set(DRAG_NODE, this.get(NODE));"," }",""," //Fix for #2528096"," //Don't prep the DD instance until all plugins are loaded."," this.on('initializedChange', Y.bind(this._prep, this));",""," //Shouldn't have to do this.."," this.set('groups', this.get('groups'));"," },"," /**"," * Attach event listners and add classname"," * @private"," * @method _prep"," */"," _prep: function() {"," this._dragThreshMet = false;"," var node = this.get(NODE);"," node.addClass(DDM.CSS_PREFIX + '-draggable');"," node.on(Drag.START_EVENT, Y.bind(this._handleMouseDownEvent, this));"," node.on('mouseup', Y.bind(this._handleMouseUp, this));"," node.on('dragstart', Y.bind(this._fixDragStart, this));"," },"," /**"," * Detach event listeners and remove classname"," * @private"," * @method _unprep"," */"," _unprep: function() {"," var node = this.get(NODE);"," node.removeClass(DDM.CSS_PREFIX + '-draggable');"," node.detachAll('mouseup');"," node.detachAll('dragstart');"," node.detachAll(Drag.START_EVENT);"," this.mouseXY = [];"," this.deltaXY = [0,0];"," this.startXY = [];"," this.nodeXY = [];"," this.lastXY = [];"," this.actXY = [];"," this.realXY = [];"," },"," /**"," * Starts the drag operation"," * @method start"," * @chainable"," */"," start: function() {"," if (!this.get('lock') && !this.get(DRAGGING)) {"," var node = this.get(NODE), ow, oh, xy;"," this._startTime = (new Date()).getTime();",""," DDM._start();"," node.addClass(DDM.CSS_PREFIX + '-dragging');"," this.fire(EV_START, {"," pageX: this.nodeXY[0],"," pageY: this.nodeXY[1],"," startTime: this._startTime"," });"," node = this.get(DRAG_NODE);"," xy = this.nodeXY;",""," ow = node.get(OFFSET_WIDTH);"," oh = node.get(OFFSET_HEIGHT);",""," if (this.get('startCentered')) {"," this._setStartPosition([xy[0] + (ow / 2), xy[1] + (oh / 2)]);"," }","",""," this.region = {"," '0': xy[0],"," '1': xy[1],"," area: 0,"," top: xy[1],"," right: xy[0] + ow,"," bottom: xy[1] + oh,"," left: xy[0]"," };"," this.set(DRAGGING, true);"," }"," return this;"," },"," /**"," * Ends the drag operation"," * @method end"," * @chainable"," */"," end: function() {"," this._endTime = (new Date()).getTime();"," if (this._clickTimeout) {"," this._clickTimeout.cancel();"," }"," this._dragThreshMet = this._fromTimeout = false;",""," if (!this.get('lock') && this.get(DRAGGING)) {"," this.fire(EV_END, {"," pageX: this.lastXY[0],"," pageY: this.lastXY[1],"," startTime: this._startTime,"," endTime: this._endTime"," });"," }"," this.get(NODE).removeClass(DDM.CSS_PREFIX + '-dragging');"," this.set(DRAGGING, false);"," this.deltaXY = [0, 0];",""," return this;"," },"," /**"," * Handler for fixing the selection in IE"," * @private"," * @method _defEndFn"," */"," _defEndFn: function() {"," this._fixIEMouseUp();"," this._ev_md = null;"," },"," /**"," * Handler for preventing the drag:end event. It will reset the node back to it's start position"," * @private"," * @method _prevEndFn"," */"," _prevEndFn: function() {"," this._fixIEMouseUp();"," //Bug #1852577"," this.get(DRAG_NODE).setXY(this.nodeXY);"," this._ev_md = null;"," this.region = null;"," },"," /**"," * Calculates the offsets and set's the XY that the element will move to."," * @private"," * @method _align"," * @param {Array} xy The xy coords to align with."," */"," _align: function(xy) {"," this.fire(EV_ALIGN, {pageX: xy[0], pageY: xy[1] });"," },"," /**"," * Calculates the offsets and set's the XY that the element will move to."," * @private"," * @method _defAlignFn"," * @param {EventFacade} e The drag:align event."," */"," _defAlignFn: function(e) {"," this.actXY = [e.pageX - this.deltaXY[0], e.pageY - this.deltaXY[1]];"," },"," /**"," * This method performs the alignment before the element move."," * @private"," * @method _alignNode"," * @param {Array} eXY The XY to move the element to, usually comes from the mousemove DOM event."," */"," _alignNode: function(eXY, scroll) {"," this._align(eXY);"," if (!scroll) {"," this._moveNode();"," }"," },"," /**"," * This method performs the actual element move."," * @private"," * @method _moveNode"," */"," _moveNode: function(scroll) {"," //if (!this.get(DRAGGING)) {"," // return;"," //}"," var diffXY = [], diffXY2 = [], startXY = this.nodeXY, xy = this.actXY;",""," diffXY[0] = (xy[0] - this.lastXY[0]);"," diffXY[1] = (xy[1] - this.lastXY[1]);",""," diffXY2[0] = (xy[0] - this.nodeXY[0]);"," diffXY2[1] = (xy[1] - this.nodeXY[1]);","",""," this.region = {"," '0': xy[0],"," '1': xy[1],"," area: 0,"," top: xy[1],"," right: xy[0] + this.get(DRAG_NODE).get(OFFSET_WIDTH),"," bottom: xy[1] + this.get(DRAG_NODE).get(OFFSET_HEIGHT),"," left: xy[0]"," };",""," this.fire(EV_DRAG, {"," pageX: xy[0],"," pageY: xy[1],"," scroll: scroll,"," info: {"," start: startXY,"," xy: xy,"," delta: diffXY,"," offset: diffXY2"," }"," });",""," this.lastXY = xy;"," },"," /**"," * Default function for drag:drag. Fired from _moveNode."," * @private"," * @method _defDragFn"," * @param {EventFacade} ev The drag:drag event"," */"," _defDragFn: function(e) {"," if (this.get('move')) {"," if (e.scroll && e.scroll.node) {"," var domNode = e.scroll.node.getDOMNode();"," //If it's the window"," if (domNode === Y.config.win) {"," domNode.scrollTo(e.scroll.left, e.scroll.top);"," } else {"," e.scroll.node.set('scrollTop', e.scroll.top);"," e.scroll.node.set('scrollLeft', e.scroll.left);"," }"," }"," this.get(DRAG_NODE).setXY([e.pageX, e.pageY]);"," this.realXY = [e.pageX, e.pageY];"," }"," },"," /**"," * Fired from DragDropMgr (DDM) on mousemove."," * @private"," * @method _move"," * @param {EventFacade} ev The mousemove DOM event"," */"," _move: function(ev) {"," if (this.get('lock')) {"," return false;"," }",""," this.mouseXY = [ev.pageX, ev.pageY];"," if (!this._dragThreshMet) {"," var diffX = Math.abs(this.startXY[0] - ev.pageX),"," diffY = Math.abs(this.startXY[1] - ev.pageY);"," if (diffX > this.get('clickPixelThresh') || diffY > this.get('clickPixelThresh')) {"," this._dragThreshMet = true;"," this.start();"," //This only happens on gestures to stop the page from scrolling"," if (ev && ev.preventDefault) {"," ev.preventDefault();"," }"," this._alignNode([ev.pageX, ev.pageY]);"," }"," } else {"," if (this._clickTimeout) {"," this._clickTimeout.cancel();"," }"," this._alignNode([ev.pageX, ev.pageY]);"," }"," },"," /**"," * Method will forcefully stop a drag operation. For example calling this from inside an ESC keypress handler will stop this drag."," * @method stopDrag"," * @chainable"," */"," stopDrag: function() {"," if (this.get(DRAGGING)) {"," DDM._end();"," }"," return this;"," },"," /**"," * Lifecycle destructor, unreg the drag from the DDM and remove listeners"," * @private"," * @method destructor"," */"," destructor: function() {"," this._unprep();"," if (this.target) {"," this.target.destroy();"," }"," DDM._unregDrag(this);"," }"," });"," Y.namespace('DD');"," Y.DD.Drag = Drag;","","","","","}, '@VERSION@', {\"requires\": [\"dd-ddm-base\"]});","","}());"]}; +} +var __cov_Fr1SliDBP6G2yCnI4QmeSA = __coverage__['build/dd-drag/dd-drag.js']; +__cov_Fr1SliDBP6G2yCnI4QmeSA.s['1']++;YUI.add('dd-drag',function(Y,NAME){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['1']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['2']++;var DDM=Y.DD.DDM,NODE='node',DRAGGING='dragging',DRAG_NODE='dragNode',OFFSET_HEIGHT='offsetHeight',OFFSET_WIDTH='offsetWidth',EV_MOUSE_DOWN='drag:mouseDown',EV_AFTER_MOUSE_DOWN='drag:afterMouseDown',EV_REMOVE_HANDLE='drag:removeHandle',EV_ADD_HANDLE='drag:addHandle',EV_REMOVE_INVALID='drag:removeInvalid',EV_ADD_INVALID='drag:addInvalid',EV_START='drag:start',EV_END='drag:end',EV_DRAG='drag:drag',EV_ALIGN='drag:align',Drag=function(o){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['2']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['3']++;this._lazyAddAttrs=false;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['4']++;Drag.superclass.constructor.apply(this,arguments);__cov_Fr1SliDBP6G2yCnI4QmeSA.s['5']++;var valid=DDM._regDrag(this);__cov_Fr1SliDBP6G2yCnI4QmeSA.s['6']++;if(!valid){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['1'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['7']++;Y.error('Failed to register node, already in use: '+o.node);}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['1'][1]++;}};__cov_Fr1SliDBP6G2yCnI4QmeSA.s['8']++;Drag.NAME='drag';__cov_Fr1SliDBP6G2yCnI4QmeSA.s['9']++;Drag.START_EVENT='mousedown';__cov_Fr1SliDBP6G2yCnI4QmeSA.s['10']++;Drag.ATTRS={node:{setter:function(node){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['3']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['11']++;if(this._canDrag(node)){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['2'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['12']++;return node;}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['2'][1]++;}__cov_Fr1SliDBP6G2yCnI4QmeSA.s['13']++;var n=Y.one(node);__cov_Fr1SliDBP6G2yCnI4QmeSA.s['14']++;if(!n){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['3'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['15']++;Y.error('DD.Drag: Invalid Node Given: '+node);}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['3'][1]++;}__cov_Fr1SliDBP6G2yCnI4QmeSA.s['16']++;return n;}},dragNode:{setter:function(node){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['4']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['17']++;if(this._canDrag(node)){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['4'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['18']++;return node;}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['4'][1]++;}__cov_Fr1SliDBP6G2yCnI4QmeSA.s['19']++;var n=Y.one(node);__cov_Fr1SliDBP6G2yCnI4QmeSA.s['20']++;if(!n){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['5'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['21']++;Y.error('DD.Drag: Invalid dragNode Given: '+node);}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['5'][1]++;}__cov_Fr1SliDBP6G2yCnI4QmeSA.s['22']++;return n;}},offsetNode:{value:true},startCentered:{value:false},clickPixelThresh:{value:DDM.get('clickPixelThresh')},clickTimeThresh:{value:DDM.get('clickTimeThresh')},lock:{value:false,setter:function(lock){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['5']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['23']++;if(lock){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['6'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['24']++;this.get(NODE).addClass(DDM.CSS_PREFIX+'-locked');}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['6'][1]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['25']++;this.get(NODE).removeClass(DDM.CSS_PREFIX+'-locked');}__cov_Fr1SliDBP6G2yCnI4QmeSA.s['26']++;return lock;}},data:{value:false},move:{value:true},useShim:{value:true},activeHandle:{value:false},primaryButtonOnly:{value:true},dragging:{value:false},parent:{value:false},target:{value:false,setter:function(config){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['6']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['27']++;this._handleTarget(config);__cov_Fr1SliDBP6G2yCnI4QmeSA.s['28']++;return config;}},dragMode:{value:null,setter:function(mode){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['7']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['29']++;return DDM._setDragMode(mode);}},groups:{value:['default'],getter:function(){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['8']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['30']++;if(!this._groups){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['7'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['31']++;this._groups={};__cov_Fr1SliDBP6G2yCnI4QmeSA.s['32']++;return[];}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['7'][1]++;}__cov_Fr1SliDBP6G2yCnI4QmeSA.s['33']++;return Y.Object.keys(this._groups);},setter:function(g){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['9']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['34']++;this._groups=Y.Array.hash(g);__cov_Fr1SliDBP6G2yCnI4QmeSA.s['35']++;return g;}},handles:{value:null,setter:function(g){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['10']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['36']++;if(g){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['8'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['37']++;this._handles={};__cov_Fr1SliDBP6G2yCnI4QmeSA.s['38']++;Y.Array.each(g,function(v){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['11']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['39']++;var key=v;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['40']++;if((__cov_Fr1SliDBP6G2yCnI4QmeSA.b['10'][0]++,v instanceof Y.Node)||(__cov_Fr1SliDBP6G2yCnI4QmeSA.b['10'][1]++,v instanceof Y.NodeList)){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['9'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['41']++;key=v._yuid;}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['9'][1]++;}__cov_Fr1SliDBP6G2yCnI4QmeSA.s['42']++;this._handles[key]=v;},this);}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['8'][1]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['43']++;this._handles=null;}__cov_Fr1SliDBP6G2yCnI4QmeSA.s['44']++;return g;}},bubbles:{setter:function(t){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['12']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['45']++;this.addTarget(t);__cov_Fr1SliDBP6G2yCnI4QmeSA.s['46']++;return t;}},haltDown:{value:true}};__cov_Fr1SliDBP6G2yCnI4QmeSA.s['47']++;Y.extend(Drag,Y.Base,{_canDrag:function(n){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['13']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['48']++;if((__cov_Fr1SliDBP6G2yCnI4QmeSA.b['12'][0]++,n)&&(__cov_Fr1SliDBP6G2yCnI4QmeSA.b['12'][1]++,n.setXY)&&(__cov_Fr1SliDBP6G2yCnI4QmeSA.b['12'][2]++,n.getXY)&&(__cov_Fr1SliDBP6G2yCnI4QmeSA.b['12'][3]++,n.test)&&(__cov_Fr1SliDBP6G2yCnI4QmeSA.b['12'][4]++,n.contains)){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['11'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['49']++;return true;}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['11'][1]++;}__cov_Fr1SliDBP6G2yCnI4QmeSA.s['50']++;return false;},_bubbleTargets:Y.DD.DDM,addToGroup:function(g){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['14']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['51']++;this._groups[g]=true;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['52']++;DDM._activateTargets();__cov_Fr1SliDBP6G2yCnI4QmeSA.s['53']++;return this;},removeFromGroup:function(g){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['15']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['54']++;delete this._groups[g];__cov_Fr1SliDBP6G2yCnI4QmeSA.s['55']++;DDM._activateTargets();__cov_Fr1SliDBP6G2yCnI4QmeSA.s['56']++;return this;},target:null,_handleTarget:function(config){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['16']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['57']++;if(Y.DD.Drop){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['13'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['58']++;if(config===false){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['14'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['59']++;if(this.target){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['15'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['60']++;DDM._unregTarget(this.target);__cov_Fr1SliDBP6G2yCnI4QmeSA.s['61']++;this.target=null;}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['15'][1]++;}}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['14'][1]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['62']++;if(!Y.Lang.isObject(config)){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['16'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['63']++;config={};}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['16'][1]++;}__cov_Fr1SliDBP6G2yCnI4QmeSA.s['64']++;config.bubbleTargets=(__cov_Fr1SliDBP6G2yCnI4QmeSA.b['17'][0]++,config.bubbleTargets)||(__cov_Fr1SliDBP6G2yCnI4QmeSA.b['17'][1]++,this.getTargets());__cov_Fr1SliDBP6G2yCnI4QmeSA.s['65']++;config.node=this.get(NODE);__cov_Fr1SliDBP6G2yCnI4QmeSA.s['66']++;config.groups=(__cov_Fr1SliDBP6G2yCnI4QmeSA.b['18'][0]++,config.groups)||(__cov_Fr1SliDBP6G2yCnI4QmeSA.b['18'][1]++,this.get('groups'));__cov_Fr1SliDBP6G2yCnI4QmeSA.s['67']++;this.target=new Y.DD.Drop(config);}}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['13'][1]++;}},_groups:null,_createEvents:function(){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['17']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['68']++;this.publish(EV_MOUSE_DOWN,{defaultFn:this._defMouseDownFn,queuable:false,emitFacade:true,bubbles:true,prefix:'drag'});__cov_Fr1SliDBP6G2yCnI4QmeSA.s['69']++;this.publish(EV_ALIGN,{defaultFn:this._defAlignFn,queuable:false,emitFacade:true,bubbles:true,prefix:'drag'});__cov_Fr1SliDBP6G2yCnI4QmeSA.s['70']++;this.publish(EV_DRAG,{defaultFn:this._defDragFn,queuable:false,emitFacade:true,bubbles:true,prefix:'drag'});__cov_Fr1SliDBP6G2yCnI4QmeSA.s['71']++;this.publish(EV_END,{defaultFn:this._defEndFn,preventedFn:this._prevEndFn,queuable:false,emitFacade:true,bubbles:true,prefix:'drag'});__cov_Fr1SliDBP6G2yCnI4QmeSA.s['72']++;var ev=[EV_AFTER_MOUSE_DOWN,EV_REMOVE_HANDLE,EV_ADD_HANDLE,EV_REMOVE_INVALID,EV_ADD_INVALID,EV_START,'drag:drophit','drag:dropmiss','drag:over','drag:enter','drag:exit'];__cov_Fr1SliDBP6G2yCnI4QmeSA.s['73']++;Y.Array.each(ev,function(v){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['18']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['74']++;this.publish(v,{type:v,emitFacade:true,bubbles:true,preventable:false,queuable:false,prefix:'drag'});},this);},_ev_md:null,_startTime:null,_endTime:null,_handles:null,_invalids:null,_invalidsDefault:{'textarea':true,'input':true,'a':true,'button':true,'select':true},_dragThreshMet:null,_fromTimeout:null,_clickTimeout:null,deltaXY:null,startXY:null,nodeXY:null,lastXY:null,actXY:null,realXY:null,mouseXY:null,region:null,_handleMouseUp:function(){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['19']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['75']++;this.fire('drag:mouseup');__cov_Fr1SliDBP6G2yCnI4QmeSA.s['76']++;this._fixIEMouseUp();__cov_Fr1SliDBP6G2yCnI4QmeSA.s['77']++;if(DDM.activeDrag){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['19'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['78']++;DDM._end();}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['19'][1]++;}},_fixDragStart:function(e){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['20']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['79']++;if(this.validClick(e)){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['20'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['80']++;e.preventDefault();}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['20'][1]++;}},_ieSelectFix:function(){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['21']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['81']++;return false;},_ieSelectBack:null,_fixIEMouseDown:function(){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['22']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['82']++;if(Y.UA.ie){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['21'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['83']++;this._ieSelectBack=Y.config.doc.body.onselectstart;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['84']++;Y.config.doc.body.onselectstart=this._ieSelectFix;}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['21'][1]++;}},_fixIEMouseUp:function(){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['23']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['85']++;if(Y.UA.ie){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['22'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['86']++;Y.config.doc.body.onselectstart=this._ieSelectBack;}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['22'][1]++;}},_handleMouseDownEvent:function(ev){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['24']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['87']++;this.fire(EV_MOUSE_DOWN,{ev:ev});},_defMouseDownFn:function(e){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['25']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['88']++;var ev=e.ev;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['89']++;this._dragThreshMet=false;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['90']++;this._ev_md=ev;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['91']++;if((__cov_Fr1SliDBP6G2yCnI4QmeSA.b['24'][0]++,this.get('primaryButtonOnly'))&&(__cov_Fr1SliDBP6G2yCnI4QmeSA.b['24'][1]++,ev.button>1)){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['23'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['92']++;return false;}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['23'][1]++;}__cov_Fr1SliDBP6G2yCnI4QmeSA.s['93']++;if(this.validClick(ev)){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['25'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['94']++;this._fixIEMouseDown(ev);__cov_Fr1SliDBP6G2yCnI4QmeSA.s['95']++;if(Drag.START_EVENT.indexOf('gesture')!==0){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['26'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['96']++;if(this.get('haltDown')){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['27'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['97']++;ev.halt();}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['27'][1]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['98']++;ev.preventDefault();}}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['26'][1]++;}__cov_Fr1SliDBP6G2yCnI4QmeSA.s['99']++;this._setStartPosition([ev.pageX,ev.pageY]);__cov_Fr1SliDBP6G2yCnI4QmeSA.s['100']++;DDM.activeDrag=this;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['101']++;this._clickTimeout=Y.later(this.get('clickTimeThresh'),this,this._timeoutCheck);}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['25'][1]++;}__cov_Fr1SliDBP6G2yCnI4QmeSA.s['102']++;this.fire(EV_AFTER_MOUSE_DOWN,{ev:ev});},validClick:function(ev){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['26']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['103']++;var r=false,n=false,tar=ev.target,hTest=null,els=null,nlist=null,set=false;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['104']++;if(this._handles){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['28'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['105']++;Y.Object.each(this._handles,function(i,n){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['27']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['106']++;if((__cov_Fr1SliDBP6G2yCnI4QmeSA.b['30'][0]++,i instanceof Y.Node)||(__cov_Fr1SliDBP6G2yCnI4QmeSA.b['30'][1]++,i instanceof Y.NodeList)){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['29'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['107']++;if(!r){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['31'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['108']++;nlist=i;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['109']++;if(nlist instanceof Y.Node){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['32'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['110']++;nlist=new Y.NodeList(i._node);}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['32'][1]++;}__cov_Fr1SliDBP6G2yCnI4QmeSA.s['111']++;nlist.each(function(nl){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['28']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['112']++;if(nl.contains(tar)){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['33'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['113']++;r=true;}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['33'][1]++;}});}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['31'][1]++;}}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['29'][1]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['114']++;if(Y.Lang.isString(n)){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['34'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['115']++;if((__cov_Fr1SliDBP6G2yCnI4QmeSA.b['36'][0]++,tar.test(n+', '+n+' *'))&&(__cov_Fr1SliDBP6G2yCnI4QmeSA.b['36'][1]++,!hTest)){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['35'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['116']++;hTest=n;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['117']++;r=true;}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['35'][1]++;}}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['34'][1]++;}}});}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['28'][1]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['118']++;n=this.get(NODE);__cov_Fr1SliDBP6G2yCnI4QmeSA.s['119']++;if((__cov_Fr1SliDBP6G2yCnI4QmeSA.b['38'][0]++,n.contains(tar))||(__cov_Fr1SliDBP6G2yCnI4QmeSA.b['38'][1]++,n.compareTo(tar))){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['37'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['120']++;r=true;}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['37'][1]++;}}__cov_Fr1SliDBP6G2yCnI4QmeSA.s['121']++;if(r){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['39'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['122']++;if(this._invalids){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['40'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['123']++;Y.Object.each(this._invalids,function(i,n){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['29']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['124']++;if(Y.Lang.isString(n)){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['41'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['125']++;if(tar.test(n+', '+n+' *')){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['42'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['126']++;r=false;}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['42'][1]++;}}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['41'][1]++;}});}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['40'][1]++;}}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['39'][1]++;}__cov_Fr1SliDBP6G2yCnI4QmeSA.s['127']++;if(r){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['43'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['128']++;if(hTest){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['44'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['129']++;els=ev.currentTarget.all(hTest);__cov_Fr1SliDBP6G2yCnI4QmeSA.s['130']++;set=false;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['131']++;els.each(function(n){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['30']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['132']++;if(((__cov_Fr1SliDBP6G2yCnI4QmeSA.b['46'][0]++,n.contains(tar))||(__cov_Fr1SliDBP6G2yCnI4QmeSA.b['46'][1]++,n.compareTo(tar)))&&(__cov_Fr1SliDBP6G2yCnI4QmeSA.b['46'][2]++,!set)){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['45'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['133']++;set=true;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['134']++;this.set('activeHandle',n);}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['45'][1]++;}},this);}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['44'][1]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['135']++;this.set('activeHandle',this.get(NODE));}}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['43'][1]++;}__cov_Fr1SliDBP6G2yCnI4QmeSA.s['136']++;return r;},_setStartPosition:function(xy){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['31']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['137']++;this.startXY=xy;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['138']++;this.nodeXY=this.lastXY=this.realXY=this.get(NODE).getXY();__cov_Fr1SliDBP6G2yCnI4QmeSA.s['139']++;if(this.get('offsetNode')){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['47'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['140']++;this.deltaXY=[this.startXY[0]-this.nodeXY[0],this.startXY[1]-this.nodeXY[1]];}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['47'][1]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['141']++;this.deltaXY=[0,0];}},_timeoutCheck:function(){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['32']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['142']++;if((__cov_Fr1SliDBP6G2yCnI4QmeSA.b['49'][0]++,!this.get('lock'))&&(__cov_Fr1SliDBP6G2yCnI4QmeSA.b['49'][1]++,!this._dragThreshMet)&&(__cov_Fr1SliDBP6G2yCnI4QmeSA.b['49'][2]++,this._ev_md)){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['48'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['143']++;this._fromTimeout=this._dragThreshMet=true;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['144']++;this.start();__cov_Fr1SliDBP6G2yCnI4QmeSA.s['145']++;this._alignNode([this._ev_md.pageX,this._ev_md.pageY],true);}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['48'][1]++;}},removeHandle:function(str){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['33']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['146']++;var key=str;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['147']++;if((__cov_Fr1SliDBP6G2yCnI4QmeSA.b['51'][0]++,str instanceof Y.Node)||(__cov_Fr1SliDBP6G2yCnI4QmeSA.b['51'][1]++,str instanceof Y.NodeList)){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['50'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['148']++;key=str._yuid;}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['50'][1]++;}__cov_Fr1SliDBP6G2yCnI4QmeSA.s['149']++;if(this._handles[key]){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['52'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['150']++;delete this._handles[key];__cov_Fr1SliDBP6G2yCnI4QmeSA.s['151']++;this.fire(EV_REMOVE_HANDLE,{handle:str});}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['52'][1]++;}__cov_Fr1SliDBP6G2yCnI4QmeSA.s['152']++;return this;},addHandle:function(str){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['34']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['153']++;if(!this._handles){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['53'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['154']++;this._handles={};}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['53'][1]++;}__cov_Fr1SliDBP6G2yCnI4QmeSA.s['155']++;var key=str;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['156']++;if((__cov_Fr1SliDBP6G2yCnI4QmeSA.b['55'][0]++,str instanceof Y.Node)||(__cov_Fr1SliDBP6G2yCnI4QmeSA.b['55'][1]++,str instanceof Y.NodeList)){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['54'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['157']++;key=str._yuid;}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['54'][1]++;}__cov_Fr1SliDBP6G2yCnI4QmeSA.s['158']++;this._handles[key]=str;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['159']++;this.fire(EV_ADD_HANDLE,{handle:str});__cov_Fr1SliDBP6G2yCnI4QmeSA.s['160']++;return this;},removeInvalid:function(str){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['35']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['161']++;if(this._invalids[str]){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['56'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['162']++;this._invalids[str]=null;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['163']++;delete this._invalids[str];__cov_Fr1SliDBP6G2yCnI4QmeSA.s['164']++;this.fire(EV_REMOVE_INVALID,{handle:str});}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['56'][1]++;}__cov_Fr1SliDBP6G2yCnI4QmeSA.s['165']++;return this;},addInvalid:function(str){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['36']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['166']++;if(Y.Lang.isString(str)){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['57'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['167']++;this._invalids[str]=true;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['168']++;this.fire(EV_ADD_INVALID,{handle:str});}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['57'][1]++;}__cov_Fr1SliDBP6G2yCnI4QmeSA.s['169']++;return this;},initializer:function(){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['37']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['170']++;this.get(NODE).dd=this;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['171']++;if(!this.get(NODE).get('id')){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['58'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['172']++;var id=Y.stamp(this.get(NODE));__cov_Fr1SliDBP6G2yCnI4QmeSA.s['173']++;this.get(NODE).set('id',id);}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['58'][1]++;}__cov_Fr1SliDBP6G2yCnI4QmeSA.s['174']++;this.actXY=[];__cov_Fr1SliDBP6G2yCnI4QmeSA.s['175']++;this._invalids=Y.clone(this._invalidsDefault,true);__cov_Fr1SliDBP6G2yCnI4QmeSA.s['176']++;this._createEvents();__cov_Fr1SliDBP6G2yCnI4QmeSA.s['177']++;if(!this.get(DRAG_NODE)){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['59'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['178']++;this.set(DRAG_NODE,this.get(NODE));}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['59'][1]++;}__cov_Fr1SliDBP6G2yCnI4QmeSA.s['179']++;this.on('initializedChange',Y.bind(this._prep,this));__cov_Fr1SliDBP6G2yCnI4QmeSA.s['180']++;this.set('groups',this.get('groups'));},_prep:function(){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['38']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['181']++;this._dragThreshMet=false;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['182']++;var node=this.get(NODE);__cov_Fr1SliDBP6G2yCnI4QmeSA.s['183']++;node.addClass(DDM.CSS_PREFIX+'-draggable');__cov_Fr1SliDBP6G2yCnI4QmeSA.s['184']++;node.on(Drag.START_EVENT,Y.bind(this._handleMouseDownEvent,this));__cov_Fr1SliDBP6G2yCnI4QmeSA.s['185']++;node.on('mouseup',Y.bind(this._handleMouseUp,this));__cov_Fr1SliDBP6G2yCnI4QmeSA.s['186']++;node.on('dragstart',Y.bind(this._fixDragStart,this));},_unprep:function(){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['39']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['187']++;var node=this.get(NODE);__cov_Fr1SliDBP6G2yCnI4QmeSA.s['188']++;node.removeClass(DDM.CSS_PREFIX+'-draggable');__cov_Fr1SliDBP6G2yCnI4QmeSA.s['189']++;node.detachAll('mouseup');__cov_Fr1SliDBP6G2yCnI4QmeSA.s['190']++;node.detachAll('dragstart');__cov_Fr1SliDBP6G2yCnI4QmeSA.s['191']++;node.detachAll(Drag.START_EVENT);__cov_Fr1SliDBP6G2yCnI4QmeSA.s['192']++;this.mouseXY=[];__cov_Fr1SliDBP6G2yCnI4QmeSA.s['193']++;this.deltaXY=[0,0];__cov_Fr1SliDBP6G2yCnI4QmeSA.s['194']++;this.startXY=[];__cov_Fr1SliDBP6G2yCnI4QmeSA.s['195']++;this.nodeXY=[];__cov_Fr1SliDBP6G2yCnI4QmeSA.s['196']++;this.lastXY=[];__cov_Fr1SliDBP6G2yCnI4QmeSA.s['197']++;this.actXY=[];__cov_Fr1SliDBP6G2yCnI4QmeSA.s['198']++;this.realXY=[];},start:function(){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['40']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['199']++;if((__cov_Fr1SliDBP6G2yCnI4QmeSA.b['61'][0]++,!this.get('lock'))&&(__cov_Fr1SliDBP6G2yCnI4QmeSA.b['61'][1]++,!this.get(DRAGGING))){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['60'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['200']++;var node=this.get(NODE),ow,oh,xy;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['201']++;this._startTime=new Date().getTime();__cov_Fr1SliDBP6G2yCnI4QmeSA.s['202']++;DDM._start();__cov_Fr1SliDBP6G2yCnI4QmeSA.s['203']++;node.addClass(DDM.CSS_PREFIX+'-dragging');__cov_Fr1SliDBP6G2yCnI4QmeSA.s['204']++;this.fire(EV_START,{pageX:this.nodeXY[0],pageY:this.nodeXY[1],startTime:this._startTime});__cov_Fr1SliDBP6G2yCnI4QmeSA.s['205']++;node=this.get(DRAG_NODE);__cov_Fr1SliDBP6G2yCnI4QmeSA.s['206']++;xy=this.nodeXY;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['207']++;ow=node.get(OFFSET_WIDTH);__cov_Fr1SliDBP6G2yCnI4QmeSA.s['208']++;oh=node.get(OFFSET_HEIGHT);__cov_Fr1SliDBP6G2yCnI4QmeSA.s['209']++;if(this.get('startCentered')){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['62'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['210']++;this._setStartPosition([xy[0]+ow/2,xy[1]+oh/2]);}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['62'][1]++;}__cov_Fr1SliDBP6G2yCnI4QmeSA.s['211']++;this.region={'0':xy[0],'1':xy[1],area:0,top:xy[1],right:xy[0]+ow,bottom:xy[1]+oh,left:xy[0]};__cov_Fr1SliDBP6G2yCnI4QmeSA.s['212']++;this.set(DRAGGING,true);}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['60'][1]++;}__cov_Fr1SliDBP6G2yCnI4QmeSA.s['213']++;return this;},end:function(){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['41']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['214']++;this._endTime=new Date().getTime();__cov_Fr1SliDBP6G2yCnI4QmeSA.s['215']++;if(this._clickTimeout){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['63'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['216']++;this._clickTimeout.cancel();}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['63'][1]++;}__cov_Fr1SliDBP6G2yCnI4QmeSA.s['217']++;this._dragThreshMet=this._fromTimeout=false;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['218']++;if((__cov_Fr1SliDBP6G2yCnI4QmeSA.b['65'][0]++,!this.get('lock'))&&(__cov_Fr1SliDBP6G2yCnI4QmeSA.b['65'][1]++,this.get(DRAGGING))){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['64'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['219']++;this.fire(EV_END,{pageX:this.lastXY[0],pageY:this.lastXY[1],startTime:this._startTime,endTime:this._endTime});}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['64'][1]++;}__cov_Fr1SliDBP6G2yCnI4QmeSA.s['220']++;this.get(NODE).removeClass(DDM.CSS_PREFIX+'-dragging');__cov_Fr1SliDBP6G2yCnI4QmeSA.s['221']++;this.set(DRAGGING,false);__cov_Fr1SliDBP6G2yCnI4QmeSA.s['222']++;this.deltaXY=[0,0];__cov_Fr1SliDBP6G2yCnI4QmeSA.s['223']++;return this;},_defEndFn:function(){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['42']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['224']++;this._fixIEMouseUp();__cov_Fr1SliDBP6G2yCnI4QmeSA.s['225']++;this._ev_md=null;},_prevEndFn:function(){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['43']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['226']++;this._fixIEMouseUp();__cov_Fr1SliDBP6G2yCnI4QmeSA.s['227']++;this.get(DRAG_NODE).setXY(this.nodeXY);__cov_Fr1SliDBP6G2yCnI4QmeSA.s['228']++;this._ev_md=null;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['229']++;this.region=null;},_align:function(xy){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['44']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['230']++;this.fire(EV_ALIGN,{pageX:xy[0],pageY:xy[1]});},_defAlignFn:function(e){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['45']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['231']++;this.actXY=[e.pageX-this.deltaXY[0],e.pageY-this.deltaXY[1]];},_alignNode:function(eXY,scroll){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['46']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['232']++;this._align(eXY);__cov_Fr1SliDBP6G2yCnI4QmeSA.s['233']++;if(!scroll){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['66'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['234']++;this._moveNode();}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['66'][1]++;}},_moveNode:function(scroll){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['47']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['235']++;var diffXY=[],diffXY2=[],startXY=this.nodeXY,xy=this.actXY;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['236']++;diffXY[0]=xy[0]-this.lastXY[0];__cov_Fr1SliDBP6G2yCnI4QmeSA.s['237']++;diffXY[1]=xy[1]-this.lastXY[1];__cov_Fr1SliDBP6G2yCnI4QmeSA.s['238']++;diffXY2[0]=xy[0]-this.nodeXY[0];__cov_Fr1SliDBP6G2yCnI4QmeSA.s['239']++;diffXY2[1]=xy[1]-this.nodeXY[1];__cov_Fr1SliDBP6G2yCnI4QmeSA.s['240']++;this.region={'0':xy[0],'1':xy[1],area:0,top:xy[1],right:xy[0]+this.get(DRAG_NODE).get(OFFSET_WIDTH),bottom:xy[1]+this.get(DRAG_NODE).get(OFFSET_HEIGHT),left:xy[0]};__cov_Fr1SliDBP6G2yCnI4QmeSA.s['241']++;this.fire(EV_DRAG,{pageX:xy[0],pageY:xy[1],scroll:scroll,info:{start:startXY,xy:xy,delta:diffXY,offset:diffXY2}});__cov_Fr1SliDBP6G2yCnI4QmeSA.s['242']++;this.lastXY=xy;},_defDragFn:function(e){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['48']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['243']++;if(this.get('move')){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['67'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['244']++;if((__cov_Fr1SliDBP6G2yCnI4QmeSA.b['69'][0]++,e.scroll)&&(__cov_Fr1SliDBP6G2yCnI4QmeSA.b['69'][1]++,e.scroll.node)){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['68'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['245']++;var domNode=e.scroll.node.getDOMNode();__cov_Fr1SliDBP6G2yCnI4QmeSA.s['246']++;if(domNode===Y.config.win){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['70'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['247']++;domNode.scrollTo(e.scroll.left,e.scroll.top);}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['70'][1]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['248']++;e.scroll.node.set('scrollTop',e.scroll.top);__cov_Fr1SliDBP6G2yCnI4QmeSA.s['249']++;e.scroll.node.set('scrollLeft',e.scroll.left);}}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['68'][1]++;}__cov_Fr1SliDBP6G2yCnI4QmeSA.s['250']++;this.get(DRAG_NODE).setXY([e.pageX,e.pageY]);__cov_Fr1SliDBP6G2yCnI4QmeSA.s['251']++;this.realXY=[e.pageX,e.pageY];}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['67'][1]++;}},_move:function(ev){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['49']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['252']++;if(this.get('lock')){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['71'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['253']++;return false;}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['71'][1]++;}__cov_Fr1SliDBP6G2yCnI4QmeSA.s['254']++;this.mouseXY=[ev.pageX,ev.pageY];__cov_Fr1SliDBP6G2yCnI4QmeSA.s['255']++;if(!this._dragThreshMet){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['72'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['256']++;var diffX=Math.abs(this.startXY[0]-ev.pageX),diffY=Math.abs(this.startXY[1]-ev.pageY);__cov_Fr1SliDBP6G2yCnI4QmeSA.s['257']++;if((__cov_Fr1SliDBP6G2yCnI4QmeSA.b['74'][0]++,diffX>this.get('clickPixelThresh'))||(__cov_Fr1SliDBP6G2yCnI4QmeSA.b['74'][1]++,diffY>this.get('clickPixelThresh'))){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['73'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['258']++;this._dragThreshMet=true;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['259']++;this.start();__cov_Fr1SliDBP6G2yCnI4QmeSA.s['260']++;if((__cov_Fr1SliDBP6G2yCnI4QmeSA.b['76'][0]++,ev)&&(__cov_Fr1SliDBP6G2yCnI4QmeSA.b['76'][1]++,ev.preventDefault)){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['75'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['261']++;ev.preventDefault();}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['75'][1]++;}__cov_Fr1SliDBP6G2yCnI4QmeSA.s['262']++;this._alignNode([ev.pageX,ev.pageY]);}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['73'][1]++;}}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['72'][1]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['263']++;if(this._clickTimeout){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['77'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['264']++;this._clickTimeout.cancel();}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['77'][1]++;}__cov_Fr1SliDBP6G2yCnI4QmeSA.s['265']++;this._alignNode([ev.pageX,ev.pageY]);}},stopDrag:function(){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['50']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['266']++;if(this.get(DRAGGING)){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['78'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['267']++;DDM._end();}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['78'][1]++;}__cov_Fr1SliDBP6G2yCnI4QmeSA.s['268']++;return this;},destructor:function(){__cov_Fr1SliDBP6G2yCnI4QmeSA.f['51']++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['269']++;this._unprep();__cov_Fr1SliDBP6G2yCnI4QmeSA.s['270']++;if(this.target){__cov_Fr1SliDBP6G2yCnI4QmeSA.b['79'][0]++;__cov_Fr1SliDBP6G2yCnI4QmeSA.s['271']++;this.target.destroy();}else{__cov_Fr1SliDBP6G2yCnI4QmeSA.b['79'][1]++;}__cov_Fr1SliDBP6G2yCnI4QmeSA.s['272']++;DDM._unregDrag(this);}});__cov_Fr1SliDBP6G2yCnI4QmeSA.s['273']++;Y.namespace('DD');__cov_Fr1SliDBP6G2yCnI4QmeSA.s['274']++;Y.DD.Drag=Drag;},'@VERSION@',{'requires':['dd-ddm-base']}); diff --git a/src/build/dd-drag/dd-drag-debug.js b/src/build/dd-drag/dd-drag-debug.js new file mode 100644 index 00000000000..49136ee0e0d --- /dev/null +++ b/src/build/dd-drag/dd-drag-debug.js @@ -0,0 +1,1267 @@ +YUI.add('dd-drag', function (Y, NAME) { + + + /** + * Provides the ability to drag a Node. + * @module dd + * @submodule dd-drag + */ + /** + * Provides the ability to drag a Node. + * @class Drag + * @extends Base + * @constructor + * @namespace DD + */ + + var DDM = Y.DD.DDM, + NODE = 'node', + DRAGGING = 'dragging', + DRAG_NODE = 'dragNode', + OFFSET_HEIGHT = 'offsetHeight', + OFFSET_WIDTH = 'offsetWidth', + /** + * Handles the mouseup DOM event, does nothing internally just fires. + * @event drag:mouseup + * @bubbles DDM + * @type {CustomEvent} + */ + /** + * Handles the mousedown DOM event, checks to see if you have a valid handle then starts the drag timers. + * @event drag:mouseDown + * @preventable _defMouseDownFn + * @param {EventFacade} event An Event Facade object with the following specific property added: + *
ev
The original mousedown event.
+ * @bubbles DDM + * @type {CustomEvent} + */ + EV_MOUSE_DOWN = 'drag:mouseDown', + /** + * Fires after the mousedown event has been cleared. + * @event drag:afterMouseDown + * @param {EventFacade} event An Event Facade object with the following specific property added: + *
ev
The original mousedown event.
+ * @bubbles DDM + * @type {CustomEvent} + */ + EV_AFTER_MOUSE_DOWN = 'drag:afterMouseDown', + /** + * Fires after a handle is removed. + * @event drag:removeHandle + * @param {EventFacade} event An Event Facade object with the following specific property added: + *
handle
The handle that was removed.
+ * @bubbles DDM + * @type {CustomEvent} + */ + EV_REMOVE_HANDLE = 'drag:removeHandle', + /** + * Fires after a handle is added. + * @event drag:addHandle + * @param {EventFacade} event An Event Facade object with the following specific property added: + *
handle
The handle that was added.
+ * @bubbles DDM + * @type {CustomEvent} + */ + EV_ADD_HANDLE = 'drag:addHandle', + /** + * Fires after an invalid selector is removed. + * @event drag:removeInvalid + * @param {EventFacade} event An Event Facade object with the following specific property added: + *
handle
The handle that was removed.
+ * @bubbles DDM + * @type {CustomEvent} + */ + EV_REMOVE_INVALID = 'drag:removeInvalid', + /** + * Fires after an invalid selector is added. + * @event drag:addInvalid + * @param {EventFacade} event An Event Facade object with the following specific property added: + *
handle
The handle that was added.
+ * @bubbles DDM + * @type {CustomEvent} + */ + EV_ADD_INVALID = 'drag:addInvalid', + /** + * Fires at the start of a drag operation. + * @event drag:start + * @param {EventFacade} event An Event Facade object with the following specific property added: + *
+ *
pageX
The original node position X.
+ *
pageY
The original node position Y.
+ *
startTime
The startTime of the event. getTime on the current Date object.
+ *
+ * @bubbles DDM + * @type {CustomEvent} + */ + EV_START = 'drag:start', + /** + * Fires at the end of a drag operation. + * @event drag:end + * @param {EventFacade} event An Event Facade object with the following specific property added: + *
+ *
pageX
The current node position X.
+ *
pageY
The current node position Y.
+ *
startTime
The startTime of the event, from the start event.
+ *
endTime
The endTime of the event. getTime on the current Date object.
+ *
+ * @bubbles DDM + * @type {CustomEvent} + */ + EV_END = 'drag:end', + /** + * Fires every mousemove during a drag operation. + * @event drag:drag + * @param {EventFacade} event An Event Facade object with the following specific property added: + *
+ *
pageX
The current node position X.
+ *
pageY
The current node position Y.
+ *
scroll
Should a scroll action occur.
+ *
info
Object hash containing calculated XY arrays: start, xy, delta, offset
+ *
+ * @bubbles DDM + * @type {CustomEvent} + */ + EV_DRAG = 'drag:drag', + /** + * Fires when this node is aligned. + * @event drag:align + * @preventable _defAlignFn + * @param {EventFacade} event An Event Facade object with the following specific property added: + *
+ *
pageX
The current node position X.
+ *
pageY
The current node position Y.
+ *
+ * @bubbles DDM + * @type {CustomEvent} + */ + EV_ALIGN = 'drag:align', + /** + * Fires when this node is over a Drop Target. (Fired from dd-drop) + * @event drag:over + * @param {EventFacade} event An Event Facade object with the following specific property added: + *
+ *
drop
The drop object at the time of the event.
+ *
drag
The drag object at the time of the event.
+ *
+ * @bubbles DDM + * @type {CustomEvent} + */ + /** + * Fires when this node enters a Drop Target. (Fired from dd-drop) + * @event drag:enter + * @param {EventFacade} event An Event Facade object with the following specific property added: + *
+ *
drop
The drop object at the time of the event.
+ *
drag
The drag object at the time of the event.
+ *
+ * @bubbles DDM + * @type {CustomEvent} + */ + /** + * Fires when this node exits a Drop Target. (Fired from dd-drop) + * @event drag:exit + * @param {EventFacade} event An Event Facade object with the following specific property added: + *
+ *
drop
The drop object at the time of the event.
+ *
+ * @bubbles DDM + * @type {CustomEvent} + */ + /** + * Fires when this node is dropped on a valid Drop Target. (Fired from dd-ddm-drop) + * @event drag:drophit + * @param {EventFacade} event An Event Facade object with the following specific property added: + *
+ *
drop
The best guess on what was dropped on.
+ *
drag
The drag object at the time of the event.
+ *
others
An array of all the other drop targets that was dropped on.
+ *
+ * @bubbles DDM + * @type {CustomEvent} + */ + /** + * Fires when this node is dropped on an invalid Drop Target. (Fired from dd-ddm-drop) + * @event drag:dropmiss + * @param {EventFacade} event An Event Facade object with the following specific property added: + *
+ *
pageX
The current node position X.
+ *
pageY
The current node position Y.
+ *
+ * @bubbles DDM + * @type {CustomEvent} + */ + + Drag = function(o) { + this._lazyAddAttrs = false; + Drag.superclass.constructor.apply(this, arguments); + + var valid = DDM._regDrag(this); + if (!valid) { + Y.error('Failed to register node, already in use: ' + o.node); + } + }; + + Drag.NAME = 'drag'; + + /** + * This property defaults to "mousedown", but when drag-gestures is loaded, it is changed to "gesturemovestart" + * @static + * @property START_EVENT + */ + Drag.START_EVENT = 'mousedown'; + + Drag.ATTRS = { + /** + * Y.Node instance to use as the element to initiate a drag operation + * @attribute node + * @type Node + */ + node: { + setter: function(node) { + if (this._canDrag(node)) { + return node; + } + var n = Y.one(node); + if (!n) { + Y.error('DD.Drag: Invalid Node Given: ' + node); + } + return n; + } + }, + /** + * Y.Node instance to use as the draggable element, defaults to node + * @attribute dragNode + * @type Node + */ + dragNode: { + setter: function(node) { + if (this._canDrag(node)) { + return node; + } + var n = Y.one(node); + if (!n) { + Y.error('DD.Drag: Invalid dragNode Given: ' + node); + } + return n; + } + }, + /** + * Offset the drag element by the difference in cursor position: default true + * @attribute offsetNode + * @type Boolean + */ + offsetNode: { + value: true + }, + /** + * Center the dragNode to the mouse position on drag:start: default false + * @attribute startCentered + * @type Boolean + */ + startCentered: { + value: false + }, + /** + * The number of pixels to move to start a drag operation, default is 3. + * @attribute clickPixelThresh + * @type Number + */ + clickPixelThresh: { + value: DDM.get('clickPixelThresh') + }, + /** + * The number of milliseconds a mousedown has to pass to start a drag operation, default is 1000. + * @attribute clickTimeThresh + * @type Number + */ + clickTimeThresh: { + value: DDM.get('clickTimeThresh') + }, + /** + * Set to lock this drag element so that it can't be dragged: default false. + * @attribute lock + * @type Boolean + */ + lock: { + value: false, + setter: function(lock) { + if (lock) { + this.get(NODE).addClass(DDM.CSS_PREFIX + '-locked'); + } else { + this.get(NODE).removeClass(DDM.CSS_PREFIX + '-locked'); + } + return lock; + } + }, + /** + * A payload holder to store arbitrary data about this drag object, can be used to store any value. + * @attribute data + * @type Mixed + */ + data: { + value: false + }, + /** + * If this is false, the drag element will not move with the cursor: default true. Can be used to "resize" the element. + * @attribute move + * @type Boolean + */ + move: { + value: true + }, + /** + * Use the protective shim on all drag operations: default true. Only works with dd-ddm, not dd-ddm-base. + * @attribute useShim + * @type Boolean + */ + useShim: { + value: true + }, + /** + * Config option is set by Drag to inform you of which handle fired the drag event (in the case that there are several handles): default false. + * @attribute activeHandle + * @type Node + */ + activeHandle: { + value: false + }, + /** + * By default a drag operation will only begin if the mousedown occurred with the primary mouse button. + * Setting this to false will allow for all mousedown events to trigger a drag. + * @attribute primaryButtonOnly + * @type Boolean + */ + primaryButtonOnly: { + value: true + }, + /** + * This attribute is not meant to be used by the implementor, it is meant to be used as an Event tracker so you can listen for it to change. + * @attribute dragging + * @type Boolean + */ + dragging: { + value: false + }, + parent: { + value: false + }, + /** + * This attribute only works if the dd-drop module has been loaded. It will make this node a drop target as well as draggable. + * @attribute target + * @type Boolean + */ + target: { + value: false, + setter: function(config) { + this._handleTarget(config); + return config; + } + }, + /** + * This attribute only works if the dd-drop module is active. It will set the dragMode (point, intersect, strict) of this Drag instance. + * @attribute dragMode + * @type String + */ + dragMode: { + value: null, + setter: function(mode) { + return DDM._setDragMode(mode); + } + }, + /** + * Array of groups to add this drag into. + * @attribute groups + * @type Array + */ + groups: { + value: ['default'], + getter: function() { + if (!this._groups) { + this._groups = {}; + return []; + } + + return Y.Object.keys(this._groups); + }, + setter: function(g) { + this._groups = Y.Array.hash(g); + return g; + } + }, + /** + * Array of valid handles to add. Adding something here will set all handles, even if previously added with addHandle + * @attribute handles + * @type Array + */ + handles: { + value: null, + setter: function(g) { + if (g) { + this._handles = {}; + Y.Array.each(g, function(v) { + var key = v; + if (v instanceof Y.Node || v instanceof Y.NodeList) { + key = v._yuid; + } + this._handles[key] = v; + }, this); + } else { + this._handles = null; + } + return g; + } + }, + /** + * Controls the default bubble parent for this Drag instance. Default: Y.DD.DDM. Set to false to disable bubbling. Use bubbleTargets in config + * @deprecated + * @attribute bubbles + * @type Object + */ + bubbles: { + setter: function(t) { + Y.log('bubbles is deprecated use bubbleTargets: HOST', 'warn', 'dd'); + this.addTarget(t); + return t; + } + }, + /** + * Should the mousedown event be halted. Default: true + * @attribute haltDown + * @type Boolean + */ + haltDown: { + value: true + } + }; + + Y.extend(Drag, Y.Base, { + /** + * Checks the object for the methods needed to drag the object around. + * Normally this would be a node instance, but in the case of Graphics, it + * may be an SVG node or something similar. + * @method _canDrag + * @private + * @param {Object} n The object to check + * @return {Boolean} True or false if the Object contains the methods needed to Drag + */ + _canDrag: function(n) { + if (n && n.setXY && n.getXY && n.test && n.contains) { + return true; + } + return false; + }, + /** + * The default bubbleTarget for this object. Default: Y.DD.DDM + * @private + * @property _bubbleTargets + */ + _bubbleTargets: Y.DD.DDM, + /** + * Add this Drag instance to a group, this should be used for on-the-fly group additions. + * @method addToGroup + * @param {String} g The group to add this Drag Instance to. + * @chainable + */ + addToGroup: function(g) { + this._groups[g] = true; + DDM._activateTargets(); + return this; + }, + /** + * Remove this Drag instance from a group, this should be used for on-the-fly group removals. + * @method removeFromGroup + * @param {String} g The group to remove this Drag Instance from. + * @chainable + */ + removeFromGroup: function(g) { + delete this._groups[g]; + DDM._activateTargets(); + return this; + }, + /** + * This will be a reference to the Drop instance associated with this drag if the target: true config attribute is set.. + * @property target + * @type {Object} + */ + target: null, + /** + * Attribute handler for the target config attribute. + * @private + * @method _handleTarget + * @param {Boolean/Object} config The Config + */ + _handleTarget: function(config) { + if (Y.DD.Drop) { + if (config === false) { + if (this.target) { + DDM._unregTarget(this.target); + this.target = null; + } + } else { + if (!Y.Lang.isObject(config)) { + config = {}; + } + config.bubbleTargets = config.bubbleTargets || this.getTargets(); + config.node = this.get(NODE); + config.groups = config.groups || this.get('groups'); + this.target = new Y.DD.Drop(config); + } + } + }, + /** + * Storage Array for the groups this drag belongs to. + * @private + * @property _groups + * @type {Array} + */ + _groups: null, + /** + * This method creates all the events for this Event Target and publishes them so we get Event Bubbling. + * @private + * @method _createEvents + */ + _createEvents: function() { + + this.publish(EV_MOUSE_DOWN, { + defaultFn: this._defMouseDownFn, + queuable: false, + emitFacade: true, + bubbles: true, + prefix: 'drag' + }); + + this.publish(EV_ALIGN, { + defaultFn: this._defAlignFn, + queuable: false, + emitFacade: true, + bubbles: true, + prefix: 'drag' + }); + + this.publish(EV_DRAG, { + defaultFn: this._defDragFn, + queuable: false, + emitFacade: true, + bubbles: true, + prefix: 'drag' + }); + + this.publish(EV_END, { + defaultFn: this._defEndFn, + preventedFn: this._prevEndFn, + queuable: false, + emitFacade: true, + bubbles: true, + prefix: 'drag' + }); + + var ev = [ + EV_AFTER_MOUSE_DOWN, + EV_REMOVE_HANDLE, + EV_ADD_HANDLE, + EV_REMOVE_INVALID, + EV_ADD_INVALID, + EV_START, + 'drag:drophit', + 'drag:dropmiss', + 'drag:over', + 'drag:enter', + 'drag:exit' + ]; + + Y.Array.each(ev, function(v) { + this.publish(v, { + type: v, + emitFacade: true, + bubbles: true, + preventable: false, + queuable: false, + prefix: 'drag' + }); + }, this); + }, + /** + * A private reference to the mousedown DOM event + * @private + * @property _ev_md + * @type {EventFacade} + */ + _ev_md: null, + /** + * The getTime of the mousedown event. Not used, just here in case someone wants/needs to use it. + * @private + * @property _startTime + * @type Date + */ + _startTime: null, + /** + * The getTime of the mouseup event. Not used, just here in case someone wants/needs to use it. + * @private + * @property _endTime + * @type Date + */ + _endTime: null, + /** + * A private hash of the valid drag handles + * @private + * @property _handles + * @type {Object} + */ + _handles: null, + /** + * A private hash of the invalid selector strings + * @private + * @property _invalids + * @type {Object} + */ + _invalids: null, + /** + * A private hash of the default invalid selector strings: {'textarea': true, 'input': true, 'a': true, 'button': true, 'select': true} + * @private + * @property _invalidsDefault + * @type {Object} + */ + _invalidsDefault: {'textarea': true, 'input': true, 'a': true, 'button': true, 'select': true }, + /** + * Private flag to see if the drag threshhold was met + * @private + * @property _dragThreshMet + * @type {Boolean} + */ + _dragThreshMet: null, + /** + * Flag to determine if the drag operation came from a timeout + * @private + * @property _fromTimeout + * @type {Boolean} + */ + _fromTimeout: null, + /** + * Holder for the setTimeout call + * @private + * @property _clickTimeout + * @type {Boolean} + */ + _clickTimeout: null, + /** + * The offset of the mouse position to the element's position + * @property deltaXY + * @type {Array} + */ + deltaXY: null, + /** + * The initial mouse position + * @property startXY + * @type {Array} + */ + startXY: null, + /** + * The initial element position + * @property nodeXY + * @type {Array} + */ + nodeXY: null, + /** + * The position of the element as it's moving (for offset calculations) + * @property lastXY + * @type {Array} + */ + lastXY: null, + /** + * The xy that the node will be set to. Changing this will alter the position as it's dragged. + * @property actXY + * @type {Array} + */ + actXY: null, + /** + * The real xy position of the node. + * @property realXY + * @type {Array} + */ + realXY: null, + /** + * The XY coords of the mousemove + * @property mouseXY + * @type {Array} + */ + mouseXY: null, + /** + * A region object associated with this drag, used for checking regions while dragging. + * @property region + * @type Object + */ + region: null, + /** + * Handler for the mouseup DOM event + * @private + * @method _handleMouseUp + * @param {EventFacade} ev The Event + */ + _handleMouseUp: function() { + this.fire('drag:mouseup'); + this._fixIEMouseUp(); + if (DDM.activeDrag) { + DDM._end(); + } + }, + /** + * The function we use as the ondragstart handler when we start a drag + * in Internet Explorer. This keeps IE from blowing up on images as drag handles. + * @private + * @method _fixDragStart + * @param {Event} e The Event + */ + _fixDragStart: function(e) { + if (this.validClick(e)) { + e.preventDefault(); + } + }, + /** + * The function we use as the onselectstart handler when we start a drag in Internet Explorer + * @private + * @method _ieSelectFix + */ + _ieSelectFix: function() { + return false; + }, + /** + * We will hold a copy of the current "onselectstart" method on this property, and reset it after we are done using it. + * @private + * @property _ieSelectBack + */ + _ieSelectBack: null, + /** + * This method copies the onselectstart listner on the document to the _ieSelectFix property + * @private + * @method _fixIEMouseDown + */ + _fixIEMouseDown: function() { + if (Y.UA.ie) { + this._ieSelectBack = Y.config.doc.body.onselectstart; + Y.config.doc.body.onselectstart = this._ieSelectFix; + } + }, + /** + * This method copies the _ieSelectFix property back to the onselectstart listner on the document. + * @private + * @method _fixIEMouseUp + */ + _fixIEMouseUp: function() { + if (Y.UA.ie) { + Y.config.doc.body.onselectstart = this._ieSelectBack; + } + }, + /** + * Handler for the mousedown DOM event + * @private + * @method _handleMouseDownEvent + * @param {EventFacade} ev The Event + */ + _handleMouseDownEvent: function(ev) { + this.fire(EV_MOUSE_DOWN, { ev: ev }); + }, + /** + * Handler for the mousedown DOM event + * @private + * @method _defMouseDownFn + * @param {EventFacade} e The Event + */ + _defMouseDownFn: function(e) { + var ev = e.ev; + + this._dragThreshMet = false; + this._ev_md = ev; + + if (this.get('primaryButtonOnly') && ev.button > 1) { + return false; + } + if (this.validClick(ev)) { + this._fixIEMouseDown(ev); + if (Drag.START_EVENT.indexOf('gesture') !== 0) { + //Only do these if it's not a gesture + if (this.get('haltDown')) { + Y.log('Halting MouseDown', 'info', 'drag'); + ev.halt(); + } else { + Y.log('Preventing Default on MouseDown', 'info', 'drag'); + ev.preventDefault(); + } + } + + this._setStartPosition([ev.pageX, ev.pageY]); + + DDM.activeDrag = this; + + this._clickTimeout = Y.later(this.get('clickTimeThresh'), this, this._timeoutCheck); + } + this.fire(EV_AFTER_MOUSE_DOWN, { ev: ev }); + }, + /** + * Method first checks to see if we have handles, if so it validates the click + * against the handle. Then if it finds a valid handle, it checks it against + * the invalid handles list. Returns true if a good handle was used, false otherwise. + * @method validClick + * @param {EventFacade} ev The Event + * @return {Boolean} + */ + validClick: function(ev) { + var r = false, n = false, + tar = ev.target, + hTest = null, + els = null, + nlist = null, + set = false; + if (this._handles) { + Y.Object.each(this._handles, function(i, n) { + if (i instanceof Y.Node || i instanceof Y.NodeList) { + if (!r) { + nlist = i; + if (nlist instanceof Y.Node) { + nlist = new Y.NodeList(i._node); + } + nlist.each(function(nl) { + if (nl.contains(tar)) { + r = true; + } + }); + } + } else if (Y.Lang.isString(n)) { + //Am I this or am I inside this + if (tar.test(n + ', ' + n + ' *') && !hTest) { + hTest = n; + r = true; + } + } + }); + } else { + n = this.get(NODE); + if (n.contains(tar) || n.compareTo(tar)) { + r = true; + } + } + if (r) { + if (this._invalids) { + Y.Object.each(this._invalids, function(i, n) { + if (Y.Lang.isString(n)) { + //Am I this or am I inside this + if (tar.test(n + ', ' + n + ' *')) { + r = false; + } + } + }); + } + } + if (r) { + if (hTest) { + els = ev.currentTarget.all(hTest); + set = false; + els.each(function(n) { + if ((n.contains(tar) || n.compareTo(tar)) && !set) { + set = true; + this.set('activeHandle', n); + } + }, this); + } else { + this.set('activeHandle', this.get(NODE)); + } + } + return r; + }, + /** + * Sets the current position of the Element and calculates the offset + * @private + * @method _setStartPosition + * @param {Array} xy The XY coords to set the position to. + */ + _setStartPosition: function(xy) { + this.startXY = xy; + + this.nodeXY = this.lastXY = this.realXY = this.get(NODE).getXY(); + + if (this.get('offsetNode')) { + this.deltaXY = [(this.startXY[0] - this.nodeXY[0]), (this.startXY[1] - this.nodeXY[1])]; + } else { + this.deltaXY = [0, 0]; + } + }, + /** + * The method passed to setTimeout to determine if the clickTimeThreshold was met. + * @private + * @method _timeoutCheck + */ + _timeoutCheck: function() { + if (!this.get('lock') && !this._dragThreshMet && this._ev_md) { + this._fromTimeout = this._dragThreshMet = true; + this.start(); + this._alignNode([this._ev_md.pageX, this._ev_md.pageY], true); + } + }, + /** + * Remove a Selector added by addHandle + * @method removeHandle + * @param {String} str The selector for the handle to be removed. + * @chainable + */ + removeHandle: function(str) { + var key = str; + if (str instanceof Y.Node || str instanceof Y.NodeList) { + key = str._yuid; + } + if (this._handles[key]) { + delete this._handles[key]; + this.fire(EV_REMOVE_HANDLE, { handle: str }); + } + return this; + }, + /** + * Add a handle to a drag element. Drag only initiates when a mousedown happens on this element. + * @method addHandle + * @param {String} str The selector to test for a valid handle. Must be a child of the element. + * @chainable + */ + addHandle: function(str) { + if (!this._handles) { + this._handles = {}; + } + var key = str; + if (str instanceof Y.Node || str instanceof Y.NodeList) { + key = str._yuid; + } + this._handles[key] = str; + this.fire(EV_ADD_HANDLE, { handle: str }); + return this; + }, + /** + * Remove an invalid handle added by addInvalid + * @method removeInvalid + * @param {String} str The invalid handle to remove from the internal list. + * @chainable + */ + removeInvalid: function(str) { + if (this._invalids[str]) { + this._invalids[str] = null; + delete this._invalids[str]; + this.fire(EV_REMOVE_INVALID, { handle: str }); + } + return this; + }, + /** + * Add a selector string to test the handle against. If the test passes the drag operation will not continue. + * @method addInvalid + * @param {String} str The selector to test against to determine if this is an invalid drag handle. + * @chainable + */ + addInvalid: function(str) { + if (Y.Lang.isString(str)) { + this._invalids[str] = true; + this.fire(EV_ADD_INVALID, { handle: str }); + } + return this; + }, + /** + * Internal init handler + * @private + * @method initializer + */ + initializer: function() { + + this.get(NODE).dd = this; + + if (!this.get(NODE).get('id')) { + var id = Y.stamp(this.get(NODE)); + this.get(NODE).set('id', id); + } + + this.actXY = []; + + this._invalids = Y.clone(this._invalidsDefault, true); + + this._createEvents(); + + if (!this.get(DRAG_NODE)) { + this.set(DRAG_NODE, this.get(NODE)); + } + + //Fix for #2528096 + //Don't prep the DD instance until all plugins are loaded. + this.on('initializedChange', Y.bind(this._prep, this)); + + //Shouldn't have to do this.. + this.set('groups', this.get('groups')); + }, + /** + * Attach event listners and add classname + * @private + * @method _prep + */ + _prep: function() { + this._dragThreshMet = false; + var node = this.get(NODE); + node.addClass(DDM.CSS_PREFIX + '-draggable'); + node.on(Drag.START_EVENT, Y.bind(this._handleMouseDownEvent, this)); + node.on('mouseup', Y.bind(this._handleMouseUp, this)); + node.on('dragstart', Y.bind(this._fixDragStart, this)); + }, + /** + * Detach event listeners and remove classname + * @private + * @method _unprep + */ + _unprep: function() { + var node = this.get(NODE); + node.removeClass(DDM.CSS_PREFIX + '-draggable'); + node.detachAll('mouseup'); + node.detachAll('dragstart'); + node.detachAll(Drag.START_EVENT); + this.mouseXY = []; + this.deltaXY = [0,0]; + this.startXY = []; + this.nodeXY = []; + this.lastXY = []; + this.actXY = []; + this.realXY = []; + }, + /** + * Starts the drag operation + * @method start + * @chainable + */ + start: function() { + if (!this.get('lock') && !this.get(DRAGGING)) { + var node = this.get(NODE), ow, oh, xy; + this._startTime = (new Date()).getTime(); + + DDM._start(); + node.addClass(DDM.CSS_PREFIX + '-dragging'); + this.fire(EV_START, { + pageX: this.nodeXY[0], + pageY: this.nodeXY[1], + startTime: this._startTime + }); + node = this.get(DRAG_NODE); + xy = this.nodeXY; + + ow = node.get(OFFSET_WIDTH); + oh = node.get(OFFSET_HEIGHT); + + if (this.get('startCentered')) { + this._setStartPosition([xy[0] + (ow / 2), xy[1] + (oh / 2)]); + } + + + this.region = { + '0': xy[0], + '1': xy[1], + area: 0, + top: xy[1], + right: xy[0] + ow, + bottom: xy[1] + oh, + left: xy[0] + }; + this.set(DRAGGING, true); + } + return this; + }, + /** + * Ends the drag operation + * @method end + * @chainable + */ + end: function() { + this._endTime = (new Date()).getTime(); + if (this._clickTimeout) { + this._clickTimeout.cancel(); + } + this._dragThreshMet = this._fromTimeout = false; + + if (!this.get('lock') && this.get(DRAGGING)) { + this.fire(EV_END, { + pageX: this.lastXY[0], + pageY: this.lastXY[1], + startTime: this._startTime, + endTime: this._endTime + }); + } + this.get(NODE).removeClass(DDM.CSS_PREFIX + '-dragging'); + this.set(DRAGGING, false); + this.deltaXY = [0, 0]; + + return this; + }, + /** + * Handler for fixing the selection in IE + * @private + * @method _defEndFn + */ + _defEndFn: function() { + this._fixIEMouseUp(); + this._ev_md = null; + }, + /** + * Handler for preventing the drag:end event. It will reset the node back to it's start position + * @private + * @method _prevEndFn + */ + _prevEndFn: function() { + this._fixIEMouseUp(); + //Bug #1852577 + this.get(DRAG_NODE).setXY(this.nodeXY); + this._ev_md = null; + this.region = null; + }, + /** + * Calculates the offsets and set's the XY that the element will move to. + * @private + * @method _align + * @param {Array} xy The xy coords to align with. + */ + _align: function(xy) { + this.fire(EV_ALIGN, {pageX: xy[0], pageY: xy[1] }); + }, + /** + * Calculates the offsets and set's the XY that the element will move to. + * @private + * @method _defAlignFn + * @param {EventFacade} e The drag:align event. + */ + _defAlignFn: function(e) { + this.actXY = [e.pageX - this.deltaXY[0], e.pageY - this.deltaXY[1]]; + }, + /** + * This method performs the alignment before the element move. + * @private + * @method _alignNode + * @param {Array} eXY The XY to move the element to, usually comes from the mousemove DOM event. + */ + _alignNode: function(eXY, scroll) { + this._align(eXY); + if (!scroll) { + this._moveNode(); + } + }, + /** + * This method performs the actual element move. + * @private + * @method _moveNode + */ + _moveNode: function(scroll) { + //if (!this.get(DRAGGING)) { + // return; + //} + var diffXY = [], diffXY2 = [], startXY = this.nodeXY, xy = this.actXY; + + diffXY[0] = (xy[0] - this.lastXY[0]); + diffXY[1] = (xy[1] - this.lastXY[1]); + + diffXY2[0] = (xy[0] - this.nodeXY[0]); + diffXY2[1] = (xy[1] - this.nodeXY[1]); + + + this.region = { + '0': xy[0], + '1': xy[1], + area: 0, + top: xy[1], + right: xy[0] + this.get(DRAG_NODE).get(OFFSET_WIDTH), + bottom: xy[1] + this.get(DRAG_NODE).get(OFFSET_HEIGHT), + left: xy[0] + }; + + this.fire(EV_DRAG, { + pageX: xy[0], + pageY: xy[1], + scroll: scroll, + info: { + start: startXY, + xy: xy, + delta: diffXY, + offset: diffXY2 + } + }); + + this.lastXY = xy; + }, + /** + * Default function for drag:drag. Fired from _moveNode. + * @private + * @method _defDragFn + * @param {EventFacade} ev The drag:drag event + */ + _defDragFn: function(e) { + if (this.get('move')) { + if (e.scroll && e.scroll.node) { + var domNode = e.scroll.node.getDOMNode(); + //If it's the window + if (domNode === Y.config.win) { + domNode.scrollTo(e.scroll.left, e.scroll.top); + } else { + e.scroll.node.set('scrollTop', e.scroll.top); + e.scroll.node.set('scrollLeft', e.scroll.left); + } + } + this.get(DRAG_NODE).setXY([e.pageX, e.pageY]); + this.realXY = [e.pageX, e.pageY]; + } + }, + /** + * Fired from DragDropMgr (DDM) on mousemove. + * @private + * @method _move + * @param {EventFacade} ev The mousemove DOM event + */ + _move: function(ev) { + if (this.get('lock')) { + return false; + } + + this.mouseXY = [ev.pageX, ev.pageY]; + if (!this._dragThreshMet) { + var diffX = Math.abs(this.startXY[0] - ev.pageX), + diffY = Math.abs(this.startXY[1] - ev.pageY); + if (diffX > this.get('clickPixelThresh') || diffY > this.get('clickPixelThresh')) { + this._dragThreshMet = true; + this.start(); + //This only happens on gestures to stop the page from scrolling + if (ev && ev.preventDefault) { + ev.preventDefault(); + } + this._alignNode([ev.pageX, ev.pageY]); + } + } else { + if (this._clickTimeout) { + this._clickTimeout.cancel(); + } + this._alignNode([ev.pageX, ev.pageY]); + } + }, + /** + * Method will forcefully stop a drag operation. For example calling this from inside an ESC keypress handler will stop this drag. + * @method stopDrag + * @chainable + */ + stopDrag: function() { + if (this.get(DRAGGING)) { + DDM._end(); + } + return this; + }, + /** + * Lifecycle destructor, unreg the drag from the DDM and remove listeners + * @private + * @method destructor + */ + destructor: function() { + this._unprep(); + if (this.target) { + this.target.destroy(); + } + DDM._unregDrag(this); + } + }); + Y.namespace('DD'); + Y.DD.Drag = Drag; + + + + +}, '@VERSION@', {"requires": ["dd-ddm-base"]}); diff --git a/src/build/dd-drag/dd-drag-min.js b/src/build/dd-drag/dd-drag-min.js new file mode 100644 index 00000000000..48f85fa2a7a --- /dev/null +++ b/src/build/dd-drag/dd-drag-min.js @@ -0,0 +1,2 @@ +YUI.add("dd-drag",function(e,t){var n=e.DD.DDM,r="node",i="dragging",s="dragNode",o="offsetHeight",u="offsetWidth",a="drag:mouseDown",f="drag:afterMouseDown",l="drag:removeHandle",c="drag:addHandle",h="drag:removeInvalid",p="drag:addInvalid",d="drag:start",v="drag:end",m="drag:drag",g="drag:align",y=function(t){this._lazyAddAttrs=!1,y.superclass.constructor.apply(this,arguments);var r=n._regDrag(this);r||e.error("Failed to register node, already in use: "+t.node)};y.NAME="drag",y.START_EVENT="mousedown",y.ATTRS={node:{setter:function(t){if(this._canDrag(t))return t;var n=e.one(t);return n||e.error("DD.Drag: Invalid Node Given: "+t),n}},dragNode:{setter:function(t){if(this._canDrag(t))return t;var n=e.one(t);return n||e.error("DD.Drag: Invalid dragNode Given: "+t),n}},offsetNode:{value:!0},startCentered:{value:!1},clickPixelThresh:{value:n.get("clickPixelThresh")},clickTimeThresh:{value:n.get("clickTimeThresh")},lock:{value:!1,setter:function(e){return e?this.get(r).addClass(n.CSS_PREFIX+"-locked"):this.get(r).removeClass(n.CSS_PREFIX+"-locked"),e}},data:{value:!1},move:{value:!0},useShim:{value:!0},activeHandle:{value:!1},primaryButtonOnly:{value:!0},dragging:{value:!1},parent:{value:!1},target:{value:!1,setter:function(e){return this._handleTarget(e),e}},dragMode:{value:null,setter:function(e){return n._setDragMode(e)}},groups:{value:["default"],getter:function(){return this._groups?e.Object.keys(this._groups):(this._groups={},[])},setter:function(t){return this._groups=e.Array.hash(t),t}},handles:{value:null,setter:function(t){return t?(this._handles={},e.Array.each(t,function(t){var n=t;if(t instanceof e.Node||t instanceof e.NodeList)n=t._yuid;this._handles[n]=t},this)):this._handles=null,t}},bubbles:{setter:function(e){return this.addTarget(e),e}},haltDown:{value:!0}},e.extend(y,e.Base,{_canDrag:function(e){return e&&e.setXY&&e.getXY&&e.test&&e.contains?!0:!1},_bubbleTargets:e.DD.DDM,addToGroup:function(e){return this._groups[e]=!0,n._activateTargets(),this},removeFromGroup:function(e){return delete this._groups[e],n._activateTargets(),this},target:null,_handleTarget:function(t){e.DD.Drop&&(t===!1?this.target&&(n._unregTarget(this.target),this.target=null):(e.Lang.isObject(t)||(t={}),t.bubbleTargets=t.bubbleTargets||this.getTargets(),t.node=this.get(r),t.groups=t.groups||this.get("groups"),this.target=new e.DD.Drop(t)))},_groups:null,_createEvents:function(){this.publish(a,{defaultFn:this._defMouseDownFn,queuable:!1,emitFacade:!0,bubbles:!0,prefix:"drag"}),this.publish(g,{defaultFn:this._defAlignFn,queuable:!1,emitFacade:!0,bubbles:!0,prefix:"drag"}),this.publish(m,{defaultFn:this._defDragFn,queuable:!1,emitFacade:!0,bubbles:!0,prefix:"drag"}),this.publish(v,{defaultFn:this._defEndFn,preventedFn:this._prevEndFn,queuable:!1,emitFacade:!0,bubbles:!0,prefix:"drag"});var t=[f,l,c,h,p,d,"drag:drophit","drag:dropmiss","drag:over","drag:enter","drag:exit"];e.Array.each(t,function(e){this.publish(e,{type:e,emitFacade:!0,bubbles:!0,preventable:!1,queuable:!1,prefix:"drag"})},this)},_ev_md:null,_startTime:null,_endTime:null,_handles:null,_invalids:null,_invalidsDefault:{textarea:!0,input:!0,a:!0,button:!0,select:!0},_dragThreshMet:null,_fromTimeout:null,_clickTimeout:null,deltaXY:null,startXY:null,nodeXY:null,lastXY:null,actXY:null,realXY:null,mouseXY:null,region:null,_handleMouseUp:function(){this.fire("drag:mouseup"),this._fixIEMouseUp(),n.activeDrag&&n._end()},_fixDragStart:function(e){this.validClick(e)&&e.preventDefault()},_ieSelectFix:function(){return!1},_ieSelectBack:null,_fixIEMouseDown:function(){e.UA.ie&&(this._ieSelectBack=e.config.doc.body.onselectstart,e.config.doc.body.onselectstart=this._ieSelectFix)},_fixIEMouseUp:function(){e.UA.ie&&(e.config.doc.body.onselectstart=this._ieSelectBack)},_handleMouseDownEvent:function(e){this.fire(a,{ev:e})},_defMouseDownFn:function(t){var r=t.ev;this._dragThreshMet=!1,this._ev_md=r;if(this.get("primaryButtonOnly")&&r.button>1)return!1;this.validClick(r)&&(this._fixIEMouseDown(r),y.START_EVENT.indexOf("gesture")!==0&&(this.get("haltDown")?r.halt():r.preventDefault()),this._setStartPosition([r.pageX,r.pageY]),n.activeDrag=this,this._clickTimeout=e.later(this.get("clickTimeThresh"),this,this._timeoutCheck)),this.fire(f,{ev:r})},validClick:function(t){var n=!1,i=!1,s=t.target,o=null,u=null,a=null,f=!1;if(this._handles)e.Object.each(this._handles,function(t,r){t instanceof e.Node||t instanceof e.NodeList?n||(a=t,a instanceof e.Node&&(a=new e.NodeList(t._node)),a.each(function(e){e.contains(s)&&(n=!0)})):e.Lang.isString(r)&&s.test(r+", "+r+" *")&&!o&&(o=r,n=!0)});else{i=this.get(r);if(i.contains(s)||i.compareTo(s))n=!0}return n&&this._invalids&&e.Object.each(this._invalids,function(t,r){e.Lang.isString(r)&&s.test(r+", "+r+" *")&&(n=!1)}),n&&(o?(u=t.currentTarget.all(o),f=!1,u.each(function(e){(e.contains(s)||e.compareTo(s))&&!f&&(f=!0,this.set("activeHandle",e))},this)):this.set("activeHandle",this.get(r))),n},_setStartPosition:function(e){this.startXY=e,this.nodeXY=this.lastXY=this.realXY=this.get(r).getXY(),this.get("offsetNode")?this.deltaXY=[this.startXY[0]-this.nodeXY[0],this.startXY[1]-this.nodeXY[1]]:this.deltaXY=[0,0]},_timeoutCheck:function(){!this.get("lock")&&!this._dragThreshMet&&this._ev_md&&(this._fromTimeout=this._dragThreshMet=!0,this.start(),this._alignNode([this._ev_md.pageX,this._ev_md.pageY],!0))},removeHandle:function(t){var n=t;if(t instanceof e.Node||t instanceof e.NodeList)n=t._yuid;return this._handles[n]&&(delete this._handles[n],this.fire(l,{handle:t})),this},addHandle:function(t){this._handles||(this._handles={});var n=t;if(t instanceof e.Node||t instanceof e.NodeList)n=t._yuid;return this._handles[n]=t,this.fire(c,{handle:t}),this},removeInvalid:function(e){return this._invalids[e]&&(this._invalids[e]=null,delete this._invalids[e],this.fire(h,{handle:e})),this},addInvalid:function(t){return e.Lang.isString(t)&&(this._invalids[t]=!0,this.fire(p,{handle:t})),this},initializer:function(){this.get(r).dd=this;if(!this.get(r).get +("id")){var t=e.stamp(this.get(r));this.get(r).set("id",t)}this.actXY=[],this._invalids=e.clone(this._invalidsDefault,!0),this._createEvents(),this.get(s)||this.set(s,this.get(r)),this.on("initializedChange",e.bind(this._prep,this)),this.set("groups",this.get("groups"))},_prep:function(){this._dragThreshMet=!1;var t=this.get(r);t.addClass(n.CSS_PREFIX+"-draggable"),t.on(y.START_EVENT,e.bind(this._handleMouseDownEvent,this)),t.on("mouseup",e.bind(this._handleMouseUp,this)),t.on("dragstart",e.bind(this._fixDragStart,this))},_unprep:function(){var e=this.get(r);e.removeClass(n.CSS_PREFIX+"-draggable"),e.detachAll("mouseup"),e.detachAll("dragstart"),e.detachAll(y.START_EVENT),this.mouseXY=[],this.deltaXY=[0,0],this.startXY=[],this.nodeXY=[],this.lastXY=[],this.actXY=[],this.realXY=[]},start:function(){if(!this.get("lock")&&!this.get(i)){var e=this.get(r),t,a,f;this._startTime=(new Date).getTime(),n._start(),e.addClass(n.CSS_PREFIX+"-dragging"),this.fire(d,{pageX:this.nodeXY[0],pageY:this.nodeXY[1],startTime:this._startTime}),e=this.get(s),f=this.nodeXY,t=e.get(u),a=e.get(o),this.get("startCentered")&&this._setStartPosition([f[0]+t/2,f[1]+a/2]),this.region={0:f[0],1:f[1],area:0,top:f[1],right:f[0]+t,bottom:f[1]+a,left:f[0]},this.set(i,!0)}return this},end:function(){return this._endTime=(new Date).getTime(),this._clickTimeout&&this._clickTimeout.cancel(),this._dragThreshMet=this._fromTimeout=!1,!this.get("lock")&&this.get(i)&&this.fire(v,{pageX:this.lastXY[0],pageY:this.lastXY[1],startTime:this._startTime,endTime:this._endTime}),this.get(r).removeClass(n.CSS_PREFIX+"-dragging"),this.set(i,!1),this.deltaXY=[0,0],this},_defEndFn:function(){this._fixIEMouseUp(),this._ev_md=null},_prevEndFn:function(){this._fixIEMouseUp(),this.get(s).setXY(this.nodeXY),this._ev_md=null,this.region=null},_align:function(e){this.fire(g,{pageX:e[0],pageY:e[1]})},_defAlignFn:function(e){this.actXY=[e.pageX-this.deltaXY[0],e.pageY-this.deltaXY[1]]},_alignNode:function(e,t){this._align(e),t||this._moveNode()},_moveNode:function(e){var t=[],n=[],r=this.nodeXY,i=this.actXY;t[0]=i[0]-this.lastXY[0],t[1]=i[1]-this.lastXY[1],n[0]=i[0]-this.nodeXY[0],n[1]=i[1]-this.nodeXY[1],this.region={0:i[0],1:i[1],area:0,top:i[1],right:i[0]+this.get(s).get(u),bottom:i[1]+this.get(s).get(o),left:i[0]},this.fire(m,{pageX:i[0],pageY:i[1],scroll:e,info:{start:r,xy:i,delta:t,offset:n}}),this.lastXY=i},_defDragFn:function(t){if(this.get("move")){if(t.scroll&&t.scroll.node){var n=t.scroll.node.getDOMNode();n===e.config.win?n.scrollTo(t.scroll.left,t.scroll.top):(t.scroll.node.set("scrollTop",t.scroll.top),t.scroll.node.set("scrollLeft",t.scroll.left))}this.get(s).setXY([t.pageX,t.pageY]),this.realXY=[t.pageX,t.pageY]}},_move:function(e){if(this.get("lock"))return!1;this.mouseXY=[e.pageX,e.pageY];if(!this._dragThreshMet){var t=Math.abs(this.startXY[0]-e.pageX),n=Math.abs(this.startXY[1]-e.pageY);if(t>this.get("clickPixelThresh")||n>this.get("clickPixelThresh"))this._dragThreshMet=!0,this.start(),e&&e.preventDefault&&e.preventDefault(),this._alignNode([e.pageX,e.pageY])}else this._clickTimeout&&this._clickTimeout.cancel(),this._alignNode([e.pageX,e.pageY])},stopDrag:function(){return this.get(i)&&n._end(),this},destructor:function(){this._unprep(),this.target&&this.target.destroy(),n._unregDrag(this)}}),e.namespace("DD"),e.DD.Drag=y},"@VERSION@",{requires:["dd-ddm-base"]}); diff --git a/src/build/dd-drag/dd-drag.js b/src/build/dd-drag/dd-drag.js new file mode 100644 index 00000000000..c75909fabce --- /dev/null +++ b/src/build/dd-drag/dd-drag.js @@ -0,0 +1,1264 @@ +YUI.add('dd-drag', function (Y, NAME) { + + + /** + * Provides the ability to drag a Node. + * @module dd + * @submodule dd-drag + */ + /** + * Provides the ability to drag a Node. + * @class Drag + * @extends Base + * @constructor + * @namespace DD + */ + + var DDM = Y.DD.DDM, + NODE = 'node', + DRAGGING = 'dragging', + DRAG_NODE = 'dragNode', + OFFSET_HEIGHT = 'offsetHeight', + OFFSET_WIDTH = 'offsetWidth', + /** + * Handles the mouseup DOM event, does nothing internally just fires. + * @event drag:mouseup + * @bubbles DDM + * @type {CustomEvent} + */ + /** + * Handles the mousedown DOM event, checks to see if you have a valid handle then starts the drag timers. + * @event drag:mouseDown + * @preventable _defMouseDownFn + * @param {EventFacade} event An Event Facade object with the following specific property added: + *
ev
The original mousedown event.
+ * @bubbles DDM + * @type {CustomEvent} + */ + EV_MOUSE_DOWN = 'drag:mouseDown', + /** + * Fires after the mousedown event has been cleared. + * @event drag:afterMouseDown + * @param {EventFacade} event An Event Facade object with the following specific property added: + *
ev
The original mousedown event.
+ * @bubbles DDM + * @type {CustomEvent} + */ + EV_AFTER_MOUSE_DOWN = 'drag:afterMouseDown', + /** + * Fires after a handle is removed. + * @event drag:removeHandle + * @param {EventFacade} event An Event Facade object with the following specific property added: + *
handle
The handle that was removed.
+ * @bubbles DDM + * @type {CustomEvent} + */ + EV_REMOVE_HANDLE = 'drag:removeHandle', + /** + * Fires after a handle is added. + * @event drag:addHandle + * @param {EventFacade} event An Event Facade object with the following specific property added: + *
handle
The handle that was added.
+ * @bubbles DDM + * @type {CustomEvent} + */ + EV_ADD_HANDLE = 'drag:addHandle', + /** + * Fires after an invalid selector is removed. + * @event drag:removeInvalid + * @param {EventFacade} event An Event Facade object with the following specific property added: + *
handle
The handle that was removed.
+ * @bubbles DDM + * @type {CustomEvent} + */ + EV_REMOVE_INVALID = 'drag:removeInvalid', + /** + * Fires after an invalid selector is added. + * @event drag:addInvalid + * @param {EventFacade} event An Event Facade object with the following specific property added: + *
handle
The handle that was added.
+ * @bubbles DDM + * @type {CustomEvent} + */ + EV_ADD_INVALID = 'drag:addInvalid', + /** + * Fires at the start of a drag operation. + * @event drag:start + * @param {EventFacade} event An Event Facade object with the following specific property added: + *
+ *
pageX
The original node position X.
+ *
pageY
The original node position Y.
+ *
startTime
The startTime of the event. getTime on the current Date object.
+ *
+ * @bubbles DDM + * @type {CustomEvent} + */ + EV_START = 'drag:start', + /** + * Fires at the end of a drag operation. + * @event drag:end + * @param {EventFacade} event An Event Facade object with the following specific property added: + *
+ *
pageX
The current node position X.
+ *
pageY
The current node position Y.
+ *
startTime
The startTime of the event, from the start event.
+ *
endTime
The endTime of the event. getTime on the current Date object.
+ *
+ * @bubbles DDM + * @type {CustomEvent} + */ + EV_END = 'drag:end', + /** + * Fires every mousemove during a drag operation. + * @event drag:drag + * @param {EventFacade} event An Event Facade object with the following specific property added: + *
+ *
pageX
The current node position X.
+ *
pageY
The current node position Y.
+ *
scroll
Should a scroll action occur.
+ *
info
Object hash containing calculated XY arrays: start, xy, delta, offset
+ *
+ * @bubbles DDM + * @type {CustomEvent} + */ + EV_DRAG = 'drag:drag', + /** + * Fires when this node is aligned. + * @event drag:align + * @preventable _defAlignFn + * @param {EventFacade} event An Event Facade object with the following specific property added: + *
+ *
pageX
The current node position X.
+ *
pageY
The current node position Y.
+ *
+ * @bubbles DDM + * @type {CustomEvent} + */ + EV_ALIGN = 'drag:align', + /** + * Fires when this node is over a Drop Target. (Fired from dd-drop) + * @event drag:over + * @param {EventFacade} event An Event Facade object with the following specific property added: + *
+ *
drop
The drop object at the time of the event.
+ *
drag
The drag object at the time of the event.
+ *
+ * @bubbles DDM + * @type {CustomEvent} + */ + /** + * Fires when this node enters a Drop Target. (Fired from dd-drop) + * @event drag:enter + * @param {EventFacade} event An Event Facade object with the following specific property added: + *
+ *
drop
The drop object at the time of the event.
+ *
drag
The drag object at the time of the event.
+ *
+ * @bubbles DDM + * @type {CustomEvent} + */ + /** + * Fires when this node exits a Drop Target. (Fired from dd-drop) + * @event drag:exit + * @param {EventFacade} event An Event Facade object with the following specific property added: + *
+ *
drop
The drop object at the time of the event.
+ *
+ * @bubbles DDM + * @type {CustomEvent} + */ + /** + * Fires when this node is dropped on a valid Drop Target. (Fired from dd-ddm-drop) + * @event drag:drophit + * @param {EventFacade} event An Event Facade object with the following specific property added: + *
+ *
drop
The best guess on what was dropped on.
+ *
drag
The drag object at the time of the event.
+ *
others
An array of all the other drop targets that was dropped on.
+ *
+ * @bubbles DDM + * @type {CustomEvent} + */ + /** + * Fires when this node is dropped on an invalid Drop Target. (Fired from dd-ddm-drop) + * @event drag:dropmiss + * @param {EventFacade} event An Event Facade object with the following specific property added: + *
+ *
pageX
The current node position X.
+ *
pageY
The current node position Y.
+ *
+ * @bubbles DDM + * @type {CustomEvent} + */ + + Drag = function(o) { + this._lazyAddAttrs = false; + Drag.superclass.constructor.apply(this, arguments); + + var valid = DDM._regDrag(this); + if (!valid) { + Y.error('Failed to register node, already in use: ' + o.node); + } + }; + + Drag.NAME = 'drag'; + + /** + * This property defaults to "mousedown", but when drag-gestures is loaded, it is changed to "gesturemovestart" + * @static + * @property START_EVENT + */ + Drag.START_EVENT = 'mousedown'; + + Drag.ATTRS = { + /** + * Y.Node instance to use as the element to initiate a drag operation + * @attribute node + * @type Node + */ + node: { + setter: function(node) { + if (this._canDrag(node)) { + return node; + } + var n = Y.one(node); + if (!n) { + Y.error('DD.Drag: Invalid Node Given: ' + node); + } + return n; + } + }, + /** + * Y.Node instance to use as the draggable element, defaults to node + * @attribute dragNode + * @type Node + */ + dragNode: { + setter: function(node) { + if (this._canDrag(node)) { + return node; + } + var n = Y.one(node); + if (!n) { + Y.error('DD.Drag: Invalid dragNode Given: ' + node); + } + return n; + } + }, + /** + * Offset the drag element by the difference in cursor position: default true + * @attribute offsetNode + * @type Boolean + */ + offsetNode: { + value: true + }, + /** + * Center the dragNode to the mouse position on drag:start: default false + * @attribute startCentered + * @type Boolean + */ + startCentered: { + value: false + }, + /** + * The number of pixels to move to start a drag operation, default is 3. + * @attribute clickPixelThresh + * @type Number + */ + clickPixelThresh: { + value: DDM.get('clickPixelThresh') + }, + /** + * The number of milliseconds a mousedown has to pass to start a drag operation, default is 1000. + * @attribute clickTimeThresh + * @type Number + */ + clickTimeThresh: { + value: DDM.get('clickTimeThresh') + }, + /** + * Set to lock this drag element so that it can't be dragged: default false. + * @attribute lock + * @type Boolean + */ + lock: { + value: false, + setter: function(lock) { + if (lock) { + this.get(NODE).addClass(DDM.CSS_PREFIX + '-locked'); + } else { + this.get(NODE).removeClass(DDM.CSS_PREFIX + '-locked'); + } + return lock; + } + }, + /** + * A payload holder to store arbitrary data about this drag object, can be used to store any value. + * @attribute data + * @type Mixed + */ + data: { + value: false + }, + /** + * If this is false, the drag element will not move with the cursor: default true. Can be used to "resize" the element. + * @attribute move + * @type Boolean + */ + move: { + value: true + }, + /** + * Use the protective shim on all drag operations: default true. Only works with dd-ddm, not dd-ddm-base. + * @attribute useShim + * @type Boolean + */ + useShim: { + value: true + }, + /** + * Config option is set by Drag to inform you of which handle fired the drag event (in the case that there are several handles): default false. + * @attribute activeHandle + * @type Node + */ + activeHandle: { + value: false + }, + /** + * By default a drag operation will only begin if the mousedown occurred with the primary mouse button. + * Setting this to false will allow for all mousedown events to trigger a drag. + * @attribute primaryButtonOnly + * @type Boolean + */ + primaryButtonOnly: { + value: true + }, + /** + * This attribute is not meant to be used by the implementor, it is meant to be used as an Event tracker so you can listen for it to change. + * @attribute dragging + * @type Boolean + */ + dragging: { + value: false + }, + parent: { + value: false + }, + /** + * This attribute only works if the dd-drop module has been loaded. It will make this node a drop target as well as draggable. + * @attribute target + * @type Boolean + */ + target: { + value: false, + setter: function(config) { + this._handleTarget(config); + return config; + } + }, + /** + * This attribute only works if the dd-drop module is active. It will set the dragMode (point, intersect, strict) of this Drag instance. + * @attribute dragMode + * @type String + */ + dragMode: { + value: null, + setter: function(mode) { + return DDM._setDragMode(mode); + } + }, + /** + * Array of groups to add this drag into. + * @attribute groups + * @type Array + */ + groups: { + value: ['default'], + getter: function() { + if (!this._groups) { + this._groups = {}; + return []; + } + + return Y.Object.keys(this._groups); + }, + setter: function(g) { + this._groups = Y.Array.hash(g); + return g; + } + }, + /** + * Array of valid handles to add. Adding something here will set all handles, even if previously added with addHandle + * @attribute handles + * @type Array + */ + handles: { + value: null, + setter: function(g) { + if (g) { + this._handles = {}; + Y.Array.each(g, function(v) { + var key = v; + if (v instanceof Y.Node || v instanceof Y.NodeList) { + key = v._yuid; + } + this._handles[key] = v; + }, this); + } else { + this._handles = null; + } + return g; + } + }, + /** + * Controls the default bubble parent for this Drag instance. Default: Y.DD.DDM. Set to false to disable bubbling. Use bubbleTargets in config + * @deprecated + * @attribute bubbles + * @type Object + */ + bubbles: { + setter: function(t) { + this.addTarget(t); + return t; + } + }, + /** + * Should the mousedown event be halted. Default: true + * @attribute haltDown + * @type Boolean + */ + haltDown: { + value: true + } + }; + + Y.extend(Drag, Y.Base, { + /** + * Checks the object for the methods needed to drag the object around. + * Normally this would be a node instance, but in the case of Graphics, it + * may be an SVG node or something similar. + * @method _canDrag + * @private + * @param {Object} n The object to check + * @return {Boolean} True or false if the Object contains the methods needed to Drag + */ + _canDrag: function(n) { + if (n && n.setXY && n.getXY && n.test && n.contains) { + return true; + } + return false; + }, + /** + * The default bubbleTarget for this object. Default: Y.DD.DDM + * @private + * @property _bubbleTargets + */ + _bubbleTargets: Y.DD.DDM, + /** + * Add this Drag instance to a group, this should be used for on-the-fly group additions. + * @method addToGroup + * @param {String} g The group to add this Drag Instance to. + * @chainable + */ + addToGroup: function(g) { + this._groups[g] = true; + DDM._activateTargets(); + return this; + }, + /** + * Remove this Drag instance from a group, this should be used for on-the-fly group removals. + * @method removeFromGroup + * @param {String} g The group to remove this Drag Instance from. + * @chainable + */ + removeFromGroup: function(g) { + delete this._groups[g]; + DDM._activateTargets(); + return this; + }, + /** + * This will be a reference to the Drop instance associated with this drag if the target: true config attribute is set.. + * @property target + * @type {Object} + */ + target: null, + /** + * Attribute handler for the target config attribute. + * @private + * @method _handleTarget + * @param {Boolean/Object} config The Config + */ + _handleTarget: function(config) { + if (Y.DD.Drop) { + if (config === false) { + if (this.target) { + DDM._unregTarget(this.target); + this.target = null; + } + } else { + if (!Y.Lang.isObject(config)) { + config = {}; + } + config.bubbleTargets = config.bubbleTargets || this.getTargets(); + config.node = this.get(NODE); + config.groups = config.groups || this.get('groups'); + this.target = new Y.DD.Drop(config); + } + } + }, + /** + * Storage Array for the groups this drag belongs to. + * @private + * @property _groups + * @type {Array} + */ + _groups: null, + /** + * This method creates all the events for this Event Target and publishes them so we get Event Bubbling. + * @private + * @method _createEvents + */ + _createEvents: function() { + + this.publish(EV_MOUSE_DOWN, { + defaultFn: this._defMouseDownFn, + queuable: false, + emitFacade: true, + bubbles: true, + prefix: 'drag' + }); + + this.publish(EV_ALIGN, { + defaultFn: this._defAlignFn, + queuable: false, + emitFacade: true, + bubbles: true, + prefix: 'drag' + }); + + this.publish(EV_DRAG, { + defaultFn: this._defDragFn, + queuable: false, + emitFacade: true, + bubbles: true, + prefix: 'drag' + }); + + this.publish(EV_END, { + defaultFn: this._defEndFn, + preventedFn: this._prevEndFn, + queuable: false, + emitFacade: true, + bubbles: true, + prefix: 'drag' + }); + + var ev = [ + EV_AFTER_MOUSE_DOWN, + EV_REMOVE_HANDLE, + EV_ADD_HANDLE, + EV_REMOVE_INVALID, + EV_ADD_INVALID, + EV_START, + 'drag:drophit', + 'drag:dropmiss', + 'drag:over', + 'drag:enter', + 'drag:exit' + ]; + + Y.Array.each(ev, function(v) { + this.publish(v, { + type: v, + emitFacade: true, + bubbles: true, + preventable: false, + queuable: false, + prefix: 'drag' + }); + }, this); + }, + /** + * A private reference to the mousedown DOM event + * @private + * @property _ev_md + * @type {EventFacade} + */ + _ev_md: null, + /** + * The getTime of the mousedown event. Not used, just here in case someone wants/needs to use it. + * @private + * @property _startTime + * @type Date + */ + _startTime: null, + /** + * The getTime of the mouseup event. Not used, just here in case someone wants/needs to use it. + * @private + * @property _endTime + * @type Date + */ + _endTime: null, + /** + * A private hash of the valid drag handles + * @private + * @property _handles + * @type {Object} + */ + _handles: null, + /** + * A private hash of the invalid selector strings + * @private + * @property _invalids + * @type {Object} + */ + _invalids: null, + /** + * A private hash of the default invalid selector strings: {'textarea': true, 'input': true, 'a': true, 'button': true, 'select': true} + * @private + * @property _invalidsDefault + * @type {Object} + */ + _invalidsDefault: {'textarea': true, 'input': true, 'a': true, 'button': true, 'select': true }, + /** + * Private flag to see if the drag threshhold was met + * @private + * @property _dragThreshMet + * @type {Boolean} + */ + _dragThreshMet: null, + /** + * Flag to determine if the drag operation came from a timeout + * @private + * @property _fromTimeout + * @type {Boolean} + */ + _fromTimeout: null, + /** + * Holder for the setTimeout call + * @private + * @property _clickTimeout + * @type {Boolean} + */ + _clickTimeout: null, + /** + * The offset of the mouse position to the element's position + * @property deltaXY + * @type {Array} + */ + deltaXY: null, + /** + * The initial mouse position + * @property startXY + * @type {Array} + */ + startXY: null, + /** + * The initial element position + * @property nodeXY + * @type {Array} + */ + nodeXY: null, + /** + * The position of the element as it's moving (for offset calculations) + * @property lastXY + * @type {Array} + */ + lastXY: null, + /** + * The xy that the node will be set to. Changing this will alter the position as it's dragged. + * @property actXY + * @type {Array} + */ + actXY: null, + /** + * The real xy position of the node. + * @property realXY + * @type {Array} + */ + realXY: null, + /** + * The XY coords of the mousemove + * @property mouseXY + * @type {Array} + */ + mouseXY: null, + /** + * A region object associated with this drag, used for checking regions while dragging. + * @property region + * @type Object + */ + region: null, + /** + * Handler for the mouseup DOM event + * @private + * @method _handleMouseUp + * @param {EventFacade} ev The Event + */ + _handleMouseUp: function() { + this.fire('drag:mouseup'); + this._fixIEMouseUp(); + if (DDM.activeDrag) { + DDM._end(); + } + }, + /** + * The function we use as the ondragstart handler when we start a drag + * in Internet Explorer. This keeps IE from blowing up on images as drag handles. + * @private + * @method _fixDragStart + * @param {Event} e The Event + */ + _fixDragStart: function(e) { + if (this.validClick(e)) { + e.preventDefault(); + } + }, + /** + * The function we use as the onselectstart handler when we start a drag in Internet Explorer + * @private + * @method _ieSelectFix + */ + _ieSelectFix: function() { + return false; + }, + /** + * We will hold a copy of the current "onselectstart" method on this property, and reset it after we are done using it. + * @private + * @property _ieSelectBack + */ + _ieSelectBack: null, + /** + * This method copies the onselectstart listner on the document to the _ieSelectFix property + * @private + * @method _fixIEMouseDown + */ + _fixIEMouseDown: function() { + if (Y.UA.ie) { + this._ieSelectBack = Y.config.doc.body.onselectstart; + Y.config.doc.body.onselectstart = this._ieSelectFix; + } + }, + /** + * This method copies the _ieSelectFix property back to the onselectstart listner on the document. + * @private + * @method _fixIEMouseUp + */ + _fixIEMouseUp: function() { + if (Y.UA.ie) { + Y.config.doc.body.onselectstart = this._ieSelectBack; + } + }, + /** + * Handler for the mousedown DOM event + * @private + * @method _handleMouseDownEvent + * @param {EventFacade} ev The Event + */ + _handleMouseDownEvent: function(ev) { + this.fire(EV_MOUSE_DOWN, { ev: ev }); + }, + /** + * Handler for the mousedown DOM event + * @private + * @method _defMouseDownFn + * @param {EventFacade} e The Event + */ + _defMouseDownFn: function(e) { + var ev = e.ev; + + this._dragThreshMet = false; + this._ev_md = ev; + + if (this.get('primaryButtonOnly') && ev.button > 1) { + return false; + } + if (this.validClick(ev)) { + this._fixIEMouseDown(ev); + if (Drag.START_EVENT.indexOf('gesture') !== 0) { + //Only do these if it's not a gesture + if (this.get('haltDown')) { + ev.halt(); + } else { + ev.preventDefault(); + } + } + + this._setStartPosition([ev.pageX, ev.pageY]); + + DDM.activeDrag = this; + + this._clickTimeout = Y.later(this.get('clickTimeThresh'), this, this._timeoutCheck); + } + this.fire(EV_AFTER_MOUSE_DOWN, { ev: ev }); + }, + /** + * Method first checks to see if we have handles, if so it validates the click + * against the handle. Then if it finds a valid handle, it checks it against + * the invalid handles list. Returns true if a good handle was used, false otherwise. + * @method validClick + * @param {EventFacade} ev The Event + * @return {Boolean} + */ + validClick: function(ev) { + var r = false, n = false, + tar = ev.target, + hTest = null, + els = null, + nlist = null, + set = false; + if (this._handles) { + Y.Object.each(this._handles, function(i, n) { + if (i instanceof Y.Node || i instanceof Y.NodeList) { + if (!r) { + nlist = i; + if (nlist instanceof Y.Node) { + nlist = new Y.NodeList(i._node); + } + nlist.each(function(nl) { + if (nl.contains(tar)) { + r = true; + } + }); + } + } else if (Y.Lang.isString(n)) { + //Am I this or am I inside this + if (tar.test(n + ', ' + n + ' *') && !hTest) { + hTest = n; + r = true; + } + } + }); + } else { + n = this.get(NODE); + if (n.contains(tar) || n.compareTo(tar)) { + r = true; + } + } + if (r) { + if (this._invalids) { + Y.Object.each(this._invalids, function(i, n) { + if (Y.Lang.isString(n)) { + //Am I this or am I inside this + if (tar.test(n + ', ' + n + ' *')) { + r = false; + } + } + }); + } + } + if (r) { + if (hTest) { + els = ev.currentTarget.all(hTest); + set = false; + els.each(function(n) { + if ((n.contains(tar) || n.compareTo(tar)) && !set) { + set = true; + this.set('activeHandle', n); + } + }, this); + } else { + this.set('activeHandle', this.get(NODE)); + } + } + return r; + }, + /** + * Sets the current position of the Element and calculates the offset + * @private + * @method _setStartPosition + * @param {Array} xy The XY coords to set the position to. + */ + _setStartPosition: function(xy) { + this.startXY = xy; + + this.nodeXY = this.lastXY = this.realXY = this.get(NODE).getXY(); + + if (this.get('offsetNode')) { + this.deltaXY = [(this.startXY[0] - this.nodeXY[0]), (this.startXY[1] - this.nodeXY[1])]; + } else { + this.deltaXY = [0, 0]; + } + }, + /** + * The method passed to setTimeout to determine if the clickTimeThreshold was met. + * @private + * @method _timeoutCheck + */ + _timeoutCheck: function() { + if (!this.get('lock') && !this._dragThreshMet && this._ev_md) { + this._fromTimeout = this._dragThreshMet = true; + this.start(); + this._alignNode([this._ev_md.pageX, this._ev_md.pageY], true); + } + }, + /** + * Remove a Selector added by addHandle + * @method removeHandle + * @param {String} str The selector for the handle to be removed. + * @chainable + */ + removeHandle: function(str) { + var key = str; + if (str instanceof Y.Node || str instanceof Y.NodeList) { + key = str._yuid; + } + if (this._handles[key]) { + delete this._handles[key]; + this.fire(EV_REMOVE_HANDLE, { handle: str }); + } + return this; + }, + /** + * Add a handle to a drag element. Drag only initiates when a mousedown happens on this element. + * @method addHandle + * @param {String} str The selector to test for a valid handle. Must be a child of the element. + * @chainable + */ + addHandle: function(str) { + if (!this._handles) { + this._handles = {}; + } + var key = str; + if (str instanceof Y.Node || str instanceof Y.NodeList) { + key = str._yuid; + } + this._handles[key] = str; + this.fire(EV_ADD_HANDLE, { handle: str }); + return this; + }, + /** + * Remove an invalid handle added by addInvalid + * @method removeInvalid + * @param {String} str The invalid handle to remove from the internal list. + * @chainable + */ + removeInvalid: function(str) { + if (this._invalids[str]) { + this._invalids[str] = null; + delete this._invalids[str]; + this.fire(EV_REMOVE_INVALID, { handle: str }); + } + return this; + }, + /** + * Add a selector string to test the handle against. If the test passes the drag operation will not continue. + * @method addInvalid + * @param {String} str The selector to test against to determine if this is an invalid drag handle. + * @chainable + */ + addInvalid: function(str) { + if (Y.Lang.isString(str)) { + this._invalids[str] = true; + this.fire(EV_ADD_INVALID, { handle: str }); + } + return this; + }, + /** + * Internal init handler + * @private + * @method initializer + */ + initializer: function() { + + this.get(NODE).dd = this; + + if (!this.get(NODE).get('id')) { + var id = Y.stamp(this.get(NODE)); + this.get(NODE).set('id', id); + } + + this.actXY = []; + + this._invalids = Y.clone(this._invalidsDefault, true); + + this._createEvents(); + + if (!this.get(DRAG_NODE)) { + this.set(DRAG_NODE, this.get(NODE)); + } + + //Fix for #2528096 + //Don't prep the DD instance until all plugins are loaded. + this.on('initializedChange', Y.bind(this._prep, this)); + + //Shouldn't have to do this.. + this.set('groups', this.get('groups')); + }, + /** + * Attach event listners and add classname + * @private + * @method _prep + */ + _prep: function() { + this._dragThreshMet = false; + var node = this.get(NODE); + node.addClass(DDM.CSS_PREFIX + '-draggable'); + node.on(Drag.START_EVENT, Y.bind(this._handleMouseDownEvent, this)); + node.on('mouseup', Y.bind(this._handleMouseUp, this)); + node.on('dragstart', Y.bind(this._fixDragStart, this)); + }, + /** + * Detach event listeners and remove classname + * @private + * @method _unprep + */ + _unprep: function() { + var node = this.get(NODE); + node.removeClass(DDM.CSS_PREFIX + '-draggable'); + node.detachAll('mouseup'); + node.detachAll('dragstart'); + node.detachAll(Drag.START_EVENT); + this.mouseXY = []; + this.deltaXY = [0,0]; + this.startXY = []; + this.nodeXY = []; + this.lastXY = []; + this.actXY = []; + this.realXY = []; + }, + /** + * Starts the drag operation + * @method start + * @chainable + */ + start: function() { + if (!this.get('lock') && !this.get(DRAGGING)) { + var node = this.get(NODE), ow, oh, xy; + this._startTime = (new Date()).getTime(); + + DDM._start(); + node.addClass(DDM.CSS_PREFIX + '-dragging'); + this.fire(EV_START, { + pageX: this.nodeXY[0], + pageY: this.nodeXY[1], + startTime: this._startTime + }); + node = this.get(DRAG_NODE); + xy = this.nodeXY; + + ow = node.get(OFFSET_WIDTH); + oh = node.get(OFFSET_HEIGHT); + + if (this.get('startCentered')) { + this._setStartPosition([xy[0] + (ow / 2), xy[1] + (oh / 2)]); + } + + + this.region = { + '0': xy[0], + '1': xy[1], + area: 0, + top: xy[1], + right: xy[0] + ow, + bottom: xy[1] + oh, + left: xy[0] + }; + this.set(DRAGGING, true); + } + return this; + }, + /** + * Ends the drag operation + * @method end + * @chainable + */ + end: function() { + this._endTime = (new Date()).getTime(); + if (this._clickTimeout) { + this._clickTimeout.cancel(); + } + this._dragThreshMet = this._fromTimeout = false; + + if (!this.get('lock') && this.get(DRAGGING)) { + this.fire(EV_END, { + pageX: this.lastXY[0], + pageY: this.lastXY[1], + startTime: this._startTime, + endTime: this._endTime + }); + } + this.get(NODE).removeClass(DDM.CSS_PREFIX + '-dragging'); + this.set(DRAGGING, false); + this.deltaXY = [0, 0]; + + return this; + }, + /** + * Handler for fixing the selection in IE + * @private + * @method _defEndFn + */ + _defEndFn: function() { + this._fixIEMouseUp(); + this._ev_md = null; + }, + /** + * Handler for preventing the drag:end event. It will reset the node back to it's start position + * @private + * @method _prevEndFn + */ + _prevEndFn: function() { + this._fixIEMouseUp(); + //Bug #1852577 + this.get(DRAG_NODE).setXY(this.nodeXY); + this._ev_md = null; + this.region = null; + }, + /** + * Calculates the offsets and set's the XY that the element will move to. + * @private + * @method _align + * @param {Array} xy The xy coords to align with. + */ + _align: function(xy) { + this.fire(EV_ALIGN, {pageX: xy[0], pageY: xy[1] }); + }, + /** + * Calculates the offsets and set's the XY that the element will move to. + * @private + * @method _defAlignFn + * @param {EventFacade} e The drag:align event. + */ + _defAlignFn: function(e) { + this.actXY = [e.pageX - this.deltaXY[0], e.pageY - this.deltaXY[1]]; + }, + /** + * This method performs the alignment before the element move. + * @private + * @method _alignNode + * @param {Array} eXY The XY to move the element to, usually comes from the mousemove DOM event. + */ + _alignNode: function(eXY, scroll) { + this._align(eXY); + if (!scroll) { + this._moveNode(); + } + }, + /** + * This method performs the actual element move. + * @private + * @method _moveNode + */ + _moveNode: function(scroll) { + //if (!this.get(DRAGGING)) { + // return; + //} + var diffXY = [], diffXY2 = [], startXY = this.nodeXY, xy = this.actXY; + + diffXY[0] = (xy[0] - this.lastXY[0]); + diffXY[1] = (xy[1] - this.lastXY[1]); + + diffXY2[0] = (xy[0] - this.nodeXY[0]); + diffXY2[1] = (xy[1] - this.nodeXY[1]); + + + this.region = { + '0': xy[0], + '1': xy[1], + area: 0, + top: xy[1], + right: xy[0] + this.get(DRAG_NODE).get(OFFSET_WIDTH), + bottom: xy[1] + this.get(DRAG_NODE).get(OFFSET_HEIGHT), + left: xy[0] + }; + + this.fire(EV_DRAG, { + pageX: xy[0], + pageY: xy[1], + scroll: scroll, + info: { + start: startXY, + xy: xy, + delta: diffXY, + offset: diffXY2 + } + }); + + this.lastXY = xy; + }, + /** + * Default function for drag:drag. Fired from _moveNode. + * @private + * @method _defDragFn + * @param {EventFacade} ev The drag:drag event + */ + _defDragFn: function(e) { + if (this.get('move')) { + if (e.scroll && e.scroll.node) { + var domNode = e.scroll.node.getDOMNode(); + //If it's the window + if (domNode === Y.config.win) { + domNode.scrollTo(e.scroll.left, e.scroll.top); + } else { + e.scroll.node.set('scrollTop', e.scroll.top); + e.scroll.node.set('scrollLeft', e.scroll.left); + } + } + this.get(DRAG_NODE).setXY([e.pageX, e.pageY]); + this.realXY = [e.pageX, e.pageY]; + } + }, + /** + * Fired from DragDropMgr (DDM) on mousemove. + * @private + * @method _move + * @param {EventFacade} ev The mousemove DOM event + */ + _move: function(ev) { + if (this.get('lock')) { + return false; + } + + this.mouseXY = [ev.pageX, ev.pageY]; + if (!this._dragThreshMet) { + var diffX = Math.abs(this.startXY[0] - ev.pageX), + diffY = Math.abs(this.startXY[1] - ev.pageY); + if (diffX > this.get('clickPixelThresh') || diffY > this.get('clickPixelThresh')) { + this._dragThreshMet = true; + this.start(); + //This only happens on gestures to stop the page from scrolling + if (ev && ev.preventDefault) { + ev.preventDefault(); + } + this._alignNode([ev.pageX, ev.pageY]); + } + } else { + if (this._clickTimeout) { + this._clickTimeout.cancel(); + } + this._alignNode([ev.pageX, ev.pageY]); + } + }, + /** + * Method will forcefully stop a drag operation. For example calling this from inside an ESC keypress handler will stop this drag. + * @method stopDrag + * @chainable + */ + stopDrag: function() { + if (this.get(DRAGGING)) { + DDM._end(); + } + return this; + }, + /** + * Lifecycle destructor, unreg the drag from the DDM and remove listeners + * @private + * @method destructor + */ + destructor: function() { + this._unprep(); + if (this.target) { + this.target.destroy(); + } + DDM._unregDrag(this); + } + }); + Y.namespace('DD'); + Y.DD.Drag = Drag; + + + + +}, '@VERSION@', {"requires": ["dd-ddm-base"]}); diff --git a/src/build/dd-drop-plugin/dd-drop-plugin-coverage.js b/src/build/dd-drop-plugin/dd-drop-plugin-coverage.js new file mode 100644 index 00000000000..11bb4a4e65c --- /dev/null +++ b/src/build/dd-drop-plugin/dd-drop-plugin-coverage.js @@ -0,0 +1,6 @@ +if (typeof __coverage__ === 'undefined') { __coverage__ = {}; } +if (!__coverage__['build/dd-drop-plugin/dd-drop-plugin.js']) { + __coverage__['build/dd-drop-plugin/dd-drop-plugin.js'] = {"path":"build/dd-drop-plugin/dd-drop-plugin.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0},"b":{},"f":{"1":0,"2":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":45}}},"2":{"name":"(anonymous_2)","line":18,"loc":{"start":{"line":18,"column":19},"end":{"line":18,"column":36}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":44,"column":43}},"2":{"start":{"line":18,"column":8},"end":{"line":21,"column":10}},"3":{"start":{"line":19,"column":12},"end":{"line":19,"column":38}},"4":{"start":{"line":20,"column":12},"end":{"line":20,"column":63}},"5":{"start":{"line":28,"column":8},"end":{"line":28,"column":37}},"6":{"start":{"line":34,"column":8},"end":{"line":34,"column":25}},"7":{"start":{"line":37,"column":8},"end":{"line":37,"column":34}},"8":{"start":{"line":38,"column":8},"end":{"line":38,"column":30}},"9":{"start":{"line":39,"column":8},"end":{"line":39,"column":29}}},"branchMap":{},"code":["(function () { YUI.add('dd-drop-plugin', function (Y, NAME) {","",""," /**"," * Simple Drop plugin that can be attached to a Node via the plug method."," * @module dd"," * @submodule dd-drop-plugin"," */"," /**"," * Simple Drop plugin that can be attached to a Node via the plug method."," * @class Drop"," * @extends DD.Drop"," * @constructor"," * @namespace Plugin"," */","",""," var Drop = function(config) {"," config.node = config.host;"," Drop.superclass.constructor.apply(this, arguments);"," };",""," /**"," * dd-drop-plugin"," * @property NAME"," * @type {String}"," */"," Drop.NAME = \"dd-drop-plugin\";"," /**"," * The Drop instance will be placed on the Node instance under the drop namespace. It can be accessed via Node.drop;"," * @property NS"," * @type {String}"," */"," Drop.NS = \"drop\";","",""," Y.extend(Drop, Y.DD.Drop);"," Y.namespace('Plugin');"," Y.Plugin.Drop = Drop;","","","","","}, '@VERSION@', {\"requires\": [\"dd-drop\"]});","","}());"]}; +} +var __cov_KVlxezpGf5TlaMDCevWTug = __coverage__['build/dd-drop-plugin/dd-drop-plugin.js']; +__cov_KVlxezpGf5TlaMDCevWTug.s['1']++;YUI.add('dd-drop-plugin',function(Y,NAME){__cov_KVlxezpGf5TlaMDCevWTug.f['1']++;__cov_KVlxezpGf5TlaMDCevWTug.s['2']++;var Drop=function(config){__cov_KVlxezpGf5TlaMDCevWTug.f['2']++;__cov_KVlxezpGf5TlaMDCevWTug.s['3']++;config.node=config.host;__cov_KVlxezpGf5TlaMDCevWTug.s['4']++;Drop.superclass.constructor.apply(this,arguments);};__cov_KVlxezpGf5TlaMDCevWTug.s['5']++;Drop.NAME='dd-drop-plugin';__cov_KVlxezpGf5TlaMDCevWTug.s['6']++;Drop.NS='drop';__cov_KVlxezpGf5TlaMDCevWTug.s['7']++;Y.extend(Drop,Y.DD.Drop);__cov_KVlxezpGf5TlaMDCevWTug.s['8']++;Y.namespace('Plugin');__cov_KVlxezpGf5TlaMDCevWTug.s['9']++;Y.Plugin.Drop=Drop;},'@VERSION@',{'requires':['dd-drop']}); diff --git a/src/build/dd-drop-plugin/dd-drop-plugin-debug.js b/src/build/dd-drop-plugin/dd-drop-plugin-debug.js new file mode 100644 index 00000000000..8cf958dfb2b --- /dev/null +++ b/src/build/dd-drop-plugin/dd-drop-plugin-debug.js @@ -0,0 +1,44 @@ +YUI.add('dd-drop-plugin', function (Y, NAME) { + + + /** + * Simple Drop plugin that can be attached to a Node via the plug method. + * @module dd + * @submodule dd-drop-plugin + */ + /** + * Simple Drop plugin that can be attached to a Node via the plug method. + * @class Drop + * @extends DD.Drop + * @constructor + * @namespace Plugin + */ + + + var Drop = function(config) { + config.node = config.host; + Drop.superclass.constructor.apply(this, arguments); + }; + + /** + * dd-drop-plugin + * @property NAME + * @type {String} + */ + Drop.NAME = "dd-drop-plugin"; + /** + * The Drop instance will be placed on the Node instance under the drop namespace. It can be accessed via Node.drop; + * @property NS + * @type {String} + */ + Drop.NS = "drop"; + + + Y.extend(Drop, Y.DD.Drop); + Y.namespace('Plugin'); + Y.Plugin.Drop = Drop; + + + + +}, '@VERSION@', {"requires": ["dd-drop"]}); diff --git a/src/build/dd-drop-plugin/dd-drop-plugin-min.js b/src/build/dd-drop-plugin/dd-drop-plugin-min.js new file mode 100644 index 00000000000..b83667ad99c --- /dev/null +++ b/src/build/dd-drop-plugin/dd-drop-plugin-min.js @@ -0,0 +1 @@ +YUI.add("dd-drop-plugin",function(e,t){var n=function(e){e.node=e.host,n.superclass.constructor.apply(this,arguments)};n.NAME="dd-drop-plugin",n.NS="drop",e.extend(n,e.DD.Drop),e.namespace("Plugin"),e.Plugin.Drop=n},"@VERSION@",{requires:["dd-drop"]}); diff --git a/src/build/dd-drop-plugin/dd-drop-plugin.js b/src/build/dd-drop-plugin/dd-drop-plugin.js new file mode 100644 index 00000000000..8cf958dfb2b --- /dev/null +++ b/src/build/dd-drop-plugin/dd-drop-plugin.js @@ -0,0 +1,44 @@ +YUI.add('dd-drop-plugin', function (Y, NAME) { + + + /** + * Simple Drop plugin that can be attached to a Node via the plug method. + * @module dd + * @submodule dd-drop-plugin + */ + /** + * Simple Drop plugin that can be attached to a Node via the plug method. + * @class Drop + * @extends DD.Drop + * @constructor + * @namespace Plugin + */ + + + var Drop = function(config) { + config.node = config.host; + Drop.superclass.constructor.apply(this, arguments); + }; + + /** + * dd-drop-plugin + * @property NAME + * @type {String} + */ + Drop.NAME = "dd-drop-plugin"; + /** + * The Drop instance will be placed on the Node instance under the drop namespace. It can be accessed via Node.drop; + * @property NS + * @type {String} + */ + Drop.NS = "drop"; + + + Y.extend(Drop, Y.DD.Drop); + Y.namespace('Plugin'); + Y.Plugin.Drop = Drop; + + + + +}, '@VERSION@', {"requires": ["dd-drop"]}); diff --git a/src/build/dd-drop/dd-drop-coverage.js b/src/build/dd-drop/dd-drop-coverage.js new file mode 100644 index 00000000000..9a9eaa1dc28 --- /dev/null +++ b/src/build/dd-drop/dd-drop-coverage.js @@ -0,0 +1,6 @@ +if (typeof __coverage__ === 'undefined') { __coverage__ = {}; } +if (!__coverage__['build/dd-drop/dd-drop.js']) { + __coverage__['build/dd-drop/dd-drop.js'] = {"path":"build/dd-drop/dd-drop.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0,"106":0,"107":0,"108":0,"109":0,"110":0,"111":0,"112":0,"113":0,"114":0,"115":0,"116":0,"117":0,"118":0,"119":0,"120":0,"121":0,"122":0,"123":0,"124":0,"125":0,"126":0,"127":0,"128":0,"129":0,"130":0,"131":0,"132":0,"133":0,"134":0,"135":0,"136":0,"137":0,"138":0,"139":0,"140":0,"141":0,"142":0,"143":0,"144":0,"145":0,"146":0,"147":0,"148":0,"149":0,"150":0,"151":0,"152":0,"153":0,"154":0,"155":0,"156":0,"157":0,"158":0},"b":{"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0],"8":[0,0],"9":[0,0],"10":[0,0],"11":[0,0],"12":[0,0],"13":[0,0],"14":[0,0],"15":[0,0],"16":[0,0],"17":[0,0],"18":[0,0],"19":[0,0],"20":[0,0],"21":[0,0],"22":[0,0],"23":[0,0],"24":[0,0],"25":[0,0],"26":[0,0],"27":[0,0],"28":[0,0],"29":[0,0],"30":[0,0],"31":[0,0]},"f":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":38}}},"2":{"name":"(anonymous_2)","line":68,"loc":{"start":{"line":68,"column":11},"end":{"line":68,"column":22}}},"3":{"name":"(anonymous_3)","line":79,"loc":{"start":{"line":79,"column":32},"end":{"line":79,"column":43}}},"4":{"name":"(anonymous_4)","line":102,"loc":{"start":{"line":102,"column":20},"end":{"line":102,"column":35}}},"5":{"name":"(anonymous_5)","line":117,"loc":{"start":{"line":117,"column":20},"end":{"line":117,"column":31}}},"6":{"name":"(anonymous_6)","line":125,"loc":{"start":{"line":125,"column":20},"end":{"line":125,"column":32}}},"7":{"name":"(anonymous_7)","line":137,"loc":{"start":{"line":137,"column":20},"end":{"line":137,"column":32}}},"8":{"name":"(anonymous_8)","line":148,"loc":{"start":{"line":148,"column":20},"end":{"line":148,"column":35}}},"9":{"name":"(anonymous_9)","line":165,"loc":{"start":{"line":165,"column":20},"end":{"line":165,"column":32}}},"10":{"name":"(anonymous_10)","line":178,"loc":{"start":{"line":178,"column":20},"end":{"line":178,"column":32}}},"11":{"name":"Drop_createShim","line":185,"loc":{"start":{"line":185,"column":4},"end":{"line":185,"column":31}}},"12":{"name":"createShimNode","line":201,"loc":{"start":{"line":201,"column":4},"end":{"line":201,"column":31}}},"13":{"name":"(anonymous_13)","line":244,"loc":{"start":{"line":244,"column":20},"end":{"line":244,"column":32}}},"14":{"name":"(anonymous_14)","line":254,"loc":{"start":{"line":254,"column":25},"end":{"line":254,"column":37}}},"15":{"name":"(anonymous_15)","line":263,"loc":{"start":{"line":263,"column":23},"end":{"line":263,"column":34}}},"16":{"name":"(anonymous_16)","line":272,"loc":{"start":{"line":272,"column":29},"end":{"line":272,"column":41}}},"17":{"name":"(anonymous_17)","line":321,"loc":{"start":{"line":321,"column":17},"end":{"line":321,"column":34}}},"18":{"name":"(anonymous_18)","line":324,"loc":{"start":{"line":324,"column":33},"end":{"line":324,"column":45}}},"19":{"name":"(anonymous_19)","line":337,"loc":{"start":{"line":337,"column":21},"end":{"line":337,"column":32}}},"20":{"name":"(anonymous_20)","line":354,"loc":{"start":{"line":354,"column":20},"end":{"line":354,"column":31}}},"21":{"name":"(anonymous_21)","line":369,"loc":{"start":{"line":369,"column":25},"end":{"line":369,"column":36}}},"22":{"name":"(anonymous_22)","line":391,"loc":{"start":{"line":391,"column":23},"end":{"line":391,"column":34}}},"23":{"name":"(anonymous_23)","line":424,"loc":{"start":{"line":424,"column":18},"end":{"line":424,"column":29}}},"24":{"name":"(anonymous_24)","line":494,"loc":{"start":{"line":494,"column":27},"end":{"line":494,"column":38}}},"25":{"name":"(anonymous_25)","line":522,"loc":{"start":{"line":522,"column":26},"end":{"line":522,"column":37}}},"26":{"name":"(anonymous_26)","line":531,"loc":{"start":{"line":531,"column":25},"end":{"line":531,"column":36}}},"27":{"name":"(anonymous_27)","line":540,"loc":{"start":{"line":540,"column":20},"end":{"line":540,"column":36}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":564,"column":58}},"2":{"start":{"line":17,"column":4},"end":{"line":91,"column":6}},"3":{"start":{"line":69,"column":8},"end":{"line":69,"column":35}},"4":{"start":{"line":70,"column":8},"end":{"line":70,"column":59}},"5":{"start":{"line":79,"column":8},"end":{"line":81,"column":18}},"6":{"start":{"line":80,"column":12},"end":{"line":80,"column":48}},"7":{"start":{"line":82,"column":8},"end":{"line":82,"column":29}},"8":{"start":{"line":93,"column":4},"end":{"line":93,"column":23}},"9":{"start":{"line":95,"column":4},"end":{"line":183,"column":6}},"10":{"start":{"line":103,"column":16},"end":{"line":103,"column":36}},"11":{"start":{"line":104,"column":16},"end":{"line":106,"column":17}},"12":{"start":{"line":105,"column":20},"end":{"line":105,"column":68}},"13":{"start":{"line":107,"column":16},"end":{"line":107,"column":25}},"14":{"start":{"line":118,"column":16},"end":{"line":121,"column":17}},"15":{"start":{"line":119,"column":20},"end":{"line":119,"column":38}},"16":{"start":{"line":120,"column":20},"end":{"line":120,"column":30}},"17":{"start":{"line":123,"column":16},"end":{"line":123,"column":51}},"18":{"start":{"line":126,"column":16},"end":{"line":126,"column":47}},"19":{"start":{"line":127,"column":16},"end":{"line":127,"column":25}},"20":{"start":{"line":138,"column":16},"end":{"line":138,"column":47}},"21":{"start":{"line":149,"column":16},"end":{"line":153,"column":17}},"22":{"start":{"line":150,"column":20},"end":{"line":150,"column":77}},"23":{"start":{"line":152,"column":20},"end":{"line":152,"column":80}},"24":{"start":{"line":154,"column":16},"end":{"line":154,"column":28}},"25":{"start":{"line":166,"column":16},"end":{"line":166,"column":34}},"26":{"start":{"line":167,"column":16},"end":{"line":167,"column":25}},"27":{"start":{"line":179,"column":16},"end":{"line":179,"column":38}},"28":{"start":{"line":180,"column":16},"end":{"line":180,"column":25}},"29":{"start":{"line":185,"column":4},"end":{"line":199,"column":5}},"30":{"start":{"line":187,"column":8},"end":{"line":190,"column":9}},"31":{"start":{"line":188,"column":12},"end":{"line":188,"column":47}},"32":{"start":{"line":189,"column":12},"end":{"line":189,"column":19}},"33":{"start":{"line":191,"column":8},"end":{"line":191,"column":30}},"34":{"start":{"line":191,"column":23},"end":{"line":191,"column":30}},"35":{"start":{"line":193,"column":8},"end":{"line":193,"column":33}},"36":{"start":{"line":195,"column":8},"end":{"line":197,"column":9}},"37":{"start":{"line":196,"column":12},"end":{"line":196,"column":34}},"38":{"start":{"line":198,"column":8},"end":{"line":198,"column":22}},"39":{"start":{"line":201,"column":4},"end":{"line":229,"column":5}},"40":{"start":{"line":202,"column":8},"end":{"line":202,"column":18}},"41":{"start":{"line":203,"column":8},"end":{"line":210,"column":9}},"42":{"start":{"line":204,"column":12},"end":{"line":204,"column":29}},"43":{"start":{"line":209,"column":12},"end":{"line":209,"column":19}},"44":{"start":{"line":212,"column":8},"end":{"line":212,"column":71}},"45":{"start":{"line":213,"column":8},"end":{"line":223,"column":11}},"46":{"start":{"line":224,"column":8},"end":{"line":224,"column":31}},"47":{"start":{"line":226,"column":8},"end":{"line":226,"column":63}},"48":{"start":{"line":227,"column":8},"end":{"line":227,"column":61}},"49":{"start":{"line":228,"column":8},"end":{"line":228,"column":17}},"50":{"start":{"line":231,"column":4},"end":{"line":557,"column":7}},"51":{"start":{"line":245,"column":12},"end":{"line":245,"column":35}},"52":{"start":{"line":246,"column":12},"end":{"line":246,"column":24}},"53":{"start":{"line":255,"column":12},"end":{"line":255,"column":35}},"54":{"start":{"line":256,"column":12},"end":{"line":256,"column":24}},"55":{"start":{"line":265,"column":12},"end":{"line":270,"column":14}},"56":{"start":{"line":272,"column":12},"end":{"line":281,"column":21}},"57":{"start":{"line":273,"column":16},"end":{"line":280,"column":19}},"58":{"start":{"line":322,"column":12},"end":{"line":322,"column":32}},"59":{"start":{"line":323,"column":12},"end":{"line":323,"column":28}},"60":{"start":{"line":324,"column":12},"end":{"line":329,"column":21}},"61":{"start":{"line":325,"column":16},"end":{"line":328,"column":17}},"62":{"start":{"line":326,"column":20},"end":{"line":326,"column":31}},"63":{"start":{"line":327,"column":20},"end":{"line":327,"column":39}},"64":{"start":{"line":330,"column":12},"end":{"line":330,"column":23}},"65":{"start":{"line":338,"column":12},"end":{"line":338,"column":51}},"66":{"start":{"line":340,"column":12},"end":{"line":340,"column":42}},"67":{"start":{"line":341,"column":12},"end":{"line":344,"column":13}},"68":{"start":{"line":342,"column":16},"end":{"line":342,"column":35}},"69":{"start":{"line":343,"column":16},"end":{"line":343,"column":35}},"70":{"start":{"line":345,"column":12},"end":{"line":345,"column":52}},"71":{"start":{"line":347,"column":12},"end":{"line":347,"column":51}},"72":{"start":{"line":355,"column":12},"end":{"line":355,"column":35}},"73":{"start":{"line":356,"column":12},"end":{"line":360,"column":13}},"74":{"start":{"line":357,"column":16},"end":{"line":357,"column":38}},"75":{"start":{"line":358,"column":16},"end":{"line":358,"column":35}},"76":{"start":{"line":359,"column":16},"end":{"line":359,"column":33}},"77":{"start":{"line":361,"column":12},"end":{"line":361,"column":65}},"78":{"start":{"line":362,"column":12},"end":{"line":362,"column":29}},"79":{"start":{"line":370,"column":12},"end":{"line":372,"column":13}},"80":{"start":{"line":371,"column":16},"end":{"line":371,"column":29}},"81":{"start":{"line":373,"column":12},"end":{"line":373,"column":78}},"82":{"start":{"line":374,"column":12},"end":{"line":374,"column":80}},"83":{"start":{"line":375,"column":12},"end":{"line":375,"column":70}},"84":{"start":{"line":377,"column":12},"end":{"line":383,"column":13}},"85":{"start":{"line":378,"column":16},"end":{"line":382,"column":19}},"86":{"start":{"line":384,"column":12},"end":{"line":384,"column":36}},"87":{"start":{"line":392,"column":12},"end":{"line":394,"column":13}},"88":{"start":{"line":393,"column":16},"end":{"line":393,"column":29}},"89":{"start":{"line":395,"column":12},"end":{"line":397,"column":13}},"90":{"start":{"line":396,"column":16},"end":{"line":396,"column":29}},"91":{"start":{"line":398,"column":12},"end":{"line":400,"column":13}},"92":{"start":{"line":399,"column":16},"end":{"line":399,"column":29}},"93":{"start":{"line":401,"column":12},"end":{"line":401,"column":38}},"94":{"start":{"line":404,"column":12},"end":{"line":417,"column":13}},"95":{"start":{"line":405,"column":16},"end":{"line":405,"column":74}},"96":{"start":{"line":406,"column":16},"end":{"line":406,"column":69}},"97":{"start":{"line":407,"column":16},"end":{"line":407,"column":36}},"98":{"start":{"line":408,"column":16},"end":{"line":408,"column":40}},"99":{"start":{"line":409,"column":16},"end":{"line":411,"column":17}},"100":{"start":{"line":410,"column":20},"end":{"line":410,"column":47}},"101":{"start":{"line":412,"column":16},"end":{"line":412,"column":32}},"102":{"start":{"line":414,"column":16},"end":{"line":414,"column":39}},"103":{"start":{"line":415,"column":16},"end":{"line":415,"column":72}},"104":{"start":{"line":416,"column":16},"end":{"line":416,"column":71}},"105":{"start":{"line":425,"column":12},"end":{"line":427,"column":13}},"106":{"start":{"line":426,"column":16},"end":{"line":426,"column":29}},"107":{"start":{"line":428,"column":12},"end":{"line":430,"column":13}},"108":{"start":{"line":429,"column":16},"end":{"line":429,"column":29}},"109":{"start":{"line":432,"column":12},"end":{"line":434,"column":13}},"110":{"start":{"line":433,"column":16},"end":{"line":433,"column":29}},"111":{"start":{"line":435,"column":12},"end":{"line":438,"column":13}},"112":{"start":{"line":436,"column":16},"end":{"line":436,"column":50}},"113":{"start":{"line":437,"column":16},"end":{"line":437,"column":29}},"114":{"start":{"line":439,"column":12},"end":{"line":444,"column":27}},"115":{"start":{"line":448,"column":12},"end":{"line":448,"column":39}},"116":{"start":{"line":449,"column":12},"end":{"line":449,"column":39}},"117":{"start":{"line":450,"column":12},"end":{"line":450,"column":35}},"118":{"start":{"line":451,"column":12},"end":{"line":451,"column":34}},"119":{"start":{"line":454,"column":12},"end":{"line":465,"column":13}},"120":{"start":{"line":456,"column":16},"end":{"line":456,"column":36}},"121":{"start":{"line":457,"column":16},"end":{"line":457,"column":53}},"122":{"start":{"line":458,"column":16},"end":{"line":458,"column":52}},"123":{"start":{"line":460,"column":16},"end":{"line":460,"column":31}},"124":{"start":{"line":461,"column":16},"end":{"line":461,"column":31}},"125":{"start":{"line":462,"column":16},"end":{"line":462,"column":53}},"126":{"start":{"line":463,"column":16},"end":{"line":463,"column":53}},"127":{"start":{"line":467,"column":12},"end":{"line":475,"column":13}},"128":{"start":{"line":469,"column":16},"end":{"line":474,"column":19}},"129":{"start":{"line":478,"column":12},"end":{"line":486,"column":14}},"130":{"start":{"line":495,"column":12},"end":{"line":515,"column":13}},"131":{"start":{"line":496,"column":16},"end":{"line":496,"column":71}},"132":{"start":{"line":497,"column":16},"end":{"line":497,"column":38}},"133":{"start":{"line":498,"column":16},"end":{"line":498,"column":44}},"134":{"start":{"line":499,"column":16},"end":{"line":512,"column":17}},"135":{"start":{"line":500,"column":20},"end":{"line":500,"column":91}},"136":{"start":{"line":501,"column":20},"end":{"line":501,"column":82}},"137":{"start":{"line":504,"column":20},"end":{"line":511,"column":21}},"138":{"start":{"line":505,"column":24},"end":{"line":505,"column":47}},"139":{"start":{"line":506,"column":24},"end":{"line":506,"column":87}},"140":{"start":{"line":507,"column":24},"end":{"line":507,"column":96}},"141":{"start":{"line":508,"column":24},"end":{"line":508,"column":89}},"142":{"start":{"line":514,"column":16},"end":{"line":514,"column":34}},"143":{"start":{"line":523,"column":12},"end":{"line":523,"column":48}},"144":{"start":{"line":524,"column":12},"end":{"line":524,"column":37}},"145":{"start":{"line":532,"column":12},"end":{"line":532,"column":46}},"146":{"start":{"line":533,"column":12},"end":{"line":533,"column":40}},"147":{"start":{"line":541,"column":12},"end":{"line":555,"column":13}},"148":{"start":{"line":542,"column":16},"end":{"line":554,"column":17}},"149":{"start":{"line":543,"column":20},"end":{"line":543,"column":44}},"150":{"start":{"line":544,"column":20},"end":{"line":546,"column":21}},"151":{"start":{"line":545,"column":24},"end":{"line":545,"column":52}},"152":{"start":{"line":547,"column":20},"end":{"line":553,"column":21}},"153":{"start":{"line":548,"column":24},"end":{"line":548,"column":82}},"154":{"start":{"line":549,"column":24},"end":{"line":549,"column":92}},"155":{"start":{"line":550,"column":24},"end":{"line":550,"column":86}},"156":{"start":{"line":551,"column":24},"end":{"line":551,"column":95}},"157":{"start":{"line":552,"column":24},"end":{"line":552,"column":52}},"158":{"start":{"line":559,"column":4},"end":{"line":559,"column":21}}},"branchMap":{"1":{"line":104,"type":"if","locations":[{"start":{"line":104,"column":16},"end":{"line":104,"column":16}},{"start":{"line":104,"column":16},"end":{"line":104,"column":16}}]},"2":{"line":118,"type":"if","locations":[{"start":{"line":118,"column":16},"end":{"line":118,"column":16}},{"start":{"line":118,"column":16},"end":{"line":118,"column":16}}]},"3":{"line":149,"type":"if","locations":[{"start":{"line":149,"column":16},"end":{"line":149,"column":16}},{"start":{"line":149,"column":16},"end":{"line":149,"column":16}}]},"4":{"line":187,"type":"if","locations":[{"start":{"line":187,"column":8},"end":{"line":187,"column":8}},{"start":{"line":187,"column":8},"end":{"line":187,"column":8}}]},"5":{"line":191,"type":"if","locations":[{"start":{"line":191,"column":8},"end":{"line":191,"column":8}},{"start":{"line":191,"column":8},"end":{"line":191,"column":8}}]},"6":{"line":195,"type":"if","locations":[{"start":{"line":195,"column":8},"end":{"line":195,"column":8}},{"start":{"line":195,"column":8},"end":{"line":195,"column":8}}]},"7":{"line":325,"type":"if","locations":[{"start":{"line":325,"column":16},"end":{"line":325,"column":16}},{"start":{"line":325,"column":16},"end":{"line":325,"column":16}}]},"8":{"line":341,"type":"if","locations":[{"start":{"line":341,"column":12},"end":{"line":341,"column":12}},{"start":{"line":341,"column":12},"end":{"line":341,"column":12}}]},"9":{"line":356,"type":"if","locations":[{"start":{"line":356,"column":12},"end":{"line":356,"column":12}},{"start":{"line":356,"column":12},"end":{"line":356,"column":12}}]},"10":{"line":356,"type":"binary-expr","locations":[{"start":{"line":356,"column":16},"end":{"line":356,"column":25}},{"start":{"line":356,"column":30},"end":{"line":356,"column":58}}]},"11":{"line":370,"type":"if","locations":[{"start":{"line":370,"column":12},"end":{"line":370,"column":12}},{"start":{"line":370,"column":12},"end":{"line":370,"column":12}}]},"12":{"line":377,"type":"if","locations":[{"start":{"line":377,"column":12},"end":{"line":377,"column":12}},{"start":{"line":377,"column":12},"end":{"line":377,"column":12}}]},"13":{"line":392,"type":"if","locations":[{"start":{"line":392,"column":12},"end":{"line":392,"column":12}},{"start":{"line":392,"column":12},"end":{"line":392,"column":12}}]},"14":{"line":395,"type":"if","locations":[{"start":{"line":395,"column":12},"end":{"line":395,"column":12}},{"start":{"line":395,"column":12},"end":{"line":395,"column":12}}]},"15":{"line":398,"type":"if","locations":[{"start":{"line":398,"column":12},"end":{"line":398,"column":12}},{"start":{"line":398,"column":12},"end":{"line":398,"column":12}}]},"16":{"line":404,"type":"if","locations":[{"start":{"line":404,"column":12},"end":{"line":404,"column":12}},{"start":{"line":404,"column":12},"end":{"line":404,"column":12}}]},"17":{"line":409,"type":"if","locations":[{"start":{"line":409,"column":16},"end":{"line":409,"column":16}},{"start":{"line":409,"column":16},"end":{"line":409,"column":16}}]},"18":{"line":425,"type":"if","locations":[{"start":{"line":425,"column":12},"end":{"line":425,"column":12}},{"start":{"line":425,"column":12},"end":{"line":425,"column":12}}]},"19":{"line":428,"type":"if","locations":[{"start":{"line":428,"column":12},"end":{"line":428,"column":12}},{"start":{"line":428,"column":12},"end":{"line":428,"column":12}}]},"20":{"line":432,"type":"if","locations":[{"start":{"line":432,"column":12},"end":{"line":432,"column":12}},{"start":{"line":432,"column":12},"end":{"line":432,"column":12}}]},"21":{"line":435,"type":"if","locations":[{"start":{"line":435,"column":12},"end":{"line":435,"column":12}},{"start":{"line":435,"column":12},"end":{"line":435,"column":12}}]},"22":{"line":454,"type":"if","locations":[{"start":{"line":454,"column":12},"end":{"line":454,"column":12}},{"start":{"line":454,"column":12},"end":{"line":454,"column":12}}]},"23":{"line":467,"type":"if","locations":[{"start":{"line":467,"column":12},"end":{"line":467,"column":12}},{"start":{"line":467,"column":12},"end":{"line":467,"column":12}}]},"24":{"line":495,"type":"if","locations":[{"start":{"line":495,"column":12},"end":{"line":495,"column":12}},{"start":{"line":495,"column":12},"end":{"line":495,"column":12}}]},"25":{"line":499,"type":"if","locations":[{"start":{"line":499,"column":16},"end":{"line":499,"column":16}},{"start":{"line":499,"column":16},"end":{"line":499,"column":16}}]},"26":{"line":504,"type":"if","locations":[{"start":{"line":504,"column":20},"end":{"line":504,"column":20}},{"start":{"line":504,"column":20},"end":{"line":504,"column":20}}]},"27":{"line":541,"type":"if","locations":[{"start":{"line":541,"column":12},"end":{"line":541,"column":12}},{"start":{"line":541,"column":12},"end":{"line":541,"column":12}}]},"28":{"line":541,"type":"binary-expr","locations":[{"start":{"line":541,"column":16},"end":{"line":541,"column":39}},{"start":{"line":541,"column":43},"end":{"line":541,"column":48}}]},"29":{"line":542,"type":"if","locations":[{"start":{"line":542,"column":16},"end":{"line":542,"column":16}},{"start":{"line":542,"column":16},"end":{"line":542,"column":16}}]},"30":{"line":544,"type":"if","locations":[{"start":{"line":544,"column":20},"end":{"line":544,"column":20}},{"start":{"line":544,"column":20},"end":{"line":544,"column":20}}]},"31":{"line":547,"type":"if","locations":[{"start":{"line":547,"column":20},"end":{"line":547,"column":20}},{"start":{"line":547,"column":20},"end":{"line":547,"column":20}}]}},"code":["(function () { YUI.add('dd-drop', function (Y, NAME) {","",""," /**"," * Provides the ability to create a Drop Target."," * @module dd"," * @submodule dd-drop"," */"," /**"," * Provides the ability to create a Drop Target."," * @class Drop"," * @extends Base"," * @constructor"," * @namespace DD"," */",""," var NODE = 'node',"," DDM = Y.DD.DDM,"," OFFSET_HEIGHT = 'offsetHeight',"," OFFSET_WIDTH = 'offsetWidth',"," /**"," * Fires when a drag element is over this target."," * @event drop:over"," * @param {EventFacade} event An Event Facade object with the following specific property added:"," *
"," *
drop
The drop object at the time of the event.
"," *
drag
The drag object at the time of the event.
"," *
"," * @bubbles DDM"," * @type {CustomEvent}"," */"," EV_DROP_OVER = 'drop:over',"," /**"," * Fires when a drag element enters this target."," * @event drop:enter"," * @param {EventFacade} event An Event Facade object with the following specific property added:"," *
"," *
drop
The drop object at the time of the event.
"," *
drag
The drag object at the time of the event.
"," *
"," * @bubbles DDM"," * @type {CustomEvent}"," */"," EV_DROP_ENTER = 'drop:enter',"," /**"," * Fires when a drag element exits this target."," * @event drop:exit"," * @param {EventFacade} event An Event Facade object"," * @bubbles DDM"," * @type {CustomEvent}"," */"," EV_DROP_EXIT = 'drop:exit',",""," /**"," * Fires when a draggable node is dropped on this Drop Target. (Fired from dd-ddm-drop)"," * @event drop:hit"," * @param {EventFacade} event An Event Facade object with the following specific property added:"," *
"," *
drop
The best guess on what was dropped on.
"," *
drag
The drag object at the time of the event.
"," *
others
An array of all the other drop targets that was dropped on.
"," *
"," * @bubbles DDM"," * @type {CustomEvent}"," */","",""," Drop = function() {"," this._lazyAddAttrs = false;"," Drop.superclass.constructor.apply(this, arguments);","",""," //DD init speed up."," // (GS) Causes errors."," // (GS) See: http://yuilibrary.com/trac-archive/tickets/2532985.html"," // (GS) However, changing from async to sync "," // (GS) will cause change propagation, so leave it alone "," // (GS) until further investigation and thorough testing."," Y.on('domready', Y.bind(function() {"," Y.later(100, this, Drop_createShim);"," }, this));"," DDM._regTarget(this);",""," /* TODO"," if (Dom.getStyle(this.el, 'position') == 'fixed') {"," Event.on(window, 'scroll', function() {"," this.activateShim();"," }, this, true);"," }"," */"," };",""," Drop.NAME = 'drop';",""," Drop.ATTRS = {"," /**"," * Y.Node instance to use as the element to make a Drop Target"," * @attribute node"," * @type Node"," */"," node: {"," setter: function(node) {"," var n = Y.one(node);"," if (!n) {"," Y.error('DD.Drop: Invalid Node Given: ' + node);"," }"," return n;"," }"," },"," /**"," * Array of groups to add this drop into."," * @attribute groups"," * @type Array"," */"," groups: {"," value: ['default'],"," getter: function() {"," if (!this._groups) {"," this._groups = {};"," return [];"," }",""," return Y.Object.keys(this._groups);"," },"," setter: function(g) {"," this._groups = Y.Array.hash(g);"," return g;"," }"," },"," /**"," * CSS style padding to make the Drop Target bigger than the node."," * @attribute padding"," * @type String"," */"," padding: {"," value: '0',"," setter: function(p) {"," return DDM.cssSizestoObject(p);"," }"," },"," /**"," * Set to lock this drop element."," * @attribute lock"," * @type Boolean"," */"," lock: {"," value: false,"," setter: function(lock) {"," if (lock) {"," this.get(NODE).addClass(DDM.CSS_PREFIX + '-drop-locked');"," } else {"," this.get(NODE).removeClass(DDM.CSS_PREFIX + '-drop-locked');"," }"," return lock;"," }"," },"," /**"," * Controls the default bubble parent for this Drop instance. Default: Y.DD.DDM. Set to false to disable bubbling."," * Use bubbleTargets in config."," * @deprecated"," * @attribute bubbles"," * @type Object"," */"," bubbles: {"," setter: function(t) {"," this.addTarget(t);"," return t;"," }"," },"," /**"," * Use the Drop shim. Default: true"," * @deprecated"," * @attribute useShim"," * @type Boolean"," */"," useShim: {"," value: true,"," setter: function(v) {"," Y.DD.DDM._noShim = !v;"," return v;"," }"," }"," };",""," function Drop_createShim() {"," //No playground, defer"," if (!DDM._pg) {"," Y.later(10, this, Drop_createShim);"," return;"," }"," if (this.shim) return;",""," var s = this.get('node');",""," if (this.get('useShim')) {"," s = createShimNode(s);"," }"," this.shim = s;"," }",""," function createShimNode(s) {"," var s, id;"," try {"," id = s.get(\"id\");"," } catch(ex) {"," // _stateProxy is null, TypeError thrown getting"," // _stateProxy[id]. "," // See: http://yuilibrary.com/trac-archive/tickets/2532985.html"," return;"," }",""," s = Y.Node.create('
');"," s.setStyles({"," height: this.get(NODE).get(OFFSET_HEIGHT) + 'px',"," width: this.get(NODE).get(OFFSET_WIDTH) + 'px',"," backgroundColor: 'yellow',"," opacity: '.5',"," zIndex: '1',"," overflow: 'hidden',"," top: '-900px',"," left: '-900px',"," position: 'absolute'"," });"," DDM._pg.appendChild(s);",""," s.on('mouseover', Y.bind(this._handleOverEvent, this));"," s.on('mouseout', Y.bind(this._handleOutEvent, this));"," return s;"," }",""," Y.extend(Drop, Y.Base, {"," /**"," * The default bubbleTarget for this object. Default: Y.DD.DDM"," * @private"," * @property _bubbleTargets"," */"," _bubbleTargets: Y.DD.DDM,"," /**"," * Add this Drop instance to a group, this should be used for on-the-fly group additions."," * @method addToGroup"," * @param {String} g The group to add this Drop Instance to."," * @chainable"," */"," addToGroup: function(g) {"," this._groups[g] = true;"," return this;"," },"," /**"," * Remove this Drop instance from a group, this should be used for on-the-fly group removals."," * @method removeFromGroup"," * @param {String} g The group to remove this Drop Instance from."," * @chainable"," */"," removeFromGroup: function(g) {"," delete this._groups[g];"," return this;"," },"," /**"," * This method creates all the events for this Event Target and publishes them so we get Event Bubbling."," * @private"," * @method _createEvents"," */"," _createEvents: function() {",""," var ev = ["," EV_DROP_OVER,"," EV_DROP_ENTER,"," EV_DROP_EXIT,"," 'drop:hit'"," ];",""," Y.Array.each(ev, function(v) {"," this.publish(v, {"," type: v,"," emitFacade: true,"," preventable: false,"," bubbles: true,"," queuable: false,"," prefix: 'drop'"," });"," }, this);"," },"," /**"," * Flag for determining if the target is valid in this operation."," * @private"," * @property _valid"," * @type Boolean"," */"," _valid: null,"," /**"," * The groups this target belongs to."," * @private"," * @property _groups"," * @type Array"," */"," _groups: null,"," /**"," * Node reference to the targets shim"," * @property shim"," * @type {Object}"," */"," shim: null,"," /**"," * A region object associated with this target, used for checking regions while dragging."," * @property region"," * @type Object"," */"," region: null,"," /**"," * This flag is tripped when a drag element is over this target."," * @property overTarget"," * @type Boolean"," */"," overTarget: null,"," /**"," * Check if this target is in one of the supplied groups."," * @method inGroup"," * @param {Array} groups The groups to check against"," * @return Boolean"," */"," inGroup: function(groups) {"," this._valid = false;"," var ret = false;"," Y.Array.each(groups, function(v) {"," if (this._groups[v]) {"," ret = true;"," this._valid = true;"," }"," }, this);"," return ret;"," },"," /**"," * Private lifecycle method"," * @private"," * @method initializer"," */"," initializer: function() {"," Y.later(100, this, this._createEvents);",""," var node = this.get(NODE), id;"," if (!node.get('id')) {"," id = Y.stamp(node);"," node.set('id', id);"," }"," node.addClass(DDM.CSS_PREFIX + '-drop');"," //Shouldn't have to do this.."," this.set('groups', this.get('groups'));"," },"," /**"," * Lifecycle destructor, unreg the drag from the DDM and remove listeners"," * @private"," * @method destructor"," */"," destructor: function() {"," DDM._unregTarget(this);"," if (this.shim && (this.shim !== this.get(NODE))) {"," this.shim.detachAll();"," this.shim.remove();"," this.shim = null;"," }"," this.get(NODE).removeClass(DDM.CSS_PREFIX + '-drop');"," this.detachAll();"," },"," /**"," * Removes classes from the target, resets some flags and sets the shims deactive position [-999, -999]"," * @private"," * @method _deactivateShim"," */"," _deactivateShim: function() {"," if (!this.shim) {"," return false;"," }"," this.get(NODE).removeClass(DDM.CSS_PREFIX + '-drop-active-valid');"," this.get(NODE).removeClass(DDM.CSS_PREFIX + '-drop-active-invalid');"," this.get(NODE).removeClass(DDM.CSS_PREFIX + '-drop-over');",""," if (this.get('useShim')) {"," this.shim.setStyles({"," top: '-999px',"," left: '-999px',"," zIndex: '1'"," });"," }"," this.overTarget = false;"," },"," /**"," * Activates the shim and adds some interaction CSS classes"," * @private"," * @method _activateShim"," */"," _activateShim: function() {"," if (!DDM.activeDrag) {"," return false; //Nothing is dragging, no reason to activate."," }"," if (this.get(NODE) === DDM.activeDrag.get(NODE)) {"," return false;"," }"," if (this.get('lock')) {"," return false;"," }"," var node = this.get(NODE);"," //TODO Visibility Check.."," //if (this.inGroup(DDM.activeDrag.get('groups')) && this.get(NODE).isVisible()) {"," if (this.inGroup(DDM.activeDrag.get('groups'))) {"," node.removeClass(DDM.CSS_PREFIX + '-drop-active-invalid');"," node.addClass(DDM.CSS_PREFIX + '-drop-active-valid');"," DDM._addValid(this);"," this.overTarget = false;"," if (!this.get('useShim')) {"," this.shim = this.get(NODE);"," }"," this.sizeShim();"," } else {"," DDM._removeValid(this);"," node.removeClass(DDM.CSS_PREFIX + '-drop-active-valid');"," node.addClass(DDM.CSS_PREFIX + '-drop-active-invalid');"," }"," },"," /**"," * Positions and sizes the shim with the raw data from the node,"," * this can be used to programatically adjust the Targets shim for Animation.."," * @method sizeShim"," */"," sizeShim: function() {"," if (!DDM.activeDrag) {"," return false; //Nothing is dragging, no reason to activate."," }"," if (this.get(NODE) === DDM.activeDrag.get(NODE)) {"," return false;"," }"," //if (this.get('lock') || !this.get('useShim')) {"," if (this.get('lock')) {"," return false;"," }"," if (!this.shim) {"," Y.later(100, this, this.sizeShim);"," return false;"," }"," var node = this.get(NODE),"," nh = node.get(OFFSET_HEIGHT),"," nw = node.get(OFFSET_WIDTH),"," xy = node.getXY(),"," p = this.get('padding'),"," dd, dH, dW;","",""," //Apply padding"," nw = nw + p.left + p.right;"," nh = nh + p.top + p.bottom;"," xy[0] = xy[0] - p.left;"," xy[1] = xy[1] - p.top;","",""," if (DDM.activeDrag.get('dragMode') === DDM.INTERSECT) {"," //Intersect Mode, make the shim bigger"," dd = DDM.activeDrag;"," dH = dd.get(NODE).get(OFFSET_HEIGHT);"," dW = dd.get(NODE).get(OFFSET_WIDTH);",""," nh = (nh + dH);"," nw = (nw + dW);"," xy[0] = xy[0] - (dW - dd.deltaXY[0]);"," xy[1] = xy[1] - (dH - dd.deltaXY[1]);",""," }",""," if (this.get('useShim')) {"," //Set the style on the shim"," this.shim.setStyles({"," height: nh + 'px',"," width: nw + 'px',"," top: xy[1] + 'px',"," left: xy[0] + 'px'"," });"," }",""," //Create the region to be used by intersect when a drag node is over us."," this.region = {"," '0': xy[0],"," '1': xy[1],"," area: 0,"," top: xy[1],"," right: xy[0] + nw,"," bottom: xy[1] + nh,"," left: xy[0]"," };"," },",""," /**"," * This handles the over target call made from this object or from the DDM"," * @private"," * @method _handleOverTarget"," */"," _handleTargetOver: function() {"," if (DDM.isOverTarget(this)) {"," this.get(NODE).addClass(DDM.CSS_PREFIX + '-drop-over');"," DDM.activeDrop = this;"," DDM.otherDrops[this] = this;"," if (this.overTarget) {"," DDM.activeDrag.fire('drag:over', { drop: this, drag: DDM.activeDrag });"," this.fire(EV_DROP_OVER, { drop: this, drag: DDM.activeDrag });"," } else {"," //Prevent an enter before a start.."," if (DDM.activeDrag.get('dragging')) {"," this.overTarget = true;"," this.fire(EV_DROP_ENTER, { drop: this, drag: DDM.activeDrag });"," DDM.activeDrag.fire('drag:enter', { drop: this, drag: DDM.activeDrag });"," DDM.activeDrag.get(NODE).addClass(DDM.CSS_PREFIX + '-drag-over');"," //TODO - Is this needed??"," //DDM._handleTargetOver();"," }"," }"," } else {"," this._handleOut();"," }"," },"," /**"," * Handles the mouseover DOM event on the Target Shim"," * @private"," * @method _handleOverEvent"," */"," _handleOverEvent: function() {"," this.shim.setStyle('zIndex', '999');"," DDM._addActiveShim(this);"," },"," /**"," * Handles the mouseout DOM event on the Target Shim"," * @private"," * @method _handleOutEvent"," */"," _handleOutEvent: function() {"," this.shim.setStyle('zIndex', '1');"," DDM._removeActiveShim(this);"," },"," /**"," * Handles out of target calls/checks"," * @private"," * @method _handleOut"," */"," _handleOut: function(force) {"," if (!DDM.isOverTarget(this) || force) {"," if (this.overTarget) {"," this.overTarget = false;"," if (!force) {"," DDM._removeActiveShim(this);"," }"," if (DDM.activeDrag) {"," this.get(NODE).removeClass(DDM.CSS_PREFIX + '-drop-over');"," DDM.activeDrag.get(NODE).removeClass(DDM.CSS_PREFIX + '-drag-over');"," this.fire(EV_DROP_EXIT, { drop: this, drag: DDM.activeDrag });"," DDM.activeDrag.fire('drag:exit', { drop: this, drag: DDM.activeDrag });"," delete DDM.otherDrops[this];"," }"," }"," }"," }"," });",""," Y.DD.Drop = Drop;","","","","","}, '@VERSION@', {\"requires\": [\"dd-drag\", \"dd-ddm-drop\"]});","","}());"]}; +} +var __cov_3eiEp1iCAUM1okIweRgSmw = __coverage__['build/dd-drop/dd-drop.js']; +__cov_3eiEp1iCAUM1okIweRgSmw.s['1']++;YUI.add('dd-drop',function(Y,NAME){__cov_3eiEp1iCAUM1okIweRgSmw.f['1']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['2']++;var NODE='node',DDM=Y.DD.DDM,OFFSET_HEIGHT='offsetHeight',OFFSET_WIDTH='offsetWidth',EV_DROP_OVER='drop:over',EV_DROP_ENTER='drop:enter',EV_DROP_EXIT='drop:exit',Drop=function(){__cov_3eiEp1iCAUM1okIweRgSmw.f['2']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['3']++;this._lazyAddAttrs=false;__cov_3eiEp1iCAUM1okIweRgSmw.s['4']++;Drop.superclass.constructor.apply(this,arguments);__cov_3eiEp1iCAUM1okIweRgSmw.s['5']++;Y.on('domready',Y.bind(function(){__cov_3eiEp1iCAUM1okIweRgSmw.f['3']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['6']++;Y.later(100,this,Drop_createShim);},this));__cov_3eiEp1iCAUM1okIweRgSmw.s['7']++;DDM._regTarget(this);};__cov_3eiEp1iCAUM1okIweRgSmw.s['8']++;Drop.NAME='drop';__cov_3eiEp1iCAUM1okIweRgSmw.s['9']++;Drop.ATTRS={node:{setter:function(node){__cov_3eiEp1iCAUM1okIweRgSmw.f['4']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['10']++;var n=Y.one(node);__cov_3eiEp1iCAUM1okIweRgSmw.s['11']++;if(!n){__cov_3eiEp1iCAUM1okIweRgSmw.b['1'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['12']++;Y.error('DD.Drop: Invalid Node Given: '+node);}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['1'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['13']++;return n;}},groups:{value:['default'],getter:function(){__cov_3eiEp1iCAUM1okIweRgSmw.f['5']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['14']++;if(!this._groups){__cov_3eiEp1iCAUM1okIweRgSmw.b['2'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['15']++;this._groups={};__cov_3eiEp1iCAUM1okIweRgSmw.s['16']++;return[];}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['2'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['17']++;return Y.Object.keys(this._groups);},setter:function(g){__cov_3eiEp1iCAUM1okIweRgSmw.f['6']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['18']++;this._groups=Y.Array.hash(g);__cov_3eiEp1iCAUM1okIweRgSmw.s['19']++;return g;}},padding:{value:'0',setter:function(p){__cov_3eiEp1iCAUM1okIweRgSmw.f['7']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['20']++;return DDM.cssSizestoObject(p);}},lock:{value:false,setter:function(lock){__cov_3eiEp1iCAUM1okIweRgSmw.f['8']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['21']++;if(lock){__cov_3eiEp1iCAUM1okIweRgSmw.b['3'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['22']++;this.get(NODE).addClass(DDM.CSS_PREFIX+'-drop-locked');}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['3'][1]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['23']++;this.get(NODE).removeClass(DDM.CSS_PREFIX+'-drop-locked');}__cov_3eiEp1iCAUM1okIweRgSmw.s['24']++;return lock;}},bubbles:{setter:function(t){__cov_3eiEp1iCAUM1okIweRgSmw.f['9']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['25']++;this.addTarget(t);__cov_3eiEp1iCAUM1okIweRgSmw.s['26']++;return t;}},useShim:{value:true,setter:function(v){__cov_3eiEp1iCAUM1okIweRgSmw.f['10']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['27']++;Y.DD.DDM._noShim=!v;__cov_3eiEp1iCAUM1okIweRgSmw.s['28']++;return v;}}};__cov_3eiEp1iCAUM1okIweRgSmw.s['29']++;function Drop_createShim(){__cov_3eiEp1iCAUM1okIweRgSmw.f['11']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['30']++;if(!DDM._pg){__cov_3eiEp1iCAUM1okIweRgSmw.b['4'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['31']++;Y.later(10,this,Drop_createShim);__cov_3eiEp1iCAUM1okIweRgSmw.s['32']++;return;}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['4'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['33']++;if(this.shim){__cov_3eiEp1iCAUM1okIweRgSmw.b['5'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['34']++;return;}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['5'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['35']++;var s=this.get('node');__cov_3eiEp1iCAUM1okIweRgSmw.s['36']++;if(this.get('useShim')){__cov_3eiEp1iCAUM1okIweRgSmw.b['6'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['37']++;s=createShimNode(s);}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['6'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['38']++;this.shim=s;}__cov_3eiEp1iCAUM1okIweRgSmw.s['39']++;function createShimNode(s){__cov_3eiEp1iCAUM1okIweRgSmw.f['12']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['40']++;var s,id;__cov_3eiEp1iCAUM1okIweRgSmw.s['41']++;try{__cov_3eiEp1iCAUM1okIweRgSmw.s['42']++;id=s.get('id');}catch(ex){__cov_3eiEp1iCAUM1okIweRgSmw.s['43']++;return;}__cov_3eiEp1iCAUM1okIweRgSmw.s['44']++;s=Y.Node.create('
');__cov_3eiEp1iCAUM1okIweRgSmw.s['45']++;s.setStyles({height:this.get(NODE).get(OFFSET_HEIGHT)+'px',width:this.get(NODE).get(OFFSET_WIDTH)+'px',backgroundColor:'yellow',opacity:'.5',zIndex:'1',overflow:'hidden',top:'-900px',left:'-900px',position:'absolute'});__cov_3eiEp1iCAUM1okIweRgSmw.s['46']++;DDM._pg.appendChild(s);__cov_3eiEp1iCAUM1okIweRgSmw.s['47']++;s.on('mouseover',Y.bind(this._handleOverEvent,this));__cov_3eiEp1iCAUM1okIweRgSmw.s['48']++;s.on('mouseout',Y.bind(this._handleOutEvent,this));__cov_3eiEp1iCAUM1okIweRgSmw.s['49']++;return s;}__cov_3eiEp1iCAUM1okIweRgSmw.s['50']++;Y.extend(Drop,Y.Base,{_bubbleTargets:Y.DD.DDM,addToGroup:function(g){__cov_3eiEp1iCAUM1okIweRgSmw.f['13']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['51']++;this._groups[g]=true;__cov_3eiEp1iCAUM1okIweRgSmw.s['52']++;return this;},removeFromGroup:function(g){__cov_3eiEp1iCAUM1okIweRgSmw.f['14']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['53']++;delete this._groups[g];__cov_3eiEp1iCAUM1okIweRgSmw.s['54']++;return this;},_createEvents:function(){__cov_3eiEp1iCAUM1okIweRgSmw.f['15']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['55']++;var ev=[EV_DROP_OVER,EV_DROP_ENTER,EV_DROP_EXIT,'drop:hit'];__cov_3eiEp1iCAUM1okIweRgSmw.s['56']++;Y.Array.each(ev,function(v){__cov_3eiEp1iCAUM1okIweRgSmw.f['16']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['57']++;this.publish(v,{type:v,emitFacade:true,preventable:false,bubbles:true,queuable:false,prefix:'drop'});},this);},_valid:null,_groups:null,shim:null,region:null,overTarget:null,inGroup:function(groups){__cov_3eiEp1iCAUM1okIweRgSmw.f['17']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['58']++;this._valid=false;__cov_3eiEp1iCAUM1okIweRgSmw.s['59']++;var ret=false;__cov_3eiEp1iCAUM1okIweRgSmw.s['60']++;Y.Array.each(groups,function(v){__cov_3eiEp1iCAUM1okIweRgSmw.f['18']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['61']++;if(this._groups[v]){__cov_3eiEp1iCAUM1okIweRgSmw.b['7'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['62']++;ret=true;__cov_3eiEp1iCAUM1okIweRgSmw.s['63']++;this._valid=true;}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['7'][1]++;}},this);__cov_3eiEp1iCAUM1okIweRgSmw.s['64']++;return ret;},initializer:function(){__cov_3eiEp1iCAUM1okIweRgSmw.f['19']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['65']++;Y.later(100,this,this._createEvents);__cov_3eiEp1iCAUM1okIweRgSmw.s['66']++;var node=this.get(NODE),id;__cov_3eiEp1iCAUM1okIweRgSmw.s['67']++;if(!node.get('id')){__cov_3eiEp1iCAUM1okIweRgSmw.b['8'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['68']++;id=Y.stamp(node);__cov_3eiEp1iCAUM1okIweRgSmw.s['69']++;node.set('id',id);}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['8'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['70']++;node.addClass(DDM.CSS_PREFIX+'-drop');__cov_3eiEp1iCAUM1okIweRgSmw.s['71']++;this.set('groups',this.get('groups'));},destructor:function(){__cov_3eiEp1iCAUM1okIweRgSmw.f['20']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['72']++;DDM._unregTarget(this);__cov_3eiEp1iCAUM1okIweRgSmw.s['73']++;if((__cov_3eiEp1iCAUM1okIweRgSmw.b['10'][0]++,this.shim)&&(__cov_3eiEp1iCAUM1okIweRgSmw.b['10'][1]++,this.shim!==this.get(NODE))){__cov_3eiEp1iCAUM1okIweRgSmw.b['9'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['74']++;this.shim.detachAll();__cov_3eiEp1iCAUM1okIweRgSmw.s['75']++;this.shim.remove();__cov_3eiEp1iCAUM1okIweRgSmw.s['76']++;this.shim=null;}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['9'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['77']++;this.get(NODE).removeClass(DDM.CSS_PREFIX+'-drop');__cov_3eiEp1iCAUM1okIweRgSmw.s['78']++;this.detachAll();},_deactivateShim:function(){__cov_3eiEp1iCAUM1okIweRgSmw.f['21']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['79']++;if(!this.shim){__cov_3eiEp1iCAUM1okIweRgSmw.b['11'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['80']++;return false;}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['11'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['81']++;this.get(NODE).removeClass(DDM.CSS_PREFIX+'-drop-active-valid');__cov_3eiEp1iCAUM1okIweRgSmw.s['82']++;this.get(NODE).removeClass(DDM.CSS_PREFIX+'-drop-active-invalid');__cov_3eiEp1iCAUM1okIweRgSmw.s['83']++;this.get(NODE).removeClass(DDM.CSS_PREFIX+'-drop-over');__cov_3eiEp1iCAUM1okIweRgSmw.s['84']++;if(this.get('useShim')){__cov_3eiEp1iCAUM1okIweRgSmw.b['12'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['85']++;this.shim.setStyles({top:'-999px',left:'-999px',zIndex:'1'});}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['12'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['86']++;this.overTarget=false;},_activateShim:function(){__cov_3eiEp1iCAUM1okIweRgSmw.f['22']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['87']++;if(!DDM.activeDrag){__cov_3eiEp1iCAUM1okIweRgSmw.b['13'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['88']++;return false;}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['13'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['89']++;if(this.get(NODE)===DDM.activeDrag.get(NODE)){__cov_3eiEp1iCAUM1okIweRgSmw.b['14'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['90']++;return false;}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['14'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['91']++;if(this.get('lock')){__cov_3eiEp1iCAUM1okIweRgSmw.b['15'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['92']++;return false;}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['15'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['93']++;var node=this.get(NODE);__cov_3eiEp1iCAUM1okIweRgSmw.s['94']++;if(this.inGroup(DDM.activeDrag.get('groups'))){__cov_3eiEp1iCAUM1okIweRgSmw.b['16'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['95']++;node.removeClass(DDM.CSS_PREFIX+'-drop-active-invalid');__cov_3eiEp1iCAUM1okIweRgSmw.s['96']++;node.addClass(DDM.CSS_PREFIX+'-drop-active-valid');__cov_3eiEp1iCAUM1okIweRgSmw.s['97']++;DDM._addValid(this);__cov_3eiEp1iCAUM1okIweRgSmw.s['98']++;this.overTarget=false;__cov_3eiEp1iCAUM1okIweRgSmw.s['99']++;if(!this.get('useShim')){__cov_3eiEp1iCAUM1okIweRgSmw.b['17'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['100']++;this.shim=this.get(NODE);}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['17'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['101']++;this.sizeShim();}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['16'][1]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['102']++;DDM._removeValid(this);__cov_3eiEp1iCAUM1okIweRgSmw.s['103']++;node.removeClass(DDM.CSS_PREFIX+'-drop-active-valid');__cov_3eiEp1iCAUM1okIweRgSmw.s['104']++;node.addClass(DDM.CSS_PREFIX+'-drop-active-invalid');}},sizeShim:function(){__cov_3eiEp1iCAUM1okIweRgSmw.f['23']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['105']++;if(!DDM.activeDrag){__cov_3eiEp1iCAUM1okIweRgSmw.b['18'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['106']++;return false;}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['18'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['107']++;if(this.get(NODE)===DDM.activeDrag.get(NODE)){__cov_3eiEp1iCAUM1okIweRgSmw.b['19'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['108']++;return false;}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['19'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['109']++;if(this.get('lock')){__cov_3eiEp1iCAUM1okIweRgSmw.b['20'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['110']++;return false;}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['20'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['111']++;if(!this.shim){__cov_3eiEp1iCAUM1okIweRgSmw.b['21'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['112']++;Y.later(100,this,this.sizeShim);__cov_3eiEp1iCAUM1okIweRgSmw.s['113']++;return false;}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['21'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['114']++;var node=this.get(NODE),nh=node.get(OFFSET_HEIGHT),nw=node.get(OFFSET_WIDTH),xy=node.getXY(),p=this.get('padding'),dd,dH,dW;__cov_3eiEp1iCAUM1okIweRgSmw.s['115']++;nw=nw+p.left+p.right;__cov_3eiEp1iCAUM1okIweRgSmw.s['116']++;nh=nh+p.top+p.bottom;__cov_3eiEp1iCAUM1okIweRgSmw.s['117']++;xy[0]=xy[0]-p.left;__cov_3eiEp1iCAUM1okIweRgSmw.s['118']++;xy[1]=xy[1]-p.top;__cov_3eiEp1iCAUM1okIweRgSmw.s['119']++;if(DDM.activeDrag.get('dragMode')===DDM.INTERSECT){__cov_3eiEp1iCAUM1okIweRgSmw.b['22'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['120']++;dd=DDM.activeDrag;__cov_3eiEp1iCAUM1okIweRgSmw.s['121']++;dH=dd.get(NODE).get(OFFSET_HEIGHT);__cov_3eiEp1iCAUM1okIweRgSmw.s['122']++;dW=dd.get(NODE).get(OFFSET_WIDTH);__cov_3eiEp1iCAUM1okIweRgSmw.s['123']++;nh=nh+dH;__cov_3eiEp1iCAUM1okIweRgSmw.s['124']++;nw=nw+dW;__cov_3eiEp1iCAUM1okIweRgSmw.s['125']++;xy[0]=xy[0]-(dW-dd.deltaXY[0]);__cov_3eiEp1iCAUM1okIweRgSmw.s['126']++;xy[1]=xy[1]-(dH-dd.deltaXY[1]);}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['22'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['127']++;if(this.get('useShim')){__cov_3eiEp1iCAUM1okIweRgSmw.b['23'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['128']++;this.shim.setStyles({height:nh+'px',width:nw+'px',top:xy[1]+'px',left:xy[0]+'px'});}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['23'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['129']++;this.region={'0':xy[0],'1':xy[1],area:0,top:xy[1],right:xy[0]+nw,bottom:xy[1]+nh,left:xy[0]};},_handleTargetOver:function(){__cov_3eiEp1iCAUM1okIweRgSmw.f['24']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['130']++;if(DDM.isOverTarget(this)){__cov_3eiEp1iCAUM1okIweRgSmw.b['24'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['131']++;this.get(NODE).addClass(DDM.CSS_PREFIX+'-drop-over');__cov_3eiEp1iCAUM1okIweRgSmw.s['132']++;DDM.activeDrop=this;__cov_3eiEp1iCAUM1okIweRgSmw.s['133']++;DDM.otherDrops[this]=this;__cov_3eiEp1iCAUM1okIweRgSmw.s['134']++;if(this.overTarget){__cov_3eiEp1iCAUM1okIweRgSmw.b['25'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['135']++;DDM.activeDrag.fire('drag:over',{drop:this,drag:DDM.activeDrag});__cov_3eiEp1iCAUM1okIweRgSmw.s['136']++;this.fire(EV_DROP_OVER,{drop:this,drag:DDM.activeDrag});}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['25'][1]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['137']++;if(DDM.activeDrag.get('dragging')){__cov_3eiEp1iCAUM1okIweRgSmw.b['26'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['138']++;this.overTarget=true;__cov_3eiEp1iCAUM1okIweRgSmw.s['139']++;this.fire(EV_DROP_ENTER,{drop:this,drag:DDM.activeDrag});__cov_3eiEp1iCAUM1okIweRgSmw.s['140']++;DDM.activeDrag.fire('drag:enter',{drop:this,drag:DDM.activeDrag});__cov_3eiEp1iCAUM1okIweRgSmw.s['141']++;DDM.activeDrag.get(NODE).addClass(DDM.CSS_PREFIX+'-drag-over');}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['26'][1]++;}}}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['24'][1]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['142']++;this._handleOut();}},_handleOverEvent:function(){__cov_3eiEp1iCAUM1okIweRgSmw.f['25']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['143']++;this.shim.setStyle('zIndex','999');__cov_3eiEp1iCAUM1okIweRgSmw.s['144']++;DDM._addActiveShim(this);},_handleOutEvent:function(){__cov_3eiEp1iCAUM1okIweRgSmw.f['26']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['145']++;this.shim.setStyle('zIndex','1');__cov_3eiEp1iCAUM1okIweRgSmw.s['146']++;DDM._removeActiveShim(this);},_handleOut:function(force){__cov_3eiEp1iCAUM1okIweRgSmw.f['27']++;__cov_3eiEp1iCAUM1okIweRgSmw.s['147']++;if((__cov_3eiEp1iCAUM1okIweRgSmw.b['28'][0]++,!DDM.isOverTarget(this))||(__cov_3eiEp1iCAUM1okIweRgSmw.b['28'][1]++,force)){__cov_3eiEp1iCAUM1okIweRgSmw.b['27'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['148']++;if(this.overTarget){__cov_3eiEp1iCAUM1okIweRgSmw.b['29'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['149']++;this.overTarget=false;__cov_3eiEp1iCAUM1okIweRgSmw.s['150']++;if(!force){__cov_3eiEp1iCAUM1okIweRgSmw.b['30'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['151']++;DDM._removeActiveShim(this);}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['30'][1]++;}__cov_3eiEp1iCAUM1okIweRgSmw.s['152']++;if(DDM.activeDrag){__cov_3eiEp1iCAUM1okIweRgSmw.b['31'][0]++;__cov_3eiEp1iCAUM1okIweRgSmw.s['153']++;this.get(NODE).removeClass(DDM.CSS_PREFIX+'-drop-over');__cov_3eiEp1iCAUM1okIweRgSmw.s['154']++;DDM.activeDrag.get(NODE).removeClass(DDM.CSS_PREFIX+'-drag-over');__cov_3eiEp1iCAUM1okIweRgSmw.s['155']++;this.fire(EV_DROP_EXIT,{drop:this,drag:DDM.activeDrag});__cov_3eiEp1iCAUM1okIweRgSmw.s['156']++;DDM.activeDrag.fire('drag:exit',{drop:this,drag:DDM.activeDrag});__cov_3eiEp1iCAUM1okIweRgSmw.s['157']++;delete DDM.otherDrops[this];}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['31'][1]++;}}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['29'][1]++;}}else{__cov_3eiEp1iCAUM1okIweRgSmw.b['27'][1]++;}}});__cov_3eiEp1iCAUM1okIweRgSmw.s['158']++;Y.DD.Drop=Drop;},'@VERSION@',{'requires':['dd-drag','dd-ddm-drop']}); diff --git a/src/build/dd-drop/dd-drop-debug.js b/src/build/dd-drop/dd-drop-debug.js new file mode 100644 index 00000000000..c821d64447e --- /dev/null +++ b/src/build/dd-drop/dd-drop-debug.js @@ -0,0 +1,565 @@ +YUI.add('dd-drop', function (Y, NAME) { + + + /** + * Provides the ability to create a Drop Target. + * @module dd + * @submodule dd-drop + */ + /** + * Provides the ability to create a Drop Target. + * @class Drop + * @extends Base + * @constructor + * @namespace DD + */ + + var NODE = 'node', + DDM = Y.DD.DDM, + OFFSET_HEIGHT = 'offsetHeight', + OFFSET_WIDTH = 'offsetWidth', + /** + * Fires when a drag element is over this target. + * @event drop:over + * @param {EventFacade} event An Event Facade object with the following specific property added: + *
+ *
drop
The drop object at the time of the event.
+ *
drag
The drag object at the time of the event.
+ *
+ * @bubbles DDM + * @type {CustomEvent} + */ + EV_DROP_OVER = 'drop:over', + /** + * Fires when a drag element enters this target. + * @event drop:enter + * @param {EventFacade} event An Event Facade object with the following specific property added: + *
+ *
drop
The drop object at the time of the event.
+ *
drag
The drag object at the time of the event.
+ *
+ * @bubbles DDM + * @type {CustomEvent} + */ + EV_DROP_ENTER = 'drop:enter', + /** + * Fires when a drag element exits this target. + * @event drop:exit + * @param {EventFacade} event An Event Facade object + * @bubbles DDM + * @type {CustomEvent} + */ + EV_DROP_EXIT = 'drop:exit', + + /** + * Fires when a draggable node is dropped on this Drop Target. (Fired from dd-ddm-drop) + * @event drop:hit + * @param {EventFacade} event An Event Facade object with the following specific property added: + *
+ *
drop
The best guess on what was dropped on.
+ *
drag
The drag object at the time of the event.
+ *
others
An array of all the other drop targets that was dropped on.
+ *
+ * @bubbles DDM + * @type {CustomEvent} + */ + + + Drop = function() { + this._lazyAddAttrs = false; + Drop.superclass.constructor.apply(this, arguments); + + + //DD init speed up. + // (GS) Causes errors. + // (GS) See: http://yuilibrary.com/trac-archive/tickets/2532985.html + // (GS) However, changing from async to sync + // (GS) will cause change propagation, so leave it alone + // (GS) until further investigation and thorough testing. + Y.on('domready', Y.bind(function() { + Y.later(100, this, Drop_createShim); + }, this)); + DDM._regTarget(this); + + /* TODO + if (Dom.getStyle(this.el, 'position') == 'fixed') { + Event.on(window, 'scroll', function() { + this.activateShim(); + }, this, true); + } + */ + }; + + Drop.NAME = 'drop'; + + Drop.ATTRS = { + /** + * Y.Node instance to use as the element to make a Drop Target + * @attribute node + * @type Node + */ + node: { + setter: function(node) { + var n = Y.one(node); + if (!n) { + Y.error('DD.Drop: Invalid Node Given: ' + node); + } + return n; + } + }, + /** + * Array of groups to add this drop into. + * @attribute groups + * @type Array + */ + groups: { + value: ['default'], + getter: function() { + if (!this._groups) { + this._groups = {}; + return []; + } + + return Y.Object.keys(this._groups); + }, + setter: function(g) { + this._groups = Y.Array.hash(g); + return g; + } + }, + /** + * CSS style padding to make the Drop Target bigger than the node. + * @attribute padding + * @type String + */ + padding: { + value: '0', + setter: function(p) { + return DDM.cssSizestoObject(p); + } + }, + /** + * Set to lock this drop element. + * @attribute lock + * @type Boolean + */ + lock: { + value: false, + setter: function(lock) { + if (lock) { + this.get(NODE).addClass(DDM.CSS_PREFIX + '-drop-locked'); + } else { + this.get(NODE).removeClass(DDM.CSS_PREFIX + '-drop-locked'); + } + return lock; + } + }, + /** + * Controls the default bubble parent for this Drop instance. Default: Y.DD.DDM. Set to false to disable bubbling. + * Use bubbleTargets in config. + * @deprecated + * @attribute bubbles + * @type Object + */ + bubbles: { + setter: function(t) { + Y.log('bubbles is deprecated use bubbleTargets: HOST', 'warn', 'dd'); + this.addTarget(t); + return t; + } + }, + /** + * Use the Drop shim. Default: true + * @deprecated + * @attribute useShim + * @type Boolean + */ + useShim: { + value: true, + setter: function(v) { + Y.DD.DDM._noShim = !v; + return v; + } + } + }; + + function Drop_createShim() { + //No playground, defer + if (!DDM._pg) { + Y.later(10, this, Drop_createShim); + return; + } + if (this.shim) return; + + var s = this.get('node'); + + if (this.get('useShim')) { + s = createShimNode(s); + } + this.shim = s; + } + + function createShimNode(s) { + var s, id; + try { + id = s.get("id"); + } catch(ex) { + // _stateProxy is null, TypeError thrown getting + // _stateProxy[id]. + // See: http://yuilibrary.com/trac-archive/tickets/2532985.html + return; + } + + s = Y.Node.create('
'); + s.setStyles({ + height: this.get(NODE).get(OFFSET_HEIGHT) + 'px', + width: this.get(NODE).get(OFFSET_WIDTH) + 'px', + backgroundColor: 'yellow', + opacity: '.5', + zIndex: '1', + overflow: 'hidden', + top: '-900px', + left: '-900px', + position: 'absolute' + }); + DDM._pg.appendChild(s); + + s.on('mouseover', Y.bind(this._handleOverEvent, this)); + s.on('mouseout', Y.bind(this._handleOutEvent, this)); + return s; + } + + Y.extend(Drop, Y.Base, { + /** + * The default bubbleTarget for this object. Default: Y.DD.DDM + * @private + * @property _bubbleTargets + */ + _bubbleTargets: Y.DD.DDM, + /** + * Add this Drop instance to a group, this should be used for on-the-fly group additions. + * @method addToGroup + * @param {String} g The group to add this Drop Instance to. + * @chainable + */ + addToGroup: function(g) { + this._groups[g] = true; + return this; + }, + /** + * Remove this Drop instance from a group, this should be used for on-the-fly group removals. + * @method removeFromGroup + * @param {String} g The group to remove this Drop Instance from. + * @chainable + */ + removeFromGroup: function(g) { + delete this._groups[g]; + return this; + }, + /** + * This method creates all the events for this Event Target and publishes them so we get Event Bubbling. + * @private + * @method _createEvents + */ + _createEvents: function() { + + var ev = [ + EV_DROP_OVER, + EV_DROP_ENTER, + EV_DROP_EXIT, + 'drop:hit' + ]; + + Y.Array.each(ev, function(v) { + this.publish(v, { + type: v, + emitFacade: true, + preventable: false, + bubbles: true, + queuable: false, + prefix: 'drop' + }); + }, this); + }, + /** + * Flag for determining if the target is valid in this operation. + * @private + * @property _valid + * @type Boolean + */ + _valid: null, + /** + * The groups this target belongs to. + * @private + * @property _groups + * @type Array + */ + _groups: null, + /** + * Node reference to the targets shim + * @property shim + * @type {Object} + */ + shim: null, + /** + * A region object associated with this target, used for checking regions while dragging. + * @property region + * @type Object + */ + region: null, + /** + * This flag is tripped when a drag element is over this target. + * @property overTarget + * @type Boolean + */ + overTarget: null, + /** + * Check if this target is in one of the supplied groups. + * @method inGroup + * @param {Array} groups The groups to check against + * @return Boolean + */ + inGroup: function(groups) { + this._valid = false; + var ret = false; + Y.Array.each(groups, function(v) { + if (this._groups[v]) { + ret = true; + this._valid = true; + } + }, this); + return ret; + }, + /** + * Private lifecycle method + * @private + * @method initializer + */ + initializer: function() { + Y.later(100, this, this._createEvents); + + var node = this.get(NODE), id; + if (!node.get('id')) { + id = Y.stamp(node); + node.set('id', id); + } + node.addClass(DDM.CSS_PREFIX + '-drop'); + //Shouldn't have to do this.. + this.set('groups', this.get('groups')); + }, + /** + * Lifecycle destructor, unreg the drag from the DDM and remove listeners + * @private + * @method destructor + */ + destructor: function() { + DDM._unregTarget(this); + if (this.shim && (this.shim !== this.get(NODE))) { + this.shim.detachAll(); + this.shim.remove(); + this.shim = null; + } + this.get(NODE).removeClass(DDM.CSS_PREFIX + '-drop'); + this.detachAll(); + }, + /** + * Removes classes from the target, resets some flags and sets the shims deactive position [-999, -999] + * @private + * @method _deactivateShim + */ + _deactivateShim: function() { + if (!this.shim) { + return false; + } + this.get(NODE).removeClass(DDM.CSS_PREFIX + '-drop-active-valid'); + this.get(NODE).removeClass(DDM.CSS_PREFIX + '-drop-active-invalid'); + this.get(NODE).removeClass(DDM.CSS_PREFIX + '-drop-over'); + + if (this.get('useShim')) { + this.shim.setStyles({ + top: '-999px', + left: '-999px', + zIndex: '1' + }); + } + this.overTarget = false; + }, + /** + * Activates the shim and adds some interaction CSS classes + * @private + * @method _activateShim + */ + _activateShim: function() { + if (!DDM.activeDrag) { + return false; //Nothing is dragging, no reason to activate. + } + if (this.get(NODE) === DDM.activeDrag.get(NODE)) { + return false; + } + if (this.get('lock')) { + return false; + } + var node = this.get(NODE); + //TODO Visibility Check.. + //if (this.inGroup(DDM.activeDrag.get('groups')) && this.get(NODE).isVisible()) { + if (this.inGroup(DDM.activeDrag.get('groups'))) { + node.removeClass(DDM.CSS_PREFIX + '-drop-active-invalid'); + node.addClass(DDM.CSS_PREFIX + '-drop-active-valid'); + DDM._addValid(this); + this.overTarget = false; + if (!this.get('useShim')) { + this.shim = this.get(NODE); + } + this.sizeShim(); + } else { + DDM._removeValid(this); + node.removeClass(DDM.CSS_PREFIX + '-drop-active-valid'); + node.addClass(DDM.CSS_PREFIX + '-drop-active-invalid'); + } + }, + /** + * Positions and sizes the shim with the raw data from the node, + * this can be used to programatically adjust the Targets shim for Animation.. + * @method sizeShim + */ + sizeShim: function() { + if (!DDM.activeDrag) { + return false; //Nothing is dragging, no reason to activate. + } + if (this.get(NODE) === DDM.activeDrag.get(NODE)) { + return false; + } + //if (this.get('lock') || !this.get('useShim')) { + if (this.get('lock')) { + return false; + } + if (!this.shim) { + Y.later(100, this, this.sizeShim); + return false; + } + var node = this.get(NODE), + nh = node.get(OFFSET_HEIGHT), + nw = node.get(OFFSET_WIDTH), + xy = node.getXY(), + p = this.get('padding'), + dd, dH, dW; + + + //Apply padding + nw = nw + p.left + p.right; + nh = nh + p.top + p.bottom; + xy[0] = xy[0] - p.left; + xy[1] = xy[1] - p.top; + + + if (DDM.activeDrag.get('dragMode') === DDM.INTERSECT) { + //Intersect Mode, make the shim bigger + dd = DDM.activeDrag; + dH = dd.get(NODE).get(OFFSET_HEIGHT); + dW = dd.get(NODE).get(OFFSET_WIDTH); + + nh = (nh + dH); + nw = (nw + dW); + xy[0] = xy[0] - (dW - dd.deltaXY[0]); + xy[1] = xy[1] - (dH - dd.deltaXY[1]); + + } + + if (this.get('useShim')) { + //Set the style on the shim + this.shim.setStyles({ + height: nh + 'px', + width: nw + 'px', + top: xy[1] + 'px', + left: xy[0] + 'px' + }); + } + + //Create the region to be used by intersect when a drag node is over us. + this.region = { + '0': xy[0], + '1': xy[1], + area: 0, + top: xy[1], + right: xy[0] + nw, + bottom: xy[1] + nh, + left: xy[0] + }; + }, + + /** + * This handles the over target call made from this object or from the DDM + * @private + * @method _handleOverTarget + */ + _handleTargetOver: function() { + if (DDM.isOverTarget(this)) { + this.get(NODE).addClass(DDM.CSS_PREFIX + '-drop-over'); + DDM.activeDrop = this; + DDM.otherDrops[this] = this; + if (this.overTarget) { + DDM.activeDrag.fire('drag:over', { drop: this, drag: DDM.activeDrag }); + this.fire(EV_DROP_OVER, { drop: this, drag: DDM.activeDrag }); + } else { + //Prevent an enter before a start.. + if (DDM.activeDrag.get('dragging')) { + this.overTarget = true; + this.fire(EV_DROP_ENTER, { drop: this, drag: DDM.activeDrag }); + DDM.activeDrag.fire('drag:enter', { drop: this, drag: DDM.activeDrag }); + DDM.activeDrag.get(NODE).addClass(DDM.CSS_PREFIX + '-drag-over'); + //TODO - Is this needed?? + //DDM._handleTargetOver(); + } + } + } else { + this._handleOut(); + } + }, + /** + * Handles the mouseover DOM event on the Target Shim + * @private + * @method _handleOverEvent + */ + _handleOverEvent: function() { + this.shim.setStyle('zIndex', '999'); + DDM._addActiveShim(this); + }, + /** + * Handles the mouseout DOM event on the Target Shim + * @private + * @method _handleOutEvent + */ + _handleOutEvent: function() { + this.shim.setStyle('zIndex', '1'); + DDM._removeActiveShim(this); + }, + /** + * Handles out of target calls/checks + * @private + * @method _handleOut + */ + _handleOut: function(force) { + if (!DDM.isOverTarget(this) || force) { + if (this.overTarget) { + this.overTarget = false; + if (!force) { + DDM._removeActiveShim(this); + } + if (DDM.activeDrag) { + this.get(NODE).removeClass(DDM.CSS_PREFIX + '-drop-over'); + DDM.activeDrag.get(NODE).removeClass(DDM.CSS_PREFIX + '-drag-over'); + this.fire(EV_DROP_EXIT, { drop: this, drag: DDM.activeDrag }); + DDM.activeDrag.fire('drag:exit', { drop: this, drag: DDM.activeDrag }); + delete DDM.otherDrops[this]; + } + } + } + } + }); + + Y.DD.Drop = Drop; + + + + +}, '@VERSION@', {"requires": ["dd-drag", "dd-ddm-drop"]}); diff --git a/src/build/dd-drop/dd-drop-min.js b/src/build/dd-drop/dd-drop-min.js new file mode 100644 index 00000000000..c2137f6c64d --- /dev/null +++ b/src/build/dd-drop/dd-drop-min.js @@ -0,0 +1 @@ +YUI.add("dd-drop",function(e,t){function l(){if(!r._pg){e.later(10,this,l);return}if(this.shim)return;var t=this.get("node");this.get("useShim")&&(t=c(t)),this.shim=t}function c(t){var t,o;try{o=t.get("id")}catch(u){return}return t=e.Node.create('
'),t.setStyles({height:this.get(n).get(i)+"px",width:this.get(n).get(s)+"px",backgroundColor:"yellow",opacity:".5",zIndex:"1",overflow:"hidden",top:"-900px",left:"-900px",position:"absolute"}),r._pg.appendChild(t),t.on("mouseover",e.bind(this._handleOverEvent,this)),t.on("mouseout",e.bind(this._handleOutEvent,this)),t}var n="node",r=e.DD.DDM,i="offsetHeight",s="offsetWidth",o="drop:over",u="drop:enter",a="drop:exit",f=function(){this._lazyAddAttrs=!1,f.superclass.constructor.apply(this,arguments),e.on("domready",e.bind(function(){e.later(100,this,l)},this)),r._regTarget(this)};f.NAME="drop",f.ATTRS={node:{setter:function(t){var n=e.one(t);return n||e.error("DD.Drop: Invalid Node Given: "+t),n}},groups:{value:["default"],getter:function(){return this._groups?e.Object.keys(this._groups):(this._groups={},[])},setter:function(t){return this._groups=e.Array.hash(t),t}},padding:{value:"0",setter:function(e){return r.cssSizestoObject(e)}},lock:{value:!1,setter:function(e){return e?this.get(n).addClass(r.CSS_PREFIX+"-drop-locked"):this.get(n).removeClass(r.CSS_PREFIX+"-drop-locked"),e}},bubbles:{setter:function(e){return this.addTarget(e),e}},useShim:{value:!0,setter:function(t){return e.DD.DDM._noShim=!t,t}}},e.extend(f,e.Base,{_bubbleTargets:e.DD.DDM,addToGroup:function(e){return this._groups[e]=!0,this},removeFromGroup:function(e){return delete this._groups[e],this},_createEvents:function(){var t=[o,u,a,"drop:hit"];e.Array.each(t,function(e){this.publish(e,{type:e,emitFacade:!0,preventable:!1,bubbles:!0,queuable:!1,prefix:"drop"})},this)},_valid:null,_groups:null,shim:null,region:null,overTarget:null,inGroup:function(t){this._valid=!1;var n=!1;return e.Array.each(t,function(e){this._groups[e]&&(n=!0,this._valid=!0)},this),n},initializer:function(){e.later(100,this,this._createEvents);var t=this.get(n),i;t.get("id")||(i=e.stamp(t),t.set("id",i)),t.addClass(r.CSS_PREFIX+"-drop"),this.set("groups",this.get("groups"))},destructor:function(){r._unregTarget(this),this.shim&&this.shim!==this.get(n)&&(this.shim.detachAll(),this.shim.remove(),this.shim=null),this.get(n).removeClass(r.CSS_PREFIX+"-drop"),this.detachAll()},_deactivateShim:function(){if(!this.shim)return!1;this.get(n).removeClass(r.CSS_PREFIX+"-drop-active-valid"),this.get(n).removeClass(r.CSS_PREFIX+"-drop-active-invalid"),this.get(n).removeClass(r.CSS_PREFIX+"-drop-over"),this.get("useShim")&&this.shim.setStyles({top:"-999px",left:"-999px",zIndex:"1"}),this.overTarget=!1},_activateShim:function(){if(!r.activeDrag)return!1;if(this.get(n)===r.activeDrag.get(n))return!1;if(this.get("lock"))return!1;var e=this.get(n);this.inGroup(r.activeDrag.get("groups"))?(e.removeClass(r.CSS_PREFIX+"-drop-active-invalid"),e.addClass(r.CSS_PREFIX+"-drop-active-valid"),r._addValid(this),this.overTarget=!1,this.get("useShim")||(this.shim=this.get(n)),this.sizeShim()):(r._removeValid(this),e.removeClass(r.CSS_PREFIX+"-drop-active-valid"),e.addClass(r.CSS_PREFIX+"-drop-active-invalid"))},sizeShim:function(){if(!r.activeDrag)return!1;if(this.get(n)===r.activeDrag.get(n))return!1;if(this.get("lock"))return!1;if(!this.shim)return e.later(100,this,this.sizeShim),!1;var t=this.get(n),o=t.get(i),u=t.get(s),a=t.getXY(),f=this.get("padding"),l,c,h;u=u+f.left+f.right,o=o+f.top+f.bottom,a[0]=a[0]-f.left,a[1]=a[1]-f.top,r.activeDrag.get("dragMode")===r.INTERSECT&&(l=r.activeDrag,c=l.get(n).get(i),h=l.get(n).get(s),o+=c,u+=h,a[0]=a[0]-(h-l.deltaXY[0]),a[1]=a[1]-(c-l.deltaXY[1])),this.get("useShim")&&this.shim.setStyles({height:o+"px",width:u+"px",top:a[1]+"px",left:a[0]+"px"}),this.region={0:a[0],1:a[1],area:0,top:a[1],right:a[0]+u,bottom:a[1]+o,left:a[0]}},_handleTargetOver:function(){r.isOverTarget(this)?(this.get(n).addClass(r.CSS_PREFIX+"-drop-over"),r.activeDrop=this,r.otherDrops[this]=this,this.overTarget?(r.activeDrag.fire("drag:over",{drop:this,drag:r.activeDrag}),this.fire(o,{drop:this,drag:r.activeDrag})):r.activeDrag.get("dragging")&&(this.overTarget=!0,this.fire(u,{drop:this,drag:r.activeDrag}),r.activeDrag.fire("drag:enter",{drop:this,drag:r.activeDrag}),r.activeDrag.get(n).addClass(r.CSS_PREFIX+"-drag-over"))):this._handleOut()},_handleOverEvent:function(){this.shim.setStyle("zIndex","999"),r._addActiveShim(this)},_handleOutEvent:function(){this.shim.setStyle("zIndex","1"),r._removeActiveShim(this)},_handleOut:function(e){(!r.isOverTarget(this)||e)&&this.overTarget&&(this.overTarget=!1,e||r._removeActiveShim(this),r.activeDrag&&(this.get(n).removeClass(r.CSS_PREFIX+"-drop-over"),r.activeDrag.get(n).removeClass(r.CSS_PREFIX+"-drag-over"),this.fire(a,{drop:this,drag:r.activeDrag}),r.activeDrag.fire("drag:exit",{drop:this,drag:r.activeDrag}),delete r.otherDrops[this]))}}),e.DD.Drop=f},"@VERSION@",{requires:["dd-drag","dd-ddm-drop"]}); diff --git a/src/build/dd-drop/dd-drop.js b/src/build/dd-drop/dd-drop.js new file mode 100644 index 00000000000..22f584bf475 --- /dev/null +++ b/src/build/dd-drop/dd-drop.js @@ -0,0 +1,564 @@ +YUI.add('dd-drop', function (Y, NAME) { + + + /** + * Provides the ability to create a Drop Target. + * @module dd + * @submodule dd-drop + */ + /** + * Provides the ability to create a Drop Target. + * @class Drop + * @extends Base + * @constructor + * @namespace DD + */ + + var NODE = 'node', + DDM = Y.DD.DDM, + OFFSET_HEIGHT = 'offsetHeight', + OFFSET_WIDTH = 'offsetWidth', + /** + * Fires when a drag element is over this target. + * @event drop:over + * @param {EventFacade} event An Event Facade object with the following specific property added: + *
+ *
drop
The drop object at the time of the event.
+ *
drag
The drag object at the time of the event.
+ *
+ * @bubbles DDM + * @type {CustomEvent} + */ + EV_DROP_OVER = 'drop:over', + /** + * Fires when a drag element enters this target. + * @event drop:enter + * @param {EventFacade} event An Event Facade object with the following specific property added: + *
+ *
drop
The drop object at the time of the event.
+ *
drag
The drag object at the time of the event.
+ *
+ * @bubbles DDM + * @type {CustomEvent} + */ + EV_DROP_ENTER = 'drop:enter', + /** + * Fires when a drag element exits this target. + * @event drop:exit + * @param {EventFacade} event An Event Facade object + * @bubbles DDM + * @type {CustomEvent} + */ + EV_DROP_EXIT = 'drop:exit', + + /** + * Fires when a draggable node is dropped on this Drop Target. (Fired from dd-ddm-drop) + * @event drop:hit + * @param {EventFacade} event An Event Facade object with the following specific property added: + *
+ *
drop
The best guess on what was dropped on.
+ *
drag
The drag object at the time of the event.
+ *
others
An array of all the other drop targets that was dropped on.
+ *
+ * @bubbles DDM + * @type {CustomEvent} + */ + + + Drop = function() { + this._lazyAddAttrs = false; + Drop.superclass.constructor.apply(this, arguments); + + + //DD init speed up. + // (GS) Causes errors. + // (GS) See: http://yuilibrary.com/trac-archive/tickets/2532985.html + // (GS) However, changing from async to sync + // (GS) will cause change propagation, so leave it alone + // (GS) until further investigation and thorough testing. + Y.on('domready', Y.bind(function() { + Y.later(100, this, Drop_createShim); + }, this)); + DDM._regTarget(this); + + /* TODO + if (Dom.getStyle(this.el, 'position') == 'fixed') { + Event.on(window, 'scroll', function() { + this.activateShim(); + }, this, true); + } + */ + }; + + Drop.NAME = 'drop'; + + Drop.ATTRS = { + /** + * Y.Node instance to use as the element to make a Drop Target + * @attribute node + * @type Node + */ + node: { + setter: function(node) { + var n = Y.one(node); + if (!n) { + Y.error('DD.Drop: Invalid Node Given: ' + node); + } + return n; + } + }, + /** + * Array of groups to add this drop into. + * @attribute groups + * @type Array + */ + groups: { + value: ['default'], + getter: function() { + if (!this._groups) { + this._groups = {}; + return []; + } + + return Y.Object.keys(this._groups); + }, + setter: function(g) { + this._groups = Y.Array.hash(g); + return g; + } + }, + /** + * CSS style padding to make the Drop Target bigger than the node. + * @attribute padding + * @type String + */ + padding: { + value: '0', + setter: function(p) { + return DDM.cssSizestoObject(p); + } + }, + /** + * Set to lock this drop element. + * @attribute lock + * @type Boolean + */ + lock: { + value: false, + setter: function(lock) { + if (lock) { + this.get(NODE).addClass(DDM.CSS_PREFIX + '-drop-locked'); + } else { + this.get(NODE).removeClass(DDM.CSS_PREFIX + '-drop-locked'); + } + return lock; + } + }, + /** + * Controls the default bubble parent for this Drop instance. Default: Y.DD.DDM. Set to false to disable bubbling. + * Use bubbleTargets in config. + * @deprecated + * @attribute bubbles + * @type Object + */ + bubbles: { + setter: function(t) { + this.addTarget(t); + return t; + } + }, + /** + * Use the Drop shim. Default: true + * @deprecated + * @attribute useShim + * @type Boolean + */ + useShim: { + value: true, + setter: function(v) { + Y.DD.DDM._noShim = !v; + return v; + } + } + }; + + function Drop_createShim() { + //No playground, defer + if (!DDM._pg) { + Y.later(10, this, Drop_createShim); + return; + } + if (this.shim) return; + + var s = this.get('node'); + + if (this.get('useShim')) { + s = createShimNode(s); + } + this.shim = s; + } + + function createShimNode(s) { + var s, id; + try { + id = s.get("id"); + } catch(ex) { + // _stateProxy is null, TypeError thrown getting + // _stateProxy[id]. + // See: http://yuilibrary.com/trac-archive/tickets/2532985.html + return; + } + + s = Y.Node.create('
'); + s.setStyles({ + height: this.get(NODE).get(OFFSET_HEIGHT) + 'px', + width: this.get(NODE).get(OFFSET_WIDTH) + 'px', + backgroundColor: 'yellow', + opacity: '.5', + zIndex: '1', + overflow: 'hidden', + top: '-900px', + left: '-900px', + position: 'absolute' + }); + DDM._pg.appendChild(s); + + s.on('mouseover', Y.bind(this._handleOverEvent, this)); + s.on('mouseout', Y.bind(this._handleOutEvent, this)); + return s; + } + + Y.extend(Drop, Y.Base, { + /** + * The default bubbleTarget for this object. Default: Y.DD.DDM + * @private + * @property _bubbleTargets + */ + _bubbleTargets: Y.DD.DDM, + /** + * Add this Drop instance to a group, this should be used for on-the-fly group additions. + * @method addToGroup + * @param {String} g The group to add this Drop Instance to. + * @chainable + */ + addToGroup: function(g) { + this._groups[g] = true; + return this; + }, + /** + * Remove this Drop instance from a group, this should be used for on-the-fly group removals. + * @method removeFromGroup + * @param {String} g The group to remove this Drop Instance from. + * @chainable + */ + removeFromGroup: function(g) { + delete this._groups[g]; + return this; + }, + /** + * This method creates all the events for this Event Target and publishes them so we get Event Bubbling. + * @private + * @method _createEvents + */ + _createEvents: function() { + + var ev = [ + EV_DROP_OVER, + EV_DROP_ENTER, + EV_DROP_EXIT, + 'drop:hit' + ]; + + Y.Array.each(ev, function(v) { + this.publish(v, { + type: v, + emitFacade: true, + preventable: false, + bubbles: true, + queuable: false, + prefix: 'drop' + }); + }, this); + }, + /** + * Flag for determining if the target is valid in this operation. + * @private + * @property _valid + * @type Boolean + */ + _valid: null, + /** + * The groups this target belongs to. + * @private + * @property _groups + * @type Array + */ + _groups: null, + /** + * Node reference to the targets shim + * @property shim + * @type {Object} + */ + shim: null, + /** + * A region object associated with this target, used for checking regions while dragging. + * @property region + * @type Object + */ + region: null, + /** + * This flag is tripped when a drag element is over this target. + * @property overTarget + * @type Boolean + */ + overTarget: null, + /** + * Check if this target is in one of the supplied groups. + * @method inGroup + * @param {Array} groups The groups to check against + * @return Boolean + */ + inGroup: function(groups) { + this._valid = false; + var ret = false; + Y.Array.each(groups, function(v) { + if (this._groups[v]) { + ret = true; + this._valid = true; + } + }, this); + return ret; + }, + /** + * Private lifecycle method + * @private + * @method initializer + */ + initializer: function() { + Y.later(100, this, this._createEvents); + + var node = this.get(NODE), id; + if (!node.get('id')) { + id = Y.stamp(node); + node.set('id', id); + } + node.addClass(DDM.CSS_PREFIX + '-drop'); + //Shouldn't have to do this.. + this.set('groups', this.get('groups')); + }, + /** + * Lifecycle destructor, unreg the drag from the DDM and remove listeners + * @private + * @method destructor + */ + destructor: function() { + DDM._unregTarget(this); + if (this.shim && (this.shim !== this.get(NODE))) { + this.shim.detachAll(); + this.shim.remove(); + this.shim = null; + } + this.get(NODE).removeClass(DDM.CSS_PREFIX + '-drop'); + this.detachAll(); + }, + /** + * Removes classes from the target, resets some flags and sets the shims deactive position [-999, -999] + * @private + * @method _deactivateShim + */ + _deactivateShim: function() { + if (!this.shim) { + return false; + } + this.get(NODE).removeClass(DDM.CSS_PREFIX + '-drop-active-valid'); + this.get(NODE).removeClass(DDM.CSS_PREFIX + '-drop-active-invalid'); + this.get(NODE).removeClass(DDM.CSS_PREFIX + '-drop-over'); + + if (this.get('useShim')) { + this.shim.setStyles({ + top: '-999px', + left: '-999px', + zIndex: '1' + }); + } + this.overTarget = false; + }, + /** + * Activates the shim and adds some interaction CSS classes + * @private + * @method _activateShim + */ + _activateShim: function() { + if (!DDM.activeDrag) { + return false; //Nothing is dragging, no reason to activate. + } + if (this.get(NODE) === DDM.activeDrag.get(NODE)) { + return false; + } + if (this.get('lock')) { + return false; + } + var node = this.get(NODE); + //TODO Visibility Check.. + //if (this.inGroup(DDM.activeDrag.get('groups')) && this.get(NODE).isVisible()) { + if (this.inGroup(DDM.activeDrag.get('groups'))) { + node.removeClass(DDM.CSS_PREFIX + '-drop-active-invalid'); + node.addClass(DDM.CSS_PREFIX + '-drop-active-valid'); + DDM._addValid(this); + this.overTarget = false; + if (!this.get('useShim')) { + this.shim = this.get(NODE); + } + this.sizeShim(); + } else { + DDM._removeValid(this); + node.removeClass(DDM.CSS_PREFIX + '-drop-active-valid'); + node.addClass(DDM.CSS_PREFIX + '-drop-active-invalid'); + } + }, + /** + * Positions and sizes the shim with the raw data from the node, + * this can be used to programatically adjust the Targets shim for Animation.. + * @method sizeShim + */ + sizeShim: function() { + if (!DDM.activeDrag) { + return false; //Nothing is dragging, no reason to activate. + } + if (this.get(NODE) === DDM.activeDrag.get(NODE)) { + return false; + } + //if (this.get('lock') || !this.get('useShim')) { + if (this.get('lock')) { + return false; + } + if (!this.shim) { + Y.later(100, this, this.sizeShim); + return false; + } + var node = this.get(NODE), + nh = node.get(OFFSET_HEIGHT), + nw = node.get(OFFSET_WIDTH), + xy = node.getXY(), + p = this.get('padding'), + dd, dH, dW; + + + //Apply padding + nw = nw + p.left + p.right; + nh = nh + p.top + p.bottom; + xy[0] = xy[0] - p.left; + xy[1] = xy[1] - p.top; + + + if (DDM.activeDrag.get('dragMode') === DDM.INTERSECT) { + //Intersect Mode, make the shim bigger + dd = DDM.activeDrag; + dH = dd.get(NODE).get(OFFSET_HEIGHT); + dW = dd.get(NODE).get(OFFSET_WIDTH); + + nh = (nh + dH); + nw = (nw + dW); + xy[0] = xy[0] - (dW - dd.deltaXY[0]); + xy[1] = xy[1] - (dH - dd.deltaXY[1]); + + } + + if (this.get('useShim')) { + //Set the style on the shim + this.shim.setStyles({ + height: nh + 'px', + width: nw + 'px', + top: xy[1] + 'px', + left: xy[0] + 'px' + }); + } + + //Create the region to be used by intersect when a drag node is over us. + this.region = { + '0': xy[0], + '1': xy[1], + area: 0, + top: xy[1], + right: xy[0] + nw, + bottom: xy[1] + nh, + left: xy[0] + }; + }, + + /** + * This handles the over target call made from this object or from the DDM + * @private + * @method _handleOverTarget + */ + _handleTargetOver: function() { + if (DDM.isOverTarget(this)) { + this.get(NODE).addClass(DDM.CSS_PREFIX + '-drop-over'); + DDM.activeDrop = this; + DDM.otherDrops[this] = this; + if (this.overTarget) { + DDM.activeDrag.fire('drag:over', { drop: this, drag: DDM.activeDrag }); + this.fire(EV_DROP_OVER, { drop: this, drag: DDM.activeDrag }); + } else { + //Prevent an enter before a start.. + if (DDM.activeDrag.get('dragging')) { + this.overTarget = true; + this.fire(EV_DROP_ENTER, { drop: this, drag: DDM.activeDrag }); + DDM.activeDrag.fire('drag:enter', { drop: this, drag: DDM.activeDrag }); + DDM.activeDrag.get(NODE).addClass(DDM.CSS_PREFIX + '-drag-over'); + //TODO - Is this needed?? + //DDM._handleTargetOver(); + } + } + } else { + this._handleOut(); + } + }, + /** + * Handles the mouseover DOM event on the Target Shim + * @private + * @method _handleOverEvent + */ + _handleOverEvent: function() { + this.shim.setStyle('zIndex', '999'); + DDM._addActiveShim(this); + }, + /** + * Handles the mouseout DOM event on the Target Shim + * @private + * @method _handleOutEvent + */ + _handleOutEvent: function() { + this.shim.setStyle('zIndex', '1'); + DDM._removeActiveShim(this); + }, + /** + * Handles out of target calls/checks + * @private + * @method _handleOut + */ + _handleOut: function(force) { + if (!DDM.isOverTarget(this) || force) { + if (this.overTarget) { + this.overTarget = false; + if (!force) { + DDM._removeActiveShim(this); + } + if (DDM.activeDrag) { + this.get(NODE).removeClass(DDM.CSS_PREFIX + '-drop-over'); + DDM.activeDrag.get(NODE).removeClass(DDM.CSS_PREFIX + '-drag-over'); + this.fire(EV_DROP_EXIT, { drop: this, drag: DDM.activeDrag }); + DDM.activeDrag.fire('drag:exit', { drop: this, drag: DDM.activeDrag }); + delete DDM.otherDrops[this]; + } + } + } + } + }); + + Y.DD.Drop = Drop; + + + + +}, '@VERSION@', {"requires": ["dd-drag", "dd-ddm-drop"]}); diff --git a/src/build/dd-gestures/dd-gestures-coverage.js b/src/build/dd-gestures/dd-gestures-coverage.js new file mode 100644 index 00000000000..0bac2064c2b --- /dev/null +++ b/src/build/dd-gestures/dd-gestures-coverage.js @@ -0,0 +1,6 @@ +if (typeof __coverage__ === 'undefined') { __coverage__ = {}; } +if (!__coverage__['build/dd-gestures/dd-gestures.js']) { + __coverage__['build/dd-gestures/dd-gestures.js'] = {"path":"build/dd-gestures/dd-gestures.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0},"b":{},"f":{"1":0,"2":0,"3":0,"4":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":42}}},"2":{"name":"(anonymous_2)","line":18,"loc":{"start":{"line":18,"column":32},"end":{"line":18,"column":43}}},"3":{"name":"(anonymous_3)","line":37,"loc":{"start":{"line":37,"column":34},"end":{"line":37,"column":45}}},"4":{"name":"(anonymous_4)","line":43,"loc":{"start":{"line":43,"column":31},"end":{"line":43,"column":42}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":55,"column":80}},"2":{"start":{"line":16,"column":4},"end":{"line":16,"column":47}},"3":{"start":{"line":18,"column":4},"end":{"line":33,"column":6}},"4":{"start":{"line":19,"column":8},"end":{"line":19,"column":36}},"5":{"start":{"line":20,"column":8},"end":{"line":20,"column":52}},"6":{"start":{"line":22,"column":8},"end":{"line":22,"column":53}},"7":{"start":{"line":24,"column":8},"end":{"line":28,"column":11}},"8":{"start":{"line":30,"column":8},"end":{"line":30,"column":91}},"9":{"start":{"line":31,"column":8},"end":{"line":31,"column":63}},"10":{"start":{"line":35,"column":4},"end":{"line":35,"column":46}},"11":{"start":{"line":37,"column":4},"end":{"line":41,"column":6}},"12":{"start":{"line":38,"column":8},"end":{"line":38,"column":36}},"13":{"start":{"line":39,"column":8},"end":{"line":39,"column":27}},"14":{"start":{"line":40,"column":8},"end":{"line":40,"column":41}},"15":{"start":{"line":43,"column":4},"end":{"line":51,"column":6}},"16":{"start":{"line":44,"column":8},"end":{"line":44,"column":27}},"17":{"start":{"line":46,"column":8},"end":{"line":46,"column":25}},"18":{"start":{"line":47,"column":8},"end":{"line":47,"column":28}},"19":{"start":{"line":48,"column":8},"end":{"line":50,"column":11}}},"branchMap":{},"code":["(function () { YUI.add('dd-gestures', function (Y, NAME) {","",""," /**"," * This module is the conditional loaded `dd` module to support gesture events"," * in the event that `dd` is loaded onto a device that support touch based events."," *"," * This module is loaded and over rides 2 key methods on `DD.Drag` and `DD.DDM` to"," * attach the gesture events. Overrides `DD.Drag._prep` and `DD.DDM._setupListeners`"," * methods as well as set's the property `DD.Drag.START_EVENT` to `gesturemovestart`"," * to enable gesture movement instead of mouse based movement."," * @module dd"," * @submodule dd-gestures"," */",""," Y.DD.Drag.START_EVENT = 'gesturemovestart';",""," Y.DD.Drag.prototype._prep = function() {"," this._dragThreshMet = false;"," var node = this.get('node'), DDM = Y.DD.DDM;",""," node.addClass(DDM.CSS_PREFIX + '-draggable');",""," node.on(Y.DD.Drag.START_EVENT, Y.bind(this._handleMouseDownEvent, this), {"," minDistance: this.get('clickPixelThresh'),"," minTime: this.get('clickTimeThresh'),"," preventDefault: true"," });",""," node.on('gesturemoveend', Y.bind(this._handleMouseUp, this), { standAlone: true });"," node.on('dragstart', Y.bind(this._fixDragStart, this));",""," };",""," var _unprep = Y.DD.Drag.prototype._unprep;",""," Y.DD.Drag.prototype._unprep = function() {"," var node = this.get('node');"," _unprep.call(this);"," node.detachAll('gesturemoveend');"," };",""," Y.DD.DDM._setupListeners = function() {"," var DDM = Y.DD.DDM;",""," this._createPG();"," this._active = true;"," Y.one(Y.config.doc).on('gesturemove', Y.throttle(Y.bind(DDM._move, DDM), DDM.get('throttleTime')), {"," standAlone: true"," });"," };","","","","}, '@VERSION@', {\"requires\": [\"dd-drag\", \"event-synthetic\", \"event-gestures\"]});","","}());"]}; +} +var __cov_VZD$6A5JRP4xUQ9RaC7uEA = __coverage__['build/dd-gestures/dd-gestures.js']; +__cov_VZD$6A5JRP4xUQ9RaC7uEA.s['1']++;YUI.add('dd-gestures',function(Y,NAME){__cov_VZD$6A5JRP4xUQ9RaC7uEA.f['1']++;__cov_VZD$6A5JRP4xUQ9RaC7uEA.s['2']++;Y.DD.Drag.START_EVENT='gesturemovestart';__cov_VZD$6A5JRP4xUQ9RaC7uEA.s['3']++;Y.DD.Drag.prototype._prep=function(){__cov_VZD$6A5JRP4xUQ9RaC7uEA.f['2']++;__cov_VZD$6A5JRP4xUQ9RaC7uEA.s['4']++;this._dragThreshMet=false;__cov_VZD$6A5JRP4xUQ9RaC7uEA.s['5']++;var node=this.get('node'),DDM=Y.DD.DDM;__cov_VZD$6A5JRP4xUQ9RaC7uEA.s['6']++;node.addClass(DDM.CSS_PREFIX+'-draggable');__cov_VZD$6A5JRP4xUQ9RaC7uEA.s['7']++;node.on(Y.DD.Drag.START_EVENT,Y.bind(this._handleMouseDownEvent,this),{minDistance:this.get('clickPixelThresh'),minTime:this.get('clickTimeThresh'),preventDefault:true});__cov_VZD$6A5JRP4xUQ9RaC7uEA.s['8']++;node.on('gesturemoveend',Y.bind(this._handleMouseUp,this),{standAlone:true});__cov_VZD$6A5JRP4xUQ9RaC7uEA.s['9']++;node.on('dragstart',Y.bind(this._fixDragStart,this));};__cov_VZD$6A5JRP4xUQ9RaC7uEA.s['10']++;var _unprep=Y.DD.Drag.prototype._unprep;__cov_VZD$6A5JRP4xUQ9RaC7uEA.s['11']++;Y.DD.Drag.prototype._unprep=function(){__cov_VZD$6A5JRP4xUQ9RaC7uEA.f['3']++;__cov_VZD$6A5JRP4xUQ9RaC7uEA.s['12']++;var node=this.get('node');__cov_VZD$6A5JRP4xUQ9RaC7uEA.s['13']++;_unprep.call(this);__cov_VZD$6A5JRP4xUQ9RaC7uEA.s['14']++;node.detachAll('gesturemoveend');};__cov_VZD$6A5JRP4xUQ9RaC7uEA.s['15']++;Y.DD.DDM._setupListeners=function(){__cov_VZD$6A5JRP4xUQ9RaC7uEA.f['4']++;__cov_VZD$6A5JRP4xUQ9RaC7uEA.s['16']++;var DDM=Y.DD.DDM;__cov_VZD$6A5JRP4xUQ9RaC7uEA.s['17']++;this._createPG();__cov_VZD$6A5JRP4xUQ9RaC7uEA.s['18']++;this._active=true;__cov_VZD$6A5JRP4xUQ9RaC7uEA.s['19']++;Y.one(Y.config.doc).on('gesturemove',Y.throttle(Y.bind(DDM._move,DDM),DDM.get('throttleTime')),{standAlone:true});};},'@VERSION@',{'requires':['dd-drag','event-synthetic','event-gestures']}); diff --git a/src/build/dd-gestures/dd-gestures-debug.js b/src/build/dd-gestures/dd-gestures-debug.js new file mode 100644 index 00000000000..4c1f868fcfb --- /dev/null +++ b/src/build/dd-gestures/dd-gestures-debug.js @@ -0,0 +1,57 @@ +YUI.add('dd-gestures', function (Y, NAME) { + + + /** + * This module is the conditional loaded `dd` module to support gesture events + * in the event that `dd` is loaded onto a device that support touch based events. + * + * This module is loaded and over rides 2 key methods on `DD.Drag` and `DD.DDM` to + * attach the gesture events. Overrides `DD.Drag._prep` and `DD.DDM._setupListeners` + * methods as well as set's the property `DD.Drag.START_EVENT` to `gesturemovestart` + * to enable gesture movement instead of mouse based movement. + * @module dd + * @submodule dd-gestures + */ + Y.log('Drag gesture support loaded', 'info', 'drag-gestures'); + + Y.DD.Drag.START_EVENT = 'gesturemovestart'; + + Y.DD.Drag.prototype._prep = function() { + Y.log('Using DD override prep to attach gesture events', 'info', 'drag-gestures'); + this._dragThreshMet = false; + var node = this.get('node'), DDM = Y.DD.DDM; + + node.addClass(DDM.CSS_PREFIX + '-draggable'); + + node.on(Y.DD.Drag.START_EVENT, Y.bind(this._handleMouseDownEvent, this), { + minDistance: this.get('clickPixelThresh'), + minTime: this.get('clickTimeThresh'), + preventDefault: true + }); + + node.on('gesturemoveend', Y.bind(this._handleMouseUp, this), { standAlone: true }); + node.on('dragstart', Y.bind(this._fixDragStart, this)); + + }; + + var _unprep = Y.DD.Drag.prototype._unprep; + + Y.DD.Drag.prototype._unprep = function() { + var node = this.get('node'); + _unprep.call(this); + node.detachAll('gesturemoveend'); + }; + + Y.DD.DDM._setupListeners = function() { + var DDM = Y.DD.DDM; + + this._createPG(); + this._active = true; + Y.one(Y.config.doc).on('gesturemove', Y.throttle(Y.bind(DDM._move, DDM), DDM.get('throttleTime')), { + standAlone: true + }); + }; + + + +}, '@VERSION@', {"requires": ["dd-drag", "event-synthetic", "event-gestures"]}); diff --git a/src/build/dd-gestures/dd-gestures-min.js b/src/build/dd-gestures/dd-gestures-min.js new file mode 100644 index 00000000000..1535986cc55 --- /dev/null +++ b/src/build/dd-gestures/dd-gestures-min.js @@ -0,0 +1 @@ +YUI.add("dd-gestures",function(e,t){e.DD.Drag.START_EVENT="gesturemovestart",e.DD.Drag.prototype._prep=function(){this._dragThreshMet=!1;var t=this.get("node"),n=e.DD.DDM;t.addClass(n.CSS_PREFIX+"-draggable"),t.on(e.DD.Drag.START_EVENT,e.bind(this._handleMouseDownEvent,this),{minDistance:this.get("clickPixelThresh"),minTime:this.get("clickTimeThresh"),preventDefault:!0}),t.on("gesturemoveend",e.bind(this._handleMouseUp,this),{standAlone:!0}),t.on("dragstart",e.bind(this._fixDragStart,this))};var n=e.DD.Drag.prototype._unprep;e.DD.Drag.prototype._unprep=function(){var e=this.get("node");n.call(this),e.detachAll("gesturemoveend")},e.DD.DDM._setupListeners=function(){var t=e.DD.DDM;this._createPG(),this._active=!0,e.one(e.config.doc).on("gesturemove",e.throttle(e.bind(t._move,t),t.get("throttleTime")),{standAlone:!0})}},"@VERSION@",{requires:["dd-drag","event-synthetic","event-gestures"]}); diff --git a/src/build/dd-gestures/dd-gestures.js b/src/build/dd-gestures/dd-gestures.js new file mode 100644 index 00000000000..5fb4441b28a --- /dev/null +++ b/src/build/dd-gestures/dd-gestures.js @@ -0,0 +1,55 @@ +YUI.add('dd-gestures', function (Y, NAME) { + + + /** + * This module is the conditional loaded `dd` module to support gesture events + * in the event that `dd` is loaded onto a device that support touch based events. + * + * This module is loaded and over rides 2 key methods on `DD.Drag` and `DD.DDM` to + * attach the gesture events. Overrides `DD.Drag._prep` and `DD.DDM._setupListeners` + * methods as well as set's the property `DD.Drag.START_EVENT` to `gesturemovestart` + * to enable gesture movement instead of mouse based movement. + * @module dd + * @submodule dd-gestures + */ + + Y.DD.Drag.START_EVENT = 'gesturemovestart'; + + Y.DD.Drag.prototype._prep = function() { + this._dragThreshMet = false; + var node = this.get('node'), DDM = Y.DD.DDM; + + node.addClass(DDM.CSS_PREFIX + '-draggable'); + + node.on(Y.DD.Drag.START_EVENT, Y.bind(this._handleMouseDownEvent, this), { + minDistance: this.get('clickPixelThresh'), + minTime: this.get('clickTimeThresh'), + preventDefault: true + }); + + node.on('gesturemoveend', Y.bind(this._handleMouseUp, this), { standAlone: true }); + node.on('dragstart', Y.bind(this._fixDragStart, this)); + + }; + + var _unprep = Y.DD.Drag.prototype._unprep; + + Y.DD.Drag.prototype._unprep = function() { + var node = this.get('node'); + _unprep.call(this); + node.detachAll('gesturemoveend'); + }; + + Y.DD.DDM._setupListeners = function() { + var DDM = Y.DD.DDM; + + this._createPG(); + this._active = true; + Y.one(Y.config.doc).on('gesturemove', Y.throttle(Y.bind(DDM._move, DDM), DDM.get('throttleTime')), { + standAlone: true + }); + }; + + + +}, '@VERSION@', {"requires": ["dd-drag", "event-synthetic", "event-gestures"]}); diff --git a/src/build/dd-plugin/dd-plugin-coverage.js b/src/build/dd-plugin/dd-plugin-coverage.js new file mode 100644 index 00000000000..5b5304d3c46 --- /dev/null +++ b/src/build/dd-plugin/dd-plugin-coverage.js @@ -0,0 +1,6 @@ +if (typeof __coverage__ === 'undefined') { __coverage__ = {}; } +if (!__coverage__['build/dd-plugin/dd-plugin.js']) { + __coverage__['build/dd-plugin/dd-plugin.js'] = {"path":"build/dd-plugin/dd-plugin.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0},"b":{"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0],"8":[0,0],"9":[0,0],"10":[0,0],"11":[0,0],"12":[0,0],"13":[0,0],"14":[0,0],"15":[0,0]},"f":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":40}}},"2":{"name":"(anonymous_2)","line":17,"loc":{"start":{"line":17,"column":19},"end":{"line":17,"column":36}}},"3":{"name":"(anonymous_3)","line":74,"loc":{"start":{"line":74,"column":37},"end":{"line":74,"column":54}}},"4":{"name":"(anonymous_4)","line":88,"loc":{"start":{"line":88,"column":30},"end":{"line":88,"column":41}}},"5":{"name":"(anonymous_5)","line":109,"loc":{"start":{"line":109,"column":40},"end":{"line":109,"column":51}}},"6":{"name":"(anonymous_6)","line":110,"loc":{"start":{"line":110,"column":54},"end":{"line":110,"column":71}}},"7":{"name":"(anonymous_7)","line":120,"loc":{"start":{"line":120,"column":40},"end":{"line":120,"column":51}}},"8":{"name":"(anonymous_8)","line":137,"loc":{"start":{"line":137,"column":29},"end":{"line":137,"column":46}}},"9":{"name":"(anonymous_9)","line":156,"loc":{"start":{"line":156,"column":34},"end":{"line":156,"column":46}}},"10":{"name":"(anonymous_10)","line":188,"loc":{"start":{"line":188,"column":37},"end":{"line":188,"column":49}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":200,"column":85}},"2":{"start":{"line":17,"column":8},"end":{"line":30,"column":33}},"3":{"start":{"line":18,"column":16},"end":{"line":24,"column":17}},"4":{"start":{"line":19,"column":24},"end":{"line":19,"column":69}},"5":{"start":{"line":20,"column":24},"end":{"line":20,"column":52}},"6":{"start":{"line":22,"column":24},"end":{"line":22,"column":50}},"7":{"start":{"line":23,"column":24},"end":{"line":23,"column":46}},"8":{"start":{"line":25,"column":16},"end":{"line":25,"column":63}},"9":{"start":{"line":37,"column":8},"end":{"line":37,"column":32}},"10":{"start":{"line":44,"column":8},"end":{"line":44,"column":23}},"11":{"start":{"line":46,"column":8},"end":{"line":191,"column":11}},"12":{"start":{"line":75,"column":24},"end":{"line":75,"column":38}},"13":{"start":{"line":76,"column":24},"end":{"line":78,"column":25}},"14":{"start":{"line":77,"column":32},"end":{"line":77,"column":104}},"15":{"start":{"line":79,"column":24},"end":{"line":79,"column":33}},"16":{"start":{"line":89,"column":20},"end":{"line":102,"column":21}},"17":{"start":{"line":91,"column":24},"end":{"line":101,"column":25}},"18":{"start":{"line":93,"column":28},"end":{"line":96,"column":29}},"19":{"start":{"line":95,"column":32},"end":{"line":95,"column":62}},"20":{"start":{"line":98,"column":28},"end":{"line":100,"column":29}},"21":{"start":{"line":99,"column":32},"end":{"line":99,"column":62}},"22":{"start":{"line":110,"column":20},"end":{"line":112,"column":23}},"23":{"start":{"line":111,"column":24},"end":{"line":111,"column":40}},"24":{"start":{"line":113,"column":20},"end":{"line":113,"column":45}},"25":{"start":{"line":122,"column":24},"end":{"line":129,"column":25}},"26":{"start":{"line":125,"column":31},"end":{"line":125,"column":97}},"27":{"start":{"line":128,"column":31},"end":{"line":128,"column":104}},"28":{"start":{"line":139,"column":24},"end":{"line":139,"column":49}},"29":{"start":{"line":141,"column":24},"end":{"line":141,"column":53}},"30":{"start":{"line":143,"column":24},"end":{"line":143,"column":61}},"31":{"start":{"line":145,"column":24},"end":{"line":145,"column":54}},"32":{"start":{"line":159,"column":24},"end":{"line":163,"column":82}},"33":{"start":{"line":166,"column":25},"end":{"line":178,"column":26}},"34":{"start":{"line":167,"column":33},"end":{"line":167,"column":64}},"35":{"start":{"line":171,"column":30},"end":{"line":178,"column":26}},"36":{"start":{"line":172,"column":33},"end":{"line":172,"column":65}},"37":{"start":{"line":176,"column":30},"end":{"line":178,"column":26}},"38":{"start":{"line":177,"column":33},"end":{"line":177,"column":66}},"39":{"start":{"line":189,"column":24},"end":{"line":189,"column":64}},"40":{"start":{"line":193,"column":8},"end":{"line":193,"column":30}},"41":{"start":{"line":194,"column":8},"end":{"line":194,"column":29}}},"branchMap":{"1":{"line":18,"type":"if","locations":[{"start":{"line":18,"column":16},"end":{"line":18,"column":16}},{"start":{"line":18,"column":16},"end":{"line":18,"column":16}}]},"2":{"line":18,"type":"binary-expr","locations":[{"start":{"line":18,"column":20},"end":{"line":18,"column":28}},{"start":{"line":18,"column":32},"end":{"line":18,"column":63}}]},"3":{"line":76,"type":"if","locations":[{"start":{"line":76,"column":24},"end":{"line":76,"column":24}},{"start":{"line":76,"column":24},"end":{"line":76,"column":24}}]},"4":{"line":77,"type":"cond-expr","locations":[{"start":{"line":77,"column":91},"end":{"line":77,"column":95}},{"start":{"line":77,"column":98},"end":{"line":77,"column":103}}]},"5":{"line":77,"type":"binary-expr","locations":[{"start":{"line":77,"column":37},"end":{"line":77,"column":51}},{"start":{"line":77,"column":55},"end":{"line":77,"column":87}}]},"6":{"line":89,"type":"if","locations":[{"start":{"line":89,"column":20},"end":{"line":89,"column":20}},{"start":{"line":89,"column":20},"end":{"line":89,"column":20}}]},"7":{"line":91,"type":"if","locations":[{"start":{"line":91,"column":24},"end":{"line":91,"column":24}},{"start":{"line":91,"column":24},"end":{"line":91,"column":24}}]},"8":{"line":93,"type":"if","locations":[{"start":{"line":93,"column":28},"end":{"line":93,"column":28}},{"start":{"line":93,"column":28},"end":{"line":93,"column":28}}]},"9":{"line":98,"type":"if","locations":[{"start":{"line":98,"column":28},"end":{"line":98,"column":28}},{"start":{"line":98,"column":28},"end":{"line":98,"column":28}}]},"10":{"line":122,"type":"if","locations":[{"start":{"line":122,"column":24},"end":{"line":122,"column":24}},{"start":{"line":122,"column":24},"end":{"line":122,"column":24}}]},"11":{"line":159,"type":"binary-expr","locations":[{"start":{"line":159,"column":37},"end":{"line":159,"column":58}},{"start":{"line":159,"column":62},"end":{"line":159,"column":77}}]},"12":{"line":166,"type":"if","locations":[{"start":{"line":166,"column":25},"end":{"line":166,"column":25}},{"start":{"line":166,"column":25},"end":{"line":166,"column":25}}]},"13":{"line":166,"type":"binary-expr","locations":[{"start":{"line":166,"column":29},"end":{"line":166,"column":45}},{"start":{"line":166,"column":49},"end":{"line":166,"column":65}}]},"14":{"line":171,"type":"if","locations":[{"start":{"line":171,"column":30},"end":{"line":171,"column":30}},{"start":{"line":171,"column":30},"end":{"line":171,"column":30}}]},"15":{"line":176,"type":"if","locations":[{"start":{"line":176,"column":30},"end":{"line":176,"column":30}},{"start":{"line":176,"column":30},"end":{"line":176,"column":30}}]}},"code":["(function () { YUI.add('dd-plugin', function (Y, NAME) {","","",""," /**"," * Simple Drag plugin that can be attached to a Node or Widget via the plug method."," * @module dd"," * @submodule dd-plugin"," */"," /**"," * Simple Drag plugin that can be attached to a Node or Widget via the plug method."," * @class Drag"," * @extends DD.Drag"," * @constructor"," * @namespace Plugin"," */"," var Drag = function(config) {"," if (Y.Widget && config.host instanceof Y.Widget) {"," config.node = config.host.get('boundingBox');"," config.widget = config.host;"," } else {"," config.node = config.host;"," config.widget = false;"," }"," Drag.superclass.constructor.call(this, config);"," },",""," EV_START = 'drag:start',"," EV_DRAG = 'drag:drag',"," EV_DRAG_END = 'drag:end';",""," /**"," * dd-plugin"," * @property NAME"," * @type {String}"," */"," Drag.NAME = \"dd-plugin\";",""," /**"," * The Drag instance will be placed on the Node instance under the dd namespace. It can be accessed via Node.dd;"," * @property NS"," * @type {String}"," */"," Drag.NS = \"dd\";",""," Y.extend(Drag, Y.DD.Drag, {",""," _widgetHandles: null,",""," /**"," * refers to a Y.Widget if its the host, otherwise = false."," *"," * @attribute _widget"," * @private"," */"," _widget: undefined,","",""," /**"," * refers to the [x,y] coordinate where the drag was stopped last"," *"," * @attribute _stoppedPosition"," * @private"," */"," _stoppedPosition: undefined,","",""," /**"," * Returns true if widget uses widgetPosition, otherwise returns false"," *"," * @method _usesWidgetPosition"," * @private"," */"," _usesWidgetPosition: function(widget) {"," var r = false;"," if (widget) {"," r = (widget.hasImpl && widget.hasImpl(Y.WidgetPosition)) ? true : false;"," }"," return r;"," },"," /**"," * Attached to the `drag:start` event, it checks if this plugin needs"," * to attach or detach listeners for widgets. If `dd-proxy` is plugged"," * the default widget positioning should be ignored."," * @method _checkEvents"," * @private"," */"," _checkEvents: function() {"," if (this._widget) {"," //It's a widget"," if (this.proxy) {"," //It's a proxy"," if (this._widgetHandles.length > 0) {"," //Remove Listeners"," this._removeWidgetListeners();"," }"," } else {"," if (this._widgetHandles.length === 0) {"," this._attachWidgetListeners();"," }"," }"," }"," },"," /**"," * Remove the attached widget listeners"," * @method _removeWidgetListeners"," * @private"," */"," _removeWidgetListeners: function() {"," Y.Array.each(this._widgetHandles, function(handle) {"," handle.detach();"," });"," this._widgetHandles = [];"," },"," /**"," * If this is a Widget, then attach the positioning listeners"," * @method _attachWidgetListeners"," * @private"," */"," _attachWidgetListeners: function() {"," //if this thing is a widget, and it uses widgetposition..."," if (this._usesWidgetPosition(this._widget)) {",""," //set the x,y on the widget's ATTRS"," this._widgetHandles.push(this.on(EV_DRAG, this._setWidgetCoords));",""," //store the new position that the widget ends up on"," this._widgetHandles.push(this.on(EV_DRAG_END, this._updateStopPosition));"," }"," },"," /**"," * Sets up event listeners on drag events if interacting with a widget"," *"," * @method initializer"," * @protected"," */"," initializer: function(config) {",""," this._widgetHandles = [];",""," this._widget = config.widget;",""," this.on(EV_START, this._checkEvents); //Always run, don't check",""," this._attachWidgetListeners();",""," },",""," /**"," * Updates x,y or xy attributes on widget based on where the widget is dragged"," *"," * @method initializer"," * @param {EventFacade} e Event Facade"," * @private"," */"," _setWidgetCoords: function(e) {",""," //get the last position where the widget was, or get the starting point"," var nodeXY = this._stoppedPosition || e.target.nodeXY,"," realXY = e.target.realXY,",""," //amount moved = [(x2 - x1) , (y2 - y1)]"," movedXY = [realXY[0] - nodeXY[0], realXY[1] - nodeXY[1]];",""," //if both have changed.."," if (movedXY[0] !== 0 && movedXY[1] !== 0) {"," this._widget.set('xy', realXY);"," }",""," //if only x is 0, set the Y"," else if (movedXY[0] === 0) {"," this._widget.set('y',realXY[1]);"," }",""," //otherwise, y is 0, so set X"," else if (movedXY[1] === 0){"," this._widget.set('x', realXY[0]);"," }"," },",""," /**"," * Updates the last position where the widget was stopped."," *"," * @method _updateStopPosition"," * @param {EventFacade} e Event Facade"," * @private"," */"," _updateStopPosition: function(e) {"," this._stoppedPosition = e.target.realXY;"," }"," });",""," Y.namespace('Plugin');"," Y.Plugin.Drag = Drag;","","","","","","}, '@VERSION@', {\"optional\": [\"dd-constrain\", \"dd-proxy\"], \"requires\": [\"dd-drag\"]});","","}());"]}; +} +var __cov_9CTh$VNIxvJd2aMkmbBRWQ = __coverage__['build/dd-plugin/dd-plugin.js']; +__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['1']++;YUI.add('dd-plugin',function(Y,NAME){__cov_9CTh$VNIxvJd2aMkmbBRWQ.f['1']++;__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['2']++;var Drag=function(config){__cov_9CTh$VNIxvJd2aMkmbBRWQ.f['2']++;__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['3']++;if((__cov_9CTh$VNIxvJd2aMkmbBRWQ.b['2'][0]++,Y.Widget)&&(__cov_9CTh$VNIxvJd2aMkmbBRWQ.b['2'][1]++,config.host instanceof Y.Widget)){__cov_9CTh$VNIxvJd2aMkmbBRWQ.b['1'][0]++;__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['4']++;config.node=config.host.get('boundingBox');__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['5']++;config.widget=config.host;}else{__cov_9CTh$VNIxvJd2aMkmbBRWQ.b['1'][1]++;__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['6']++;config.node=config.host;__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['7']++;config.widget=false;}__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['8']++;Drag.superclass.constructor.call(this,config);},EV_START='drag:start',EV_DRAG='drag:drag',EV_DRAG_END='drag:end';__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['9']++;Drag.NAME='dd-plugin';__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['10']++;Drag.NS='dd';__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['11']++;Y.extend(Drag,Y.DD.Drag,{_widgetHandles:null,_widget:undefined,_stoppedPosition:undefined,_usesWidgetPosition:function(widget){__cov_9CTh$VNIxvJd2aMkmbBRWQ.f['3']++;__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['12']++;var r=false;__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['13']++;if(widget){__cov_9CTh$VNIxvJd2aMkmbBRWQ.b['3'][0]++;__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['14']++;r=(__cov_9CTh$VNIxvJd2aMkmbBRWQ.b['5'][0]++,widget.hasImpl)&&(__cov_9CTh$VNIxvJd2aMkmbBRWQ.b['5'][1]++,widget.hasImpl(Y.WidgetPosition))?(__cov_9CTh$VNIxvJd2aMkmbBRWQ.b['4'][0]++,true):(__cov_9CTh$VNIxvJd2aMkmbBRWQ.b['4'][1]++,false);}else{__cov_9CTh$VNIxvJd2aMkmbBRWQ.b['3'][1]++;}__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['15']++;return r;},_checkEvents:function(){__cov_9CTh$VNIxvJd2aMkmbBRWQ.f['4']++;__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['16']++;if(this._widget){__cov_9CTh$VNIxvJd2aMkmbBRWQ.b['6'][0]++;__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['17']++;if(this.proxy){__cov_9CTh$VNIxvJd2aMkmbBRWQ.b['7'][0]++;__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['18']++;if(this._widgetHandles.length>0){__cov_9CTh$VNIxvJd2aMkmbBRWQ.b['8'][0]++;__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['19']++;this._removeWidgetListeners();}else{__cov_9CTh$VNIxvJd2aMkmbBRWQ.b['8'][1]++;}}else{__cov_9CTh$VNIxvJd2aMkmbBRWQ.b['7'][1]++;__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['20']++;if(this._widgetHandles.length===0){__cov_9CTh$VNIxvJd2aMkmbBRWQ.b['9'][0]++;__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['21']++;this._attachWidgetListeners();}else{__cov_9CTh$VNIxvJd2aMkmbBRWQ.b['9'][1]++;}}}else{__cov_9CTh$VNIxvJd2aMkmbBRWQ.b['6'][1]++;}},_removeWidgetListeners:function(){__cov_9CTh$VNIxvJd2aMkmbBRWQ.f['5']++;__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['22']++;Y.Array.each(this._widgetHandles,function(handle){__cov_9CTh$VNIxvJd2aMkmbBRWQ.f['6']++;__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['23']++;handle.detach();});__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['24']++;this._widgetHandles=[];},_attachWidgetListeners:function(){__cov_9CTh$VNIxvJd2aMkmbBRWQ.f['7']++;__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['25']++;if(this._usesWidgetPosition(this._widget)){__cov_9CTh$VNIxvJd2aMkmbBRWQ.b['10'][0]++;__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['26']++;this._widgetHandles.push(this.on(EV_DRAG,this._setWidgetCoords));__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['27']++;this._widgetHandles.push(this.on(EV_DRAG_END,this._updateStopPosition));}else{__cov_9CTh$VNIxvJd2aMkmbBRWQ.b['10'][1]++;}},initializer:function(config){__cov_9CTh$VNIxvJd2aMkmbBRWQ.f['8']++;__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['28']++;this._widgetHandles=[];__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['29']++;this._widget=config.widget;__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['30']++;this.on(EV_START,this._checkEvents);__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['31']++;this._attachWidgetListeners();},_setWidgetCoords:function(e){__cov_9CTh$VNIxvJd2aMkmbBRWQ.f['9']++;__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['32']++;var nodeXY=(__cov_9CTh$VNIxvJd2aMkmbBRWQ.b['11'][0]++,this._stoppedPosition)||(__cov_9CTh$VNIxvJd2aMkmbBRWQ.b['11'][1]++,e.target.nodeXY),realXY=e.target.realXY,movedXY=[realXY[0]-nodeXY[0],realXY[1]-nodeXY[1]];__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['33']++;if((__cov_9CTh$VNIxvJd2aMkmbBRWQ.b['13'][0]++,movedXY[0]!==0)&&(__cov_9CTh$VNIxvJd2aMkmbBRWQ.b['13'][1]++,movedXY[1]!==0)){__cov_9CTh$VNIxvJd2aMkmbBRWQ.b['12'][0]++;__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['34']++;this._widget.set('xy',realXY);}else{__cov_9CTh$VNIxvJd2aMkmbBRWQ.b['12'][1]++;__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['35']++;if(movedXY[0]===0){__cov_9CTh$VNIxvJd2aMkmbBRWQ.b['14'][0]++;__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['36']++;this._widget.set('y',realXY[1]);}else{__cov_9CTh$VNIxvJd2aMkmbBRWQ.b['14'][1]++;__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['37']++;if(movedXY[1]===0){__cov_9CTh$VNIxvJd2aMkmbBRWQ.b['15'][0]++;__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['38']++;this._widget.set('x',realXY[0]);}else{__cov_9CTh$VNIxvJd2aMkmbBRWQ.b['15'][1]++;}}}},_updateStopPosition:function(e){__cov_9CTh$VNIxvJd2aMkmbBRWQ.f['10']++;__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['39']++;this._stoppedPosition=e.target.realXY;}});__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['40']++;Y.namespace('Plugin');__cov_9CTh$VNIxvJd2aMkmbBRWQ.s['41']++;Y.Plugin.Drag=Drag;},'@VERSION@',{'optional':['dd-constrain','dd-proxy'],'requires':['dd-drag']}); diff --git a/src/build/dd-plugin/dd-plugin-debug.js b/src/build/dd-plugin/dd-plugin-debug.js new file mode 100644 index 00000000000..425a5db9441 --- /dev/null +++ b/src/build/dd-plugin/dd-plugin-debug.js @@ -0,0 +1,205 @@ +YUI.add('dd-plugin', function (Y, NAME) { + + + + /** + * Simple Drag plugin that can be attached to a Node or Widget via the plug method. + * @module dd + * @submodule dd-plugin + */ + /** + * Simple Drag plugin that can be attached to a Node or Widget via the plug method. + * @class Drag + * @extends DD.Drag + * @constructor + * @namespace Plugin + */ + var Drag = function(config) { + if (Y.Widget && config.host instanceof Y.Widget) { + config.node = config.host.get('boundingBox'); + config.widget = config.host; + } else { + config.node = config.host; + config.widget = false; + } + Drag.superclass.constructor.call(this, config); + }, + + EV_START = 'drag:start', + EV_DRAG = 'drag:drag', + EV_DRAG_END = 'drag:end'; + + /** + * dd-plugin + * @property NAME + * @type {String} + */ + Drag.NAME = "dd-plugin"; + + /** + * The Drag instance will be placed on the Node instance under the dd namespace. It can be accessed via Node.dd; + * @property NS + * @type {String} + */ + Drag.NS = "dd"; + + Y.extend(Drag, Y.DD.Drag, { + + _widgetHandles: null, + + /** + * refers to a Y.Widget if its the host, otherwise = false. + * + * @attribute _widget + * @private + */ + _widget: undefined, + + + /** + * refers to the [x,y] coordinate where the drag was stopped last + * + * @attribute _stoppedPosition + * @private + */ + _stoppedPosition: undefined, + + + /** + * Returns true if widget uses widgetPosition, otherwise returns false + * + * @method _usesWidgetPosition + * @private + */ + _usesWidgetPosition: function(widget) { + var r = false; + if (widget) { + r = (widget.hasImpl && widget.hasImpl(Y.WidgetPosition)) ? true : false; + } + return r; + }, + /** + * Attached to the `drag:start` event, it checks if this plugin needs + * to attach or detach listeners for widgets. If `dd-proxy` is plugged + * the default widget positioning should be ignored. + * @method _checkEvents + * @private + */ + _checkEvents: function() { + Y.log('Checking for widget events', 'info', 'dd-plugin'); + if (this._widget) { + //It's a widget + if (this.proxy) { + //It's a proxy + if (this._widgetHandles.length > 0) { + Y.log('Proxy is plugged, remove events', 'info', 'dd-plugin'); + //Remove Listeners + this._removeWidgetListeners(); + } + } else { + if (this._widgetHandles.length === 0) { + Y.log('Proxy is not plugged, attach events', 'info', 'dd-plugin'); + this._attachWidgetListeners(); + } + } + } + }, + /** + * Remove the attached widget listeners + * @method _removeWidgetListeners + * @private + */ + _removeWidgetListeners: function() { + Y.log('Detaching widget events', 'info', 'dd-plugin'); + Y.Array.each(this._widgetHandles, function(handle) { + handle.detach(); + }); + this._widgetHandles = []; + }, + /** + * If this is a Widget, then attach the positioning listeners + * @method _attachWidgetListeners + * @private + */ + _attachWidgetListeners: function() { + //if this thing is a widget, and it uses widgetposition... + if (this._usesWidgetPosition(this._widget)) { + Y.log('Attaching widget events', 'info', 'dd-plugin'); + + //set the x,y on the widget's ATTRS + this._widgetHandles.push(this.on(EV_DRAG, this._setWidgetCoords)); + + //store the new position that the widget ends up on + this._widgetHandles.push(this.on(EV_DRAG_END, this._updateStopPosition)); + } + }, + /** + * Sets up event listeners on drag events if interacting with a widget + * + * @method initializer + * @protected + */ + initializer: function(config) { + + this._widgetHandles = []; + + this._widget = config.widget; + + this.on(EV_START, this._checkEvents); //Always run, don't check + + this._attachWidgetListeners(); + + }, + + /** + * Updates x,y or xy attributes on widget based on where the widget is dragged + * + * @method initializer + * @param {EventFacade} e Event Facade + * @private + */ + _setWidgetCoords: function(e) { + + //get the last position where the widget was, or get the starting point + var nodeXY = this._stoppedPosition || e.target.nodeXY, + realXY = e.target.realXY, + + //amount moved = [(x2 - x1) , (y2 - y1)] + movedXY = [realXY[0] - nodeXY[0], realXY[1] - nodeXY[1]]; + + //if both have changed.. + if (movedXY[0] !== 0 && movedXY[1] !== 0) { + this._widget.set('xy', realXY); + } + + //if only x is 0, set the Y + else if (movedXY[0] === 0) { + this._widget.set('y',realXY[1]); + } + + //otherwise, y is 0, so set X + else if (movedXY[1] === 0){ + this._widget.set('x', realXY[0]); + } + }, + + /** + * Updates the last position where the widget was stopped. + * + * @method _updateStopPosition + * @param {EventFacade} e Event Facade + * @private + */ + _updateStopPosition: function(e) { + this._stoppedPosition = e.target.realXY; + } + }); + + Y.namespace('Plugin'); + Y.Plugin.Drag = Drag; + + + + + +}, '@VERSION@', {"optional": ["dd-constrain", "dd-proxy"], "requires": ["dd-drag"]}); diff --git a/src/build/dd-plugin/dd-plugin-min.js b/src/build/dd-plugin/dd-plugin-min.js new file mode 100644 index 00000000000..985ad0a40be --- /dev/null +++ b/src/build/dd-plugin/dd-plugin-min.js @@ -0,0 +1 @@ +YUI.add("dd-plugin",function(e,t){var n=function(t){e.Widget&&t.host instanceof e.Widget?(t.node=t.host.get("boundingBox"),t.widget=t.host):(t.node=t.host,t.widget=!1),n.superclass.constructor.call(this,t)},r="drag:start",i="drag:drag",s="drag:end";n.NAME="dd-plugin",n.NS="dd",e.extend(n,e.DD.Drag,{_widgetHandles:null,_widget:undefined,_stoppedPosition:undefined,_usesWidgetPosition:function(t){var n=!1;return t&&(n=t.hasImpl&&t.hasImpl(e.WidgetPosition)?!0:!1),n},_checkEvents:function(){this._widget&&(this.proxy?this._widgetHandles.length>0&&this._removeWidgetListeners():this._widgetHandles.length===0&&this._attachWidgetListeners())},_removeWidgetListeners:function(){e.Array.each(this._widgetHandles,function(e){e.detach()}),this._widgetHandles=[]},_attachWidgetListeners:function(){this._usesWidgetPosition(this._widget)&&(this._widgetHandles.push(this.on(i,this._setWidgetCoords)),this._widgetHandles.push(this.on(s,this._updateStopPosition)))},initializer:function(e){this._widgetHandles=[],this._widget=e.widget,this.on(r,this._checkEvents),this._attachWidgetListeners()},_setWidgetCoords:function(e){var t=this._stoppedPosition||e.target.nodeXY,n=e.target.realXY,r=[n[0]-t[0],n[1]-t[1]];r[0]!==0&&r[1]!==0?this._widget.set("xy",n):r[0]===0?this._widget.set("y",n[1]):r[1]===0&&this._widget.set("x",n[0])},_updateStopPosition:function(e){this._stoppedPosition=e.target.realXY}}),e.namespace("Plugin"),e.Plugin.Drag=n},"@VERSION@",{optional:["dd-constrain","dd-proxy"],requires:["dd-drag"]}); diff --git a/src/build/dd-plugin/dd-plugin.js b/src/build/dd-plugin/dd-plugin.js new file mode 100644 index 00000000000..6e235d7f740 --- /dev/null +++ b/src/build/dd-plugin/dd-plugin.js @@ -0,0 +1,200 @@ +YUI.add('dd-plugin', function (Y, NAME) { + + + + /** + * Simple Drag plugin that can be attached to a Node or Widget via the plug method. + * @module dd + * @submodule dd-plugin + */ + /** + * Simple Drag plugin that can be attached to a Node or Widget via the plug method. + * @class Drag + * @extends DD.Drag + * @constructor + * @namespace Plugin + */ + var Drag = function(config) { + if (Y.Widget && config.host instanceof Y.Widget) { + config.node = config.host.get('boundingBox'); + config.widget = config.host; + } else { + config.node = config.host; + config.widget = false; + } + Drag.superclass.constructor.call(this, config); + }, + + EV_START = 'drag:start', + EV_DRAG = 'drag:drag', + EV_DRAG_END = 'drag:end'; + + /** + * dd-plugin + * @property NAME + * @type {String} + */ + Drag.NAME = "dd-plugin"; + + /** + * The Drag instance will be placed on the Node instance under the dd namespace. It can be accessed via Node.dd; + * @property NS + * @type {String} + */ + Drag.NS = "dd"; + + Y.extend(Drag, Y.DD.Drag, { + + _widgetHandles: null, + + /** + * refers to a Y.Widget if its the host, otherwise = false. + * + * @attribute _widget + * @private + */ + _widget: undefined, + + + /** + * refers to the [x,y] coordinate where the drag was stopped last + * + * @attribute _stoppedPosition + * @private + */ + _stoppedPosition: undefined, + + + /** + * Returns true if widget uses widgetPosition, otherwise returns false + * + * @method _usesWidgetPosition + * @private + */ + _usesWidgetPosition: function(widget) { + var r = false; + if (widget) { + r = (widget.hasImpl && widget.hasImpl(Y.WidgetPosition)) ? true : false; + } + return r; + }, + /** + * Attached to the `drag:start` event, it checks if this plugin needs + * to attach or detach listeners for widgets. If `dd-proxy` is plugged + * the default widget positioning should be ignored. + * @method _checkEvents + * @private + */ + _checkEvents: function() { + if (this._widget) { + //It's a widget + if (this.proxy) { + //It's a proxy + if (this._widgetHandles.length > 0) { + //Remove Listeners + this._removeWidgetListeners(); + } + } else { + if (this._widgetHandles.length === 0) { + this._attachWidgetListeners(); + } + } + } + }, + /** + * Remove the attached widget listeners + * @method _removeWidgetListeners + * @private + */ + _removeWidgetListeners: function() { + Y.Array.each(this._widgetHandles, function(handle) { + handle.detach(); + }); + this._widgetHandles = []; + }, + /** + * If this is a Widget, then attach the positioning listeners + * @method _attachWidgetListeners + * @private + */ + _attachWidgetListeners: function() { + //if this thing is a widget, and it uses widgetposition... + if (this._usesWidgetPosition(this._widget)) { + + //set the x,y on the widget's ATTRS + this._widgetHandles.push(this.on(EV_DRAG, this._setWidgetCoords)); + + //store the new position that the widget ends up on + this._widgetHandles.push(this.on(EV_DRAG_END, this._updateStopPosition)); + } + }, + /** + * Sets up event listeners on drag events if interacting with a widget + * + * @method initializer + * @protected + */ + initializer: function(config) { + + this._widgetHandles = []; + + this._widget = config.widget; + + this.on(EV_START, this._checkEvents); //Always run, don't check + + this._attachWidgetListeners(); + + }, + + /** + * Updates x,y or xy attributes on widget based on where the widget is dragged + * + * @method initializer + * @param {EventFacade} e Event Facade + * @private + */ + _setWidgetCoords: function(e) { + + //get the last position where the widget was, or get the starting point + var nodeXY = this._stoppedPosition || e.target.nodeXY, + realXY = e.target.realXY, + + //amount moved = [(x2 - x1) , (y2 - y1)] + movedXY = [realXY[0] - nodeXY[0], realXY[1] - nodeXY[1]]; + + //if both have changed.. + if (movedXY[0] !== 0 && movedXY[1] !== 0) { + this._widget.set('xy', realXY); + } + + //if only x is 0, set the Y + else if (movedXY[0] === 0) { + this._widget.set('y',realXY[1]); + } + + //otherwise, y is 0, so set X + else if (movedXY[1] === 0){ + this._widget.set('x', realXY[0]); + } + }, + + /** + * Updates the last position where the widget was stopped. + * + * @method _updateStopPosition + * @param {EventFacade} e Event Facade + * @private + */ + _updateStopPosition: function(e) { + this._stoppedPosition = e.target.realXY; + } + }); + + Y.namespace('Plugin'); + Y.Plugin.Drag = Drag; + + + + + +}, '@VERSION@', {"optional": ["dd-constrain", "dd-proxy"], "requires": ["dd-drag"]}); diff --git a/src/build/dd-proxy/dd-proxy-coverage.js b/src/build/dd-proxy/dd-proxy-coverage.js new file mode 100644 index 00000000000..b4185b401eb --- /dev/null +++ b/src/build/dd-proxy/dd-proxy-coverage.js @@ -0,0 +1,6 @@ +if (typeof __coverage__ === 'undefined') { __coverage__ = {}; } +if (!__coverage__['build/dd-proxy/dd-proxy.js']) { + __coverage__['build/dd-proxy/dd-proxy.js'] = {"path":"build/dd-proxy/dd-proxy.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0},"b":{"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0],"8":[0,0],"9":[0,0],"10":[0,0],"11":[0,0],"12":[0,0],"13":[0,0],"14":[0,0],"15":[0,0]},"f":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":39}}},"2":{"name":"(anonymous_2)","line":21,"loc":{"start":{"line":21,"column":12},"end":{"line":21,"column":23}}},"3":{"name":"(anonymous_3)","line":102,"loc":{"start":{"line":102,"column":15},"end":{"line":102,"column":26}}},"4":{"name":"(anonymous_4)","line":117,"loc":{"start":{"line":117,"column":38},"end":{"line":117,"column":50}}},"5":{"name":"(anonymous_5)","line":120,"loc":{"start":{"line":120,"column":43},"end":{"line":120,"column":54}}},"6":{"name":"(anonymous_6)","line":125,"loc":{"start":{"line":125,"column":42},"end":{"line":125,"column":53}}},"7":{"name":"(anonymous_7)","line":141,"loc":{"start":{"line":141,"column":21},"end":{"line":141,"column":32}}},"8":{"name":"(anonymous_8)","line":144,"loc":{"start":{"line":144,"column":20},"end":{"line":144,"column":31}}},"9":{"name":"(anonymous_9)","line":146,"loc":{"start":{"line":146,"column":38},"end":{"line":146,"column":50}}},"10":{"name":"(anonymous_10)","line":151,"loc":{"start":{"line":151,"column":15},"end":{"line":151,"column":26}}},"11":{"name":"(anonymous_11)","line":180,"loc":{"start":{"line":180,"column":22},"end":{"line":180,"column":33}}},"12":{"name":"(anonymous_12)","line":209,"loc":{"start":{"line":209,"column":19},"end":{"line":209,"column":34}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":251,"column":43}},"2":{"start":{"line":16,"column":4},"end":{"line":23,"column":10}},"3":{"start":{"line":22,"column":12},"end":{"line":22,"column":60}},"4":{"start":{"line":25,"column":4},"end":{"line":25,"column":23}},"5":{"start":{"line":35,"column":4},"end":{"line":35,"column":19}},"6":{"start":{"line":37,"column":4},"end":{"line":88,"column":6}},"7":{"start":{"line":90,"column":4},"end":{"line":165,"column":6}},"8":{"start":{"line":103,"column":12},"end":{"line":107,"column":13}},"9":{"start":{"line":104,"column":16},"end":{"line":104,"column":35}},"10":{"start":{"line":105,"column":16},"end":{"line":105,"column":59}},"11":{"start":{"line":106,"column":16},"end":{"line":106,"column":23}},"12":{"start":{"line":108,"column":12},"end":{"line":110,"column":13}},"13":{"start":{"line":109,"column":16},"end":{"line":109,"column":33}},"14":{"start":{"line":111,"column":12},"end":{"line":111,"column":74}},"15":{"start":{"line":112,"column":12},"end":{"line":116,"column":13}},"16":{"start":{"line":113,"column":16},"end":{"line":115,"column":17}},"17":{"start":{"line":114,"column":20},"end":{"line":114,"column":52}},"18":{"start":{"line":117,"column":12},"end":{"line":119,"column":15}},"19":{"start":{"line":118,"column":16},"end":{"line":118,"column":27}},"20":{"start":{"line":120,"column":12},"end":{"line":124,"column":22}},"21":{"start":{"line":121,"column":16},"end":{"line":123,"column":17}},"22":{"start":{"line":122,"column":20},"end":{"line":122,"column":40}},"23":{"start":{"line":125,"column":12},"end":{"line":138,"column":22}},"24":{"start":{"line":126,"column":16},"end":{"line":137,"column":17}},"25":{"start":{"line":127,"column":20},"end":{"line":129,"column":21}},"26":{"start":{"line":128,"column":24},"end":{"line":128,"column":58}},"27":{"start":{"line":130,"column":20},"end":{"line":132,"column":21}},"28":{"start":{"line":131,"column":24},"end":{"line":131,"column":72}},"29":{"start":{"line":133,"column":20},"end":{"line":136,"column":21}},"30":{"start":{"line":134,"column":24},"end":{"line":134,"column":53}},"31":{"start":{"line":135,"column":24},"end":{"line":135,"column":56}},"32":{"start":{"line":139,"column":12},"end":{"line":139,"column":34}},"33":{"start":{"line":142,"column":12},"end":{"line":142,"column":25}},"34":{"start":{"line":145,"column":12},"end":{"line":145,"column":38}},"35":{"start":{"line":146,"column":12},"end":{"line":148,"column":15}},"36":{"start":{"line":147,"column":16},"end":{"line":147,"column":27}},"37":{"start":{"line":149,"column":12},"end":{"line":149,"column":48}},"38":{"start":{"line":152,"column":12},"end":{"line":154,"column":38}},"39":{"start":{"line":156,"column":12},"end":{"line":156,"column":65}},"40":{"start":{"line":158,"column":12},"end":{"line":158,"column":27}},"41":{"start":{"line":159,"column":12},"end":{"line":159,"column":43}},"42":{"start":{"line":160,"column":12},"end":{"line":160,"column":47}},"43":{"start":{"line":161,"column":12},"end":{"line":161,"column":47}},"44":{"start":{"line":162,"column":12},"end":{"line":162,"column":35}},"45":{"start":{"line":163,"column":12},"end":{"line":163,"column":21}},"46":{"start":{"line":167,"column":4},"end":{"line":167,"column":26}},"47":{"start":{"line":168,"column":4},"end":{"line":168,"column":31}},"48":{"start":{"line":169,"column":4},"end":{"line":169,"column":25}},"49":{"start":{"line":172,"column":4},"end":{"line":243,"column":7}},"50":{"start":{"line":181,"column":12},"end":{"line":199,"column":13}},"51":{"start":{"line":182,"column":16},"end":{"line":182,"column":34}},"52":{"start":{"line":184,"column":16},"end":{"line":185,"column":34}},"53":{"start":{"line":187,"column":16},"end":{"line":193,"column":19}},"54":{"start":{"line":195,"column":16},"end":{"line":195,"column":29}},"55":{"start":{"line":196,"column":16},"end":{"line":196,"column":38}},"56":{"start":{"line":197,"column":16},"end":{"line":197,"column":54}},"57":{"start":{"line":198,"column":16},"end":{"line":198,"column":31}},"58":{"start":{"line":210,"column":12},"end":{"line":210,"column":78}},"59":{"start":{"line":212,"column":12},"end":{"line":212,"column":52}},"60":{"start":{"line":213,"column":12},"end":{"line":215,"column":13}},"61":{"start":{"line":214,"column":16},"end":{"line":214,"column":44}},"62":{"start":{"line":216,"column":12},"end":{"line":218,"column":13}},"63":{"start":{"line":217,"column":16},"end":{"line":217,"column":44}},"64":{"start":{"line":220,"column":12},"end":{"line":225,"column":15}},"65":{"start":{"line":227,"column":12},"end":{"line":229,"column":13}},"66":{"start":{"line":228,"column":16},"end":{"line":228,"column":39}},"67":{"start":{"line":231,"column":12},"end":{"line":236,"column":13}},"68":{"start":{"line":232,"column":16},"end":{"line":235,"column":19}},"69":{"start":{"line":238,"column":12},"end":{"line":240,"column":13}},"70":{"start":{"line":239,"column":16},"end":{"line":239,"column":37}},"71":{"start":{"line":241,"column":12},"end":{"line":241,"column":48}}},"branchMap":{"1":{"line":103,"type":"if","locations":[{"start":{"line":103,"column":12},"end":{"line":103,"column":12}},{"start":{"line":103,"column":12},"end":{"line":103,"column":12}}]},"2":{"line":108,"type":"if","locations":[{"start":{"line":108,"column":12},"end":{"line":108,"column":12}},{"start":{"line":108,"column":12},"end":{"line":108,"column":12}}]},"3":{"line":112,"type":"if","locations":[{"start":{"line":112,"column":12},"end":{"line":112,"column":12}},{"start":{"line":112,"column":12},"end":{"line":112,"column":12}}]},"4":{"line":113,"type":"if","locations":[{"start":{"line":113,"column":16},"end":{"line":113,"column":16}},{"start":{"line":113,"column":16},"end":{"line":113,"column":16}}]},"5":{"line":121,"type":"if","locations":[{"start":{"line":121,"column":16},"end":{"line":121,"column":16}},{"start":{"line":121,"column":16},"end":{"line":121,"column":16}}]},"6":{"line":126,"type":"if","locations":[{"start":{"line":126,"column":16},"end":{"line":126,"column":16}},{"start":{"line":126,"column":16},"end":{"line":126,"column":16}}]},"7":{"line":127,"type":"if","locations":[{"start":{"line":127,"column":20},"end":{"line":127,"column":20}},{"start":{"line":127,"column":20},"end":{"line":127,"column":20}}]},"8":{"line":130,"type":"if","locations":[{"start":{"line":130,"column":20},"end":{"line":130,"column":20}},{"start":{"line":130,"column":20},"end":{"line":130,"column":20}}]},"9":{"line":133,"type":"if","locations":[{"start":{"line":133,"column":20},"end":{"line":133,"column":20}},{"start":{"line":133,"column":20},"end":{"line":133,"column":20}}]},"10":{"line":181,"type":"if","locations":[{"start":{"line":181,"column":12},"end":{"line":181,"column":12}},{"start":{"line":181,"column":12},"end":{"line":181,"column":12}}]},"11":{"line":213,"type":"if","locations":[{"start":{"line":213,"column":12},"end":{"line":213,"column":12}},{"start":{"line":213,"column":12},"end":{"line":213,"column":12}}]},"12":{"line":216,"type":"if","locations":[{"start":{"line":216,"column":12},"end":{"line":216,"column":12}},{"start":{"line":216,"column":12},"end":{"line":216,"column":12}}]},"13":{"line":227,"type":"if","locations":[{"start":{"line":227,"column":12},"end":{"line":227,"column":12}},{"start":{"line":227,"column":12},"end":{"line":227,"column":12}}]},"14":{"line":231,"type":"if","locations":[{"start":{"line":231,"column":12},"end":{"line":231,"column":12}},{"start":{"line":231,"column":12},"end":{"line":231,"column":12}}]},"15":{"line":238,"type":"if","locations":[{"start":{"line":238,"column":12},"end":{"line":238,"column":12}},{"start":{"line":238,"column":12},"end":{"line":238,"column":12}}]}},"code":["(function () { YUI.add('dd-proxy', function (Y, NAME) {","",""," /**"," * Plugin for dd-drag for creating a proxy drag node, instead of dragging the original node."," * @module dd"," * @submodule dd-proxy"," */"," /**"," * Plugin for dd-drag for creating a proxy drag node, instead of dragging the original node."," * @class DDProxy"," * @extends Base"," * @constructor"," * @namespace Plugin"," */"," var DDM = Y.DD.DDM,"," NODE = 'node',"," DRAG_NODE = 'dragNode',"," HOST = 'host',"," TRUE = true, proto,"," P = function() {"," P.superclass.constructor.apply(this, arguments);"," };",""," P.NAME = 'DDProxy';"," /**"," * The Proxy instance will be placed on the Drag instance under the proxy namespace."," * @property NS"," * @default con"," * @readonly"," * @protected"," * @static"," * @type {String}"," */"," P.NS = 'proxy';",""," P.ATTRS = {"," host: {"," },"," /**"," * Move the original node at the end of the drag. Default: true"," * @attribute moveOnEnd"," * @type Boolean"," */"," moveOnEnd: {"," value: TRUE"," },"," /**"," * Hide the drag node at the end of the drag. Default: true"," * @attribute hideOnEnd"," * @type Boolean"," */"," hideOnEnd: {"," value: TRUE"," },"," /**"," * Make the Proxy node assume the size of the original node. Default: true"," * @attribute resizeFrame"," * @type Boolean"," */"," resizeFrame: {"," value: TRUE"," },"," /**"," * Make the Proxy node appear in the same place as the original node. Default: true"," * @attribute positionProxy"," * @type Boolean"," */"," positionProxy: {"," value: TRUE"," },"," /**"," * The default border style for the border of the proxy. Default: 1px solid #808080"," * @attribute borderStyle"," * @type Boolean"," */"," borderStyle: {"," value: '1px solid #808080'"," },"," /**"," * Should the node be cloned into the proxy for you. Default: false"," * @attribute cloneNode"," * @type Boolean"," */"," cloneNode: {"," value: false"," }"," };",""," proto = {"," /**"," * Holds the event handles for setting the proxy"," * @private"," * @property _hands"," */"," _hands: null,"," /**"," * Handler for the proxy config attribute"," * @private"," * @method _init"," */"," _init: function() {"," if (!DDM._proxy) {"," DDM._createFrame();"," Y.on('domready', Y.bind(this._init, this));"," return;"," }"," if (!this._hands) {"," this._hands = [];"," }"," var h, h1, host = this.get(HOST), dnode = host.get(DRAG_NODE);"," if (dnode.compareTo(host.get(NODE))) {"," if (DDM._proxy) {"," host.set(DRAG_NODE, DDM._proxy);"," }"," }"," Y.Array.each(this._hands, function(v) {"," v.detach();"," });"," h = DDM.on('ddm:start', Y.bind(function() {"," if (DDM.activeDrag === host) {"," DDM._setFrame(host);"," }"," }, this));"," h1 = DDM.on('ddm:end', Y.bind(function() {"," if (host.get('dragging')) {"," if (this.get('moveOnEnd')) {"," host.get(NODE).setXY(host.lastXY);"," }"," if (this.get('hideOnEnd')) {"," host.get(DRAG_NODE).setStyle('display', 'none');"," }"," if (this.get('cloneNode')) {"," host.get(DRAG_NODE).remove();"," host.set(DRAG_NODE, DDM._proxy);"," }"," }"," }, this));"," this._hands = [h, h1];"," },"," initializer: function() {"," this._init();"," },"," destructor: function() {"," var host = this.get(HOST);"," Y.Array.each(this._hands, function(v) {"," v.detach();"," });"," host.set(DRAG_NODE, host.get(NODE));"," },"," clone: function() {"," var host = this.get(HOST),"," n = host.get(NODE),"," c = n.cloneNode(true);",""," c.all('input[type=\"radio\"]').removeAttribute('name');",""," delete c._yuid;"," c.setAttribute('id', Y.guid());"," c.setStyle('position', 'absolute');"," n.get('parentNode').appendChild(c);"," host.set(DRAG_NODE, c);"," return c;"," }"," };",""," Y.namespace('Plugin');"," Y.extend(P, Y.Base, proto);"," Y.Plugin.DDProxy = P;",""," //Add a couple of methods to the DDM"," Y.mix(DDM, {"," /**"," * Create the proxy element if it doesn't already exist and set the DD.DDM._proxy value"," * @private"," * @for DDM"," * @namespace DD"," * @method _createFrame"," */"," _createFrame: function() {"," if (!DDM._proxy) {"," DDM._proxy = TRUE;",""," var p = Y.Node.create('
'),"," b = Y.one('body');",""," p.setStyles({"," position: 'absolute',"," display: 'none',"," zIndex: '999',"," top: '-999px',"," left: '-999px'"," });",""," b.prepend(p);"," p.set('id', Y.guid());"," p.addClass(DDM.CSS_PREFIX + '-proxy');"," DDM._proxy = p;"," }"," },"," /**"," * If resizeProxy is set to true (default) it will resize the proxy element to match the size of the Drag Element."," * If positionProxy is set to true (default) it will position the proxy element in the same location as the Drag Element."," * @private"," * @for DDM"," * @namespace DD"," * @method _setFrame"," */"," _setFrame: function(drag) {"," var n = drag.get(NODE), d = drag.get(DRAG_NODE), ah, cur = 'auto';",""," ah = DDM.activeDrag.get('activeHandle');"," if (ah) {"," cur = ah.getStyle('cursor');"," }"," if (cur === 'auto') {"," cur = DDM.get('dragCursor');"," }",""," d.setStyles({"," visibility: 'hidden',"," display: 'block',"," cursor: cur,"," border: drag.proxy.get('borderStyle')"," });",""," if (drag.proxy.get('cloneNode')) {"," d = drag.proxy.clone();"," }",""," if (drag.proxy.get('resizeFrame')) {"," d.setStyles({"," height: n.get('offsetHeight') + 'px',"," width: n.get('offsetWidth') + 'px'"," });"," }",""," if (drag.proxy.get('positionProxy')) {"," d.setXY(drag.nodeXY);"," }"," d.setStyle('visibility', 'visible');"," }"," });",""," //Create the frame when DOM is ready"," //Y.on('domready', Y.bind(DDM._createFrame, DDM));","","","","","}, '@VERSION@', {\"requires\": [\"dd-drag\"]});","","}());"]}; +} +var __cov_brTuT2e$Svu1ra00z$FV0g = __coverage__['build/dd-proxy/dd-proxy.js']; +__cov_brTuT2e$Svu1ra00z$FV0g.s['1']++;YUI.add('dd-proxy',function(Y,NAME){__cov_brTuT2e$Svu1ra00z$FV0g.f['1']++;__cov_brTuT2e$Svu1ra00z$FV0g.s['2']++;var DDM=Y.DD.DDM,NODE='node',DRAG_NODE='dragNode',HOST='host',TRUE=true,proto,P=function(){__cov_brTuT2e$Svu1ra00z$FV0g.f['2']++;__cov_brTuT2e$Svu1ra00z$FV0g.s['3']++;P.superclass.constructor.apply(this,arguments);};__cov_brTuT2e$Svu1ra00z$FV0g.s['4']++;P.NAME='DDProxy';__cov_brTuT2e$Svu1ra00z$FV0g.s['5']++;P.NS='proxy';__cov_brTuT2e$Svu1ra00z$FV0g.s['6']++;P.ATTRS={host:{},moveOnEnd:{value:TRUE},hideOnEnd:{value:TRUE},resizeFrame:{value:TRUE},positionProxy:{value:TRUE},borderStyle:{value:'1px solid #808080'},cloneNode:{value:false}};__cov_brTuT2e$Svu1ra00z$FV0g.s['7']++;proto={_hands:null,_init:function(){__cov_brTuT2e$Svu1ra00z$FV0g.f['3']++;__cov_brTuT2e$Svu1ra00z$FV0g.s['8']++;if(!DDM._proxy){__cov_brTuT2e$Svu1ra00z$FV0g.b['1'][0]++;__cov_brTuT2e$Svu1ra00z$FV0g.s['9']++;DDM._createFrame();__cov_brTuT2e$Svu1ra00z$FV0g.s['10']++;Y.on('domready',Y.bind(this._init,this));__cov_brTuT2e$Svu1ra00z$FV0g.s['11']++;return;}else{__cov_brTuT2e$Svu1ra00z$FV0g.b['1'][1]++;}__cov_brTuT2e$Svu1ra00z$FV0g.s['12']++;if(!this._hands){__cov_brTuT2e$Svu1ra00z$FV0g.b['2'][0]++;__cov_brTuT2e$Svu1ra00z$FV0g.s['13']++;this._hands=[];}else{__cov_brTuT2e$Svu1ra00z$FV0g.b['2'][1]++;}__cov_brTuT2e$Svu1ra00z$FV0g.s['14']++;var h,h1,host=this.get(HOST),dnode=host.get(DRAG_NODE);__cov_brTuT2e$Svu1ra00z$FV0g.s['15']++;if(dnode.compareTo(host.get(NODE))){__cov_brTuT2e$Svu1ra00z$FV0g.b['3'][0]++;__cov_brTuT2e$Svu1ra00z$FV0g.s['16']++;if(DDM._proxy){__cov_brTuT2e$Svu1ra00z$FV0g.b['4'][0]++;__cov_brTuT2e$Svu1ra00z$FV0g.s['17']++;host.set(DRAG_NODE,DDM._proxy);}else{__cov_brTuT2e$Svu1ra00z$FV0g.b['4'][1]++;}}else{__cov_brTuT2e$Svu1ra00z$FV0g.b['3'][1]++;}__cov_brTuT2e$Svu1ra00z$FV0g.s['18']++;Y.Array.each(this._hands,function(v){__cov_brTuT2e$Svu1ra00z$FV0g.f['4']++;__cov_brTuT2e$Svu1ra00z$FV0g.s['19']++;v.detach();});__cov_brTuT2e$Svu1ra00z$FV0g.s['20']++;h=DDM.on('ddm:start',Y.bind(function(){__cov_brTuT2e$Svu1ra00z$FV0g.f['5']++;__cov_brTuT2e$Svu1ra00z$FV0g.s['21']++;if(DDM.activeDrag===host){__cov_brTuT2e$Svu1ra00z$FV0g.b['5'][0]++;__cov_brTuT2e$Svu1ra00z$FV0g.s['22']++;DDM._setFrame(host);}else{__cov_brTuT2e$Svu1ra00z$FV0g.b['5'][1]++;}},this));__cov_brTuT2e$Svu1ra00z$FV0g.s['23']++;h1=DDM.on('ddm:end',Y.bind(function(){__cov_brTuT2e$Svu1ra00z$FV0g.f['6']++;__cov_brTuT2e$Svu1ra00z$FV0g.s['24']++;if(host.get('dragging')){__cov_brTuT2e$Svu1ra00z$FV0g.b['6'][0]++;__cov_brTuT2e$Svu1ra00z$FV0g.s['25']++;if(this.get('moveOnEnd')){__cov_brTuT2e$Svu1ra00z$FV0g.b['7'][0]++;__cov_brTuT2e$Svu1ra00z$FV0g.s['26']++;host.get(NODE).setXY(host.lastXY);}else{__cov_brTuT2e$Svu1ra00z$FV0g.b['7'][1]++;}__cov_brTuT2e$Svu1ra00z$FV0g.s['27']++;if(this.get('hideOnEnd')){__cov_brTuT2e$Svu1ra00z$FV0g.b['8'][0]++;__cov_brTuT2e$Svu1ra00z$FV0g.s['28']++;host.get(DRAG_NODE).setStyle('display','none');}else{__cov_brTuT2e$Svu1ra00z$FV0g.b['8'][1]++;}__cov_brTuT2e$Svu1ra00z$FV0g.s['29']++;if(this.get('cloneNode')){__cov_brTuT2e$Svu1ra00z$FV0g.b['9'][0]++;__cov_brTuT2e$Svu1ra00z$FV0g.s['30']++;host.get(DRAG_NODE).remove();__cov_brTuT2e$Svu1ra00z$FV0g.s['31']++;host.set(DRAG_NODE,DDM._proxy);}else{__cov_brTuT2e$Svu1ra00z$FV0g.b['9'][1]++;}}else{__cov_brTuT2e$Svu1ra00z$FV0g.b['6'][1]++;}},this));__cov_brTuT2e$Svu1ra00z$FV0g.s['32']++;this._hands=[h,h1];},initializer:function(){__cov_brTuT2e$Svu1ra00z$FV0g.f['7']++;__cov_brTuT2e$Svu1ra00z$FV0g.s['33']++;this._init();},destructor:function(){__cov_brTuT2e$Svu1ra00z$FV0g.f['8']++;__cov_brTuT2e$Svu1ra00z$FV0g.s['34']++;var host=this.get(HOST);__cov_brTuT2e$Svu1ra00z$FV0g.s['35']++;Y.Array.each(this._hands,function(v){__cov_brTuT2e$Svu1ra00z$FV0g.f['9']++;__cov_brTuT2e$Svu1ra00z$FV0g.s['36']++;v.detach();});__cov_brTuT2e$Svu1ra00z$FV0g.s['37']++;host.set(DRAG_NODE,host.get(NODE));},clone:function(){__cov_brTuT2e$Svu1ra00z$FV0g.f['10']++;__cov_brTuT2e$Svu1ra00z$FV0g.s['38']++;var host=this.get(HOST),n=host.get(NODE),c=n.cloneNode(true);__cov_brTuT2e$Svu1ra00z$FV0g.s['39']++;c.all('input[type="radio"]').removeAttribute('name');__cov_brTuT2e$Svu1ra00z$FV0g.s['40']++;delete c._yuid;__cov_brTuT2e$Svu1ra00z$FV0g.s['41']++;c.setAttribute('id',Y.guid());__cov_brTuT2e$Svu1ra00z$FV0g.s['42']++;c.setStyle('position','absolute');__cov_brTuT2e$Svu1ra00z$FV0g.s['43']++;n.get('parentNode').appendChild(c);__cov_brTuT2e$Svu1ra00z$FV0g.s['44']++;host.set(DRAG_NODE,c);__cov_brTuT2e$Svu1ra00z$FV0g.s['45']++;return c;}};__cov_brTuT2e$Svu1ra00z$FV0g.s['46']++;Y.namespace('Plugin');__cov_brTuT2e$Svu1ra00z$FV0g.s['47']++;Y.extend(P,Y.Base,proto);__cov_brTuT2e$Svu1ra00z$FV0g.s['48']++;Y.Plugin.DDProxy=P;__cov_brTuT2e$Svu1ra00z$FV0g.s['49']++;Y.mix(DDM,{_createFrame:function(){__cov_brTuT2e$Svu1ra00z$FV0g.f['11']++;__cov_brTuT2e$Svu1ra00z$FV0g.s['50']++;if(!DDM._proxy){__cov_brTuT2e$Svu1ra00z$FV0g.b['10'][0]++;__cov_brTuT2e$Svu1ra00z$FV0g.s['51']++;DDM._proxy=TRUE;__cov_brTuT2e$Svu1ra00z$FV0g.s['52']++;var p=Y.Node.create('
'),b=Y.one('body');__cov_brTuT2e$Svu1ra00z$FV0g.s['53']++;p.setStyles({position:'absolute',display:'none',zIndex:'999',top:'-999px',left:'-999px'});__cov_brTuT2e$Svu1ra00z$FV0g.s['54']++;b.prepend(p);__cov_brTuT2e$Svu1ra00z$FV0g.s['55']++;p.set('id',Y.guid());__cov_brTuT2e$Svu1ra00z$FV0g.s['56']++;p.addClass(DDM.CSS_PREFIX+'-proxy');__cov_brTuT2e$Svu1ra00z$FV0g.s['57']++;DDM._proxy=p;}else{__cov_brTuT2e$Svu1ra00z$FV0g.b['10'][1]++;}},_setFrame:function(drag){__cov_brTuT2e$Svu1ra00z$FV0g.f['12']++;__cov_brTuT2e$Svu1ra00z$FV0g.s['58']++;var n=drag.get(NODE),d=drag.get(DRAG_NODE),ah,cur='auto';__cov_brTuT2e$Svu1ra00z$FV0g.s['59']++;ah=DDM.activeDrag.get('activeHandle');__cov_brTuT2e$Svu1ra00z$FV0g.s['60']++;if(ah){__cov_brTuT2e$Svu1ra00z$FV0g.b['11'][0]++;__cov_brTuT2e$Svu1ra00z$FV0g.s['61']++;cur=ah.getStyle('cursor');}else{__cov_brTuT2e$Svu1ra00z$FV0g.b['11'][1]++;}__cov_brTuT2e$Svu1ra00z$FV0g.s['62']++;if(cur==='auto'){__cov_brTuT2e$Svu1ra00z$FV0g.b['12'][0]++;__cov_brTuT2e$Svu1ra00z$FV0g.s['63']++;cur=DDM.get('dragCursor');}else{__cov_brTuT2e$Svu1ra00z$FV0g.b['12'][1]++;}__cov_brTuT2e$Svu1ra00z$FV0g.s['64']++;d.setStyles({visibility:'hidden',display:'block',cursor:cur,border:drag.proxy.get('borderStyle')});__cov_brTuT2e$Svu1ra00z$FV0g.s['65']++;if(drag.proxy.get('cloneNode')){__cov_brTuT2e$Svu1ra00z$FV0g.b['13'][0]++;__cov_brTuT2e$Svu1ra00z$FV0g.s['66']++;d=drag.proxy.clone();}else{__cov_brTuT2e$Svu1ra00z$FV0g.b['13'][1]++;}__cov_brTuT2e$Svu1ra00z$FV0g.s['67']++;if(drag.proxy.get('resizeFrame')){__cov_brTuT2e$Svu1ra00z$FV0g.b['14'][0]++;__cov_brTuT2e$Svu1ra00z$FV0g.s['68']++;d.setStyles({height:n.get('offsetHeight')+'px',width:n.get('offsetWidth')+'px'});}else{__cov_brTuT2e$Svu1ra00z$FV0g.b['14'][1]++;}__cov_brTuT2e$Svu1ra00z$FV0g.s['69']++;if(drag.proxy.get('positionProxy')){__cov_brTuT2e$Svu1ra00z$FV0g.b['15'][0]++;__cov_brTuT2e$Svu1ra00z$FV0g.s['70']++;d.setXY(drag.nodeXY);}else{__cov_brTuT2e$Svu1ra00z$FV0g.b['15'][1]++;}__cov_brTuT2e$Svu1ra00z$FV0g.s['71']++;d.setStyle('visibility','visible');}});},'@VERSION@',{'requires':['dd-drag']}); diff --git a/src/build/dd-proxy/dd-proxy-debug.js b/src/build/dd-proxy/dd-proxy-debug.js new file mode 100644 index 00000000000..1112daaf5bd --- /dev/null +++ b/src/build/dd-proxy/dd-proxy-debug.js @@ -0,0 +1,251 @@ +YUI.add('dd-proxy', function (Y, NAME) { + + + /** + * Plugin for dd-drag for creating a proxy drag node, instead of dragging the original node. + * @module dd + * @submodule dd-proxy + */ + /** + * Plugin for dd-drag for creating a proxy drag node, instead of dragging the original node. + * @class DDProxy + * @extends Base + * @constructor + * @namespace Plugin + */ + var DDM = Y.DD.DDM, + NODE = 'node', + DRAG_NODE = 'dragNode', + HOST = 'host', + TRUE = true, proto, + P = function() { + P.superclass.constructor.apply(this, arguments); + }; + + P.NAME = 'DDProxy'; + /** + * The Proxy instance will be placed on the Drag instance under the proxy namespace. + * @property NS + * @default con + * @readonly + * @protected + * @static + * @type {String} + */ + P.NS = 'proxy'; + + P.ATTRS = { + host: { + }, + /** + * Move the original node at the end of the drag. Default: true + * @attribute moveOnEnd + * @type Boolean + */ + moveOnEnd: { + value: TRUE + }, + /** + * Hide the drag node at the end of the drag. Default: true + * @attribute hideOnEnd + * @type Boolean + */ + hideOnEnd: { + value: TRUE + }, + /** + * Make the Proxy node assume the size of the original node. Default: true + * @attribute resizeFrame + * @type Boolean + */ + resizeFrame: { + value: TRUE + }, + /** + * Make the Proxy node appear in the same place as the original node. Default: true + * @attribute positionProxy + * @type Boolean + */ + positionProxy: { + value: TRUE + }, + /** + * The default border style for the border of the proxy. Default: 1px solid #808080 + * @attribute borderStyle + * @type Boolean + */ + borderStyle: { + value: '1px solid #808080' + }, + /** + * Should the node be cloned into the proxy for you. Default: false + * @attribute cloneNode + * @type Boolean + */ + cloneNode: { + value: false + } + }; + + proto = { + /** + * Holds the event handles for setting the proxy + * @private + * @property _hands + */ + _hands: null, + /** + * Handler for the proxy config attribute + * @private + * @method _init + */ + _init: function() { + if (!DDM._proxy) { + DDM._createFrame(); + Y.on('domready', Y.bind(this._init, this)); + return; + } + if (!this._hands) { + this._hands = []; + } + var h, h1, host = this.get(HOST), dnode = host.get(DRAG_NODE); + if (dnode.compareTo(host.get(NODE))) { + if (DDM._proxy) { + host.set(DRAG_NODE, DDM._proxy); + } + } + Y.Array.each(this._hands, function(v) { + v.detach(); + }); + h = DDM.on('ddm:start', Y.bind(function() { + if (DDM.activeDrag === host) { + DDM._setFrame(host); + } + }, this)); + h1 = DDM.on('ddm:end', Y.bind(function() { + if (host.get('dragging')) { + if (this.get('moveOnEnd')) { + host.get(NODE).setXY(host.lastXY); + } + if (this.get('hideOnEnd')) { + host.get(DRAG_NODE).setStyle('display', 'none'); + } + if (this.get('cloneNode')) { + host.get(DRAG_NODE).remove(); + host.set(DRAG_NODE, DDM._proxy); + } + } + }, this)); + this._hands = [h, h1]; + }, + initializer: function() { + this._init(); + }, + destructor: function() { + var host = this.get(HOST); + Y.Array.each(this._hands, function(v) { + v.detach(); + }); + host.set(DRAG_NODE, host.get(NODE)); + }, + clone: function() { + var host = this.get(HOST), + n = host.get(NODE), + c = n.cloneNode(true); + + c.all('input[type="radio"]').removeAttribute('name'); + + delete c._yuid; + c.setAttribute('id', Y.guid()); + c.setStyle('position', 'absolute'); + n.get('parentNode').appendChild(c); + host.set(DRAG_NODE, c); + return c; + } + }; + + Y.namespace('Plugin'); + Y.extend(P, Y.Base, proto); + Y.Plugin.DDProxy = P; + + //Add a couple of methods to the DDM + Y.mix(DDM, { + /** + * Create the proxy element if it doesn't already exist and set the DD.DDM._proxy value + * @private + * @for DDM + * @namespace DD + * @method _createFrame + */ + _createFrame: function() { + if (!DDM._proxy) { + DDM._proxy = TRUE; + + var p = Y.Node.create('
'), + b = Y.one('body'); + + p.setStyles({ + position: 'absolute', + display: 'none', + zIndex: '999', + top: '-999px', + left: '-999px' + }); + + b.prepend(p); + p.set('id', Y.guid()); + p.addClass(DDM.CSS_PREFIX + '-proxy'); + DDM._proxy = p; + } + }, + /** + * If resizeProxy is set to true (default) it will resize the proxy element to match the size of the Drag Element. + * If positionProxy is set to true (default) it will position the proxy element in the same location as the Drag Element. + * @private + * @for DDM + * @namespace DD + * @method _setFrame + */ + _setFrame: function(drag) { + var n = drag.get(NODE), d = drag.get(DRAG_NODE), ah, cur = 'auto'; + + ah = DDM.activeDrag.get('activeHandle'); + if (ah) { + cur = ah.getStyle('cursor'); + } + if (cur === 'auto') { + cur = DDM.get('dragCursor'); + } + + d.setStyles({ + visibility: 'hidden', + display: 'block', + cursor: cur, + border: drag.proxy.get('borderStyle') + }); + + if (drag.proxy.get('cloneNode')) { + d = drag.proxy.clone(); + } + + if (drag.proxy.get('resizeFrame')) { + d.setStyles({ + height: n.get('offsetHeight') + 'px', + width: n.get('offsetWidth') + 'px' + }); + } + + if (drag.proxy.get('positionProxy')) { + d.setXY(drag.nodeXY); + } + d.setStyle('visibility', 'visible'); + } + }); + + //Create the frame when DOM is ready + //Y.on('domready', Y.bind(DDM._createFrame, DDM)); + + + + +}, '@VERSION@', {"requires": ["dd-drag"]}); diff --git a/src/build/dd-proxy/dd-proxy-min.js b/src/build/dd-proxy/dd-proxy-min.js new file mode 100644 index 00000000000..5b3f340fcf5 --- /dev/null +++ b/src/build/dd-proxy/dd-proxy-min.js @@ -0,0 +1 @@ +YUI.add("dd-proxy",function(e,t){var n=e.DD.DDM,r="node",i="dragNode",s="host",o=!0,u,a=function(){a.superclass.constructor.apply(this,arguments)};a.NAME="DDProxy",a.NS="proxy",a.ATTRS={host:{},moveOnEnd:{value:o},hideOnEnd:{value:o},resizeFrame:{value:o},positionProxy:{value:o},borderStyle:{value:"1px solid #808080"},cloneNode:{value:!1}},u={_hands:null,_init:function(){if(!n._proxy){n._createFrame(),e.on("domready",e.bind(this._init,this));return}this._hands||(this._hands=[]);var t,o,u=this.get(s),a=u.get(i);a.compareTo(u.get(r))&&n._proxy&&u.set(i,n._proxy),e.Array.each(this._hands,function(e){e.detach()}),t=n.on("ddm:start",e.bind(function(){n.activeDrag===u&&n._setFrame(u)},this)),o=n.on("ddm:end",e.bind(function(){u.get("dragging")&&(this.get("moveOnEnd")&&u.get(r).setXY(u.lastXY),this.get("hideOnEnd")&&u.get(i).setStyle("display","none"),this.get("cloneNode")&&(u.get(i).remove(),u.set(i,n._proxy)))},this)),this._hands=[t,o]},initializer:function(){this._init()},destructor:function(){var t=this.get(s);e.Array.each(this._hands,function(e){e.detach()}),t.set(i,t.get(r))},clone:function(){var t=this.get(s),n=t.get(r),o=n.cloneNode(!0);return o.all('input[type="radio"]').removeAttribute("name"),delete o._yuid,o.setAttribute("id",e.guid()),o.setStyle("position","absolute"),n.get("parentNode").appendChild(o),t.set(i,o),o}},e.namespace("Plugin"),e.extend(a,e.Base,u),e.Plugin.DDProxy=a,e.mix(n,{_createFrame:function(){if(!n._proxy){n._proxy=o;var t=e.Node.create("
"),r=e.one("body");t.setStyles({position:"absolute",display:"none",zIndex:"999",top:"-999px",left:"-999px"}),r.prepend(t),t.set("id",e.guid()),t.addClass(n.CSS_PREFIX+"-proxy"),n._proxy=t}},_setFrame:function(e){var t=e.get(r),s=e.get(i),o,u="auto";o=n.activeDrag.get("activeHandle"),o&&(u=o.getStyle("cursor")),u==="auto"&&(u=n.get("dragCursor")),s.setStyles({visibility:"hidden",display:"block",cursor:u,border:e.proxy.get("borderStyle")}),e.proxy.get("cloneNode")&&(s=e.proxy.clone()),e.proxy.get("resizeFrame")&&s.setStyles({height:t.get("offsetHeight")+"px",width:t.get("offsetWidth")+"px"}),e.proxy.get("positionProxy")&&s.setXY(e.nodeXY),s.setStyle("visibility","visible")}})},"@VERSION@",{requires:["dd-drag"]}); diff --git a/src/build/dd-proxy/dd-proxy.js b/src/build/dd-proxy/dd-proxy.js new file mode 100644 index 00000000000..1112daaf5bd --- /dev/null +++ b/src/build/dd-proxy/dd-proxy.js @@ -0,0 +1,251 @@ +YUI.add('dd-proxy', function (Y, NAME) { + + + /** + * Plugin for dd-drag for creating a proxy drag node, instead of dragging the original node. + * @module dd + * @submodule dd-proxy + */ + /** + * Plugin for dd-drag for creating a proxy drag node, instead of dragging the original node. + * @class DDProxy + * @extends Base + * @constructor + * @namespace Plugin + */ + var DDM = Y.DD.DDM, + NODE = 'node', + DRAG_NODE = 'dragNode', + HOST = 'host', + TRUE = true, proto, + P = function() { + P.superclass.constructor.apply(this, arguments); + }; + + P.NAME = 'DDProxy'; + /** + * The Proxy instance will be placed on the Drag instance under the proxy namespace. + * @property NS + * @default con + * @readonly + * @protected + * @static + * @type {String} + */ + P.NS = 'proxy'; + + P.ATTRS = { + host: { + }, + /** + * Move the original node at the end of the drag. Default: true + * @attribute moveOnEnd + * @type Boolean + */ + moveOnEnd: { + value: TRUE + }, + /** + * Hide the drag node at the end of the drag. Default: true + * @attribute hideOnEnd + * @type Boolean + */ + hideOnEnd: { + value: TRUE + }, + /** + * Make the Proxy node assume the size of the original node. Default: true + * @attribute resizeFrame + * @type Boolean + */ + resizeFrame: { + value: TRUE + }, + /** + * Make the Proxy node appear in the same place as the original node. Default: true + * @attribute positionProxy + * @type Boolean + */ + positionProxy: { + value: TRUE + }, + /** + * The default border style for the border of the proxy. Default: 1px solid #808080 + * @attribute borderStyle + * @type Boolean + */ + borderStyle: { + value: '1px solid #808080' + }, + /** + * Should the node be cloned into the proxy for you. Default: false + * @attribute cloneNode + * @type Boolean + */ + cloneNode: { + value: false + } + }; + + proto = { + /** + * Holds the event handles for setting the proxy + * @private + * @property _hands + */ + _hands: null, + /** + * Handler for the proxy config attribute + * @private + * @method _init + */ + _init: function() { + if (!DDM._proxy) { + DDM._createFrame(); + Y.on('domready', Y.bind(this._init, this)); + return; + } + if (!this._hands) { + this._hands = []; + } + var h, h1, host = this.get(HOST), dnode = host.get(DRAG_NODE); + if (dnode.compareTo(host.get(NODE))) { + if (DDM._proxy) { + host.set(DRAG_NODE, DDM._proxy); + } + } + Y.Array.each(this._hands, function(v) { + v.detach(); + }); + h = DDM.on('ddm:start', Y.bind(function() { + if (DDM.activeDrag === host) { + DDM._setFrame(host); + } + }, this)); + h1 = DDM.on('ddm:end', Y.bind(function() { + if (host.get('dragging')) { + if (this.get('moveOnEnd')) { + host.get(NODE).setXY(host.lastXY); + } + if (this.get('hideOnEnd')) { + host.get(DRAG_NODE).setStyle('display', 'none'); + } + if (this.get('cloneNode')) { + host.get(DRAG_NODE).remove(); + host.set(DRAG_NODE, DDM._proxy); + } + } + }, this)); + this._hands = [h, h1]; + }, + initializer: function() { + this._init(); + }, + destructor: function() { + var host = this.get(HOST); + Y.Array.each(this._hands, function(v) { + v.detach(); + }); + host.set(DRAG_NODE, host.get(NODE)); + }, + clone: function() { + var host = this.get(HOST), + n = host.get(NODE), + c = n.cloneNode(true); + + c.all('input[type="radio"]').removeAttribute('name'); + + delete c._yuid; + c.setAttribute('id', Y.guid()); + c.setStyle('position', 'absolute'); + n.get('parentNode').appendChild(c); + host.set(DRAG_NODE, c); + return c; + } + }; + + Y.namespace('Plugin'); + Y.extend(P, Y.Base, proto); + Y.Plugin.DDProxy = P; + + //Add a couple of methods to the DDM + Y.mix(DDM, { + /** + * Create the proxy element if it doesn't already exist and set the DD.DDM._proxy value + * @private + * @for DDM + * @namespace DD + * @method _createFrame + */ + _createFrame: function() { + if (!DDM._proxy) { + DDM._proxy = TRUE; + + var p = Y.Node.create('
'), + b = Y.one('body'); + + p.setStyles({ + position: 'absolute', + display: 'none', + zIndex: '999', + top: '-999px', + left: '-999px' + }); + + b.prepend(p); + p.set('id', Y.guid()); + p.addClass(DDM.CSS_PREFIX + '-proxy'); + DDM._proxy = p; + } + }, + /** + * If resizeProxy is set to true (default) it will resize the proxy element to match the size of the Drag Element. + * If positionProxy is set to true (default) it will position the proxy element in the same location as the Drag Element. + * @private + * @for DDM + * @namespace DD + * @method _setFrame + */ + _setFrame: function(drag) { + var n = drag.get(NODE), d = drag.get(DRAG_NODE), ah, cur = 'auto'; + + ah = DDM.activeDrag.get('activeHandle'); + if (ah) { + cur = ah.getStyle('cursor'); + } + if (cur === 'auto') { + cur = DDM.get('dragCursor'); + } + + d.setStyles({ + visibility: 'hidden', + display: 'block', + cursor: cur, + border: drag.proxy.get('borderStyle') + }); + + if (drag.proxy.get('cloneNode')) { + d = drag.proxy.clone(); + } + + if (drag.proxy.get('resizeFrame')) { + d.setStyles({ + height: n.get('offsetHeight') + 'px', + width: n.get('offsetWidth') + 'px' + }); + } + + if (drag.proxy.get('positionProxy')) { + d.setXY(drag.nodeXY); + } + d.setStyle('visibility', 'visible'); + } + }); + + //Create the frame when DOM is ready + //Y.on('domready', Y.bind(DDM._createFrame, DDM)); + + + + +}, '@VERSION@', {"requires": ["dd-drag"]}); diff --git a/src/build/dd-scroll/dd-scroll-coverage.js b/src/build/dd-scroll/dd-scroll-coverage.js new file mode 100644 index 00000000000..89fd1dd40e4 --- /dev/null +++ b/src/build/dd-scroll/dd-scroll-coverage.js @@ -0,0 +1,6 @@ +if (typeof __coverage__ === 'undefined') { __coverage__ = {}; } +if (!__coverage__['build/dd-scroll/dd-scroll.js']) { + __coverage__['build/dd-scroll/dd-scroll.js'] = {"path":"build/dd-scroll/dd-scroll.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0},"b":{"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0],"8":[0,0],"9":[0,0],"10":[0,0],"11":[0,0],"12":[0,0],"13":[0,0],"14":[0,0],"15":[0,0],"16":[0,0],"17":[0,0],"18":[0,0],"19":[0,0],"20":[0,0],"21":[0,0],"22":[0,0],"23":[0,0],"24":[0,0],"25":[0,0],"26":[0,0],"27":[0,0],"28":[0,0],"29":[0,0],"30":[0,0]},"f":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":40}}},"2":{"name":"(anonymous_2)","line":19,"loc":{"start":{"line":19,"column":12},"end":{"line":19,"column":23}}},"3":{"name":"(anonymous_3)","line":43,"loc":{"start":{"line":43,"column":20},"end":{"line":43,"column":35}}},"4":{"name":"(anonymous_4)","line":139,"loc":{"start":{"line":139,"column":22},"end":{"line":139,"column":33}}},"5":{"name":"(anonymous_5)","line":159,"loc":{"start":{"line":159,"column":21},"end":{"line":159,"column":32}}},"6":{"name":"(anonymous_6)","line":166,"loc":{"start":{"line":166,"column":45},"end":{"line":166,"column":56}}},"7":{"name":"(anonymous_7)","line":176,"loc":{"start":{"line":176,"column":25},"end":{"line":176,"column":40}}},"8":{"name":"(anonymous_8)","line":261,"loc":{"start":{"line":261,"column":21},"end":{"line":261,"column":32}}},"9":{"name":"(anonymous_9)","line":271,"loc":{"start":{"line":271,"column":23},"end":{"line":271,"column":34}}},"10":{"name":"(anonymous_10)","line":282,"loc":{"start":{"line":282,"column":15},"end":{"line":282,"column":27}}},"11":{"name":"(anonymous_11)","line":296,"loc":{"start":{"line":296,"column":22},"end":{"line":296,"column":33}}},"12":{"name":"(anonymous_12)","line":307,"loc":{"start":{"line":307,"column":15},"end":{"line":307,"column":26}}},"13":{"name":"(anonymous_13)","line":314,"loc":{"start":{"line":314,"column":13},"end":{"line":314,"column":24}}},"14":{"name":"(anonymous_14)","line":330,"loc":{"start":{"line":330,"column":9},"end":{"line":330,"column":20}}},"15":{"name":"(anonymous_15)","line":341,"loc":{"start":{"line":341,"column":20},"end":{"line":341,"column":37}}},"16":{"name":"(anonymous_16)","line":351,"loc":{"start":{"line":351,"column":21},"end":{"line":351,"column":32}}},"17":{"name":"(anonymous_17)","line":375,"loc":{"start":{"line":375,"column":9},"end":{"line":375,"column":20}}},"18":{"name":"(anonymous_18)","line":387,"loc":{"start":{"line":387,"column":20},"end":{"line":387,"column":35}}},"19":{"name":"(anonymous_19)","line":402,"loc":{"start":{"line":402,"column":21},"end":{"line":402,"column":32}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":423,"column":43}},"2":{"start":{"line":19,"column":4},"end":{"line":31,"column":35}},"3":{"start":{"line":20,"column":8},"end":{"line":20,"column":56}},"4":{"start":{"line":34,"column":4},"end":{"line":103,"column":6}},"5":{"start":{"line":44,"column":16},"end":{"line":46,"column":17}},"6":{"start":{"line":45,"column":20},"end":{"line":45,"column":32}},"7":{"start":{"line":47,"column":16},"end":{"line":47,"column":29}},"8":{"start":{"line":105,"column":4},"end":{"line":318,"column":7}},"9":{"start":{"line":140,"column":12},"end":{"line":148,"column":52}},"10":{"start":{"line":150,"column":12},"end":{"line":155,"column":14}},"11":{"start":{"line":156,"column":12},"end":{"line":156,"column":36}},"12":{"start":{"line":157,"column":12},"end":{"line":157,"column":21}},"13":{"start":{"line":160,"column":12},"end":{"line":160,"column":35}},"14":{"start":{"line":161,"column":12},"end":{"line":161,"column":60}},"15":{"start":{"line":162,"column":12},"end":{"line":162,"column":56}},"16":{"start":{"line":163,"column":12},"end":{"line":163,"column":57}},"17":{"start":{"line":166,"column":12},"end":{"line":168,"column":22}},"18":{"start":{"line":167,"column":16},"end":{"line":167,"column":43}},"19":{"start":{"line":177,"column":12},"end":{"line":195,"column":27}},"20":{"start":{"line":197,"column":12},"end":{"line":208,"column":13}},"21":{"start":{"line":198,"column":16},"end":{"line":202,"column":17}},"22":{"start":{"line":199,"column":20},"end":{"line":199,"column":34}},"23":{"start":{"line":200,"column":20},"end":{"line":200,"column":48}},"24":{"start":{"line":201,"column":20},"end":{"line":201,"column":35}},"25":{"start":{"line":203,"column":16},"end":{"line":207,"column":17}},"26":{"start":{"line":204,"column":20},"end":{"line":204,"column":34}},"27":{"start":{"line":205,"column":20},"end":{"line":205,"column":48}},"28":{"start":{"line":206,"column":20},"end":{"line":206,"column":35}},"29":{"start":{"line":209,"column":12},"end":{"line":221,"column":13}},"30":{"start":{"line":210,"column":16},"end":{"line":215,"column":17}},"31":{"start":{"line":211,"column":20},"end":{"line":211,"column":34}},"32":{"start":{"line":212,"column":20},"end":{"line":212,"column":48}},"33":{"start":{"line":213,"column":20},"end":{"line":213,"column":34}},"34":{"start":{"line":216,"column":16},"end":{"line":220,"column":17}},"35":{"start":{"line":217,"column":20},"end":{"line":217,"column":34}},"36":{"start":{"line":218,"column":20},"end":{"line":218,"column":48}},"37":{"start":{"line":219,"column":20},"end":{"line":219,"column":34}},"38":{"start":{"line":223,"column":12},"end":{"line":226,"column":13}},"39":{"start":{"line":224,"column":16},"end":{"line":224,"column":23}},"40":{"start":{"line":225,"column":16},"end":{"line":225,"column":27}},"41":{"start":{"line":228,"column":12},"end":{"line":231,"column":13}},"42":{"start":{"line":229,"column":16},"end":{"line":229,"column":23}},"43":{"start":{"line":230,"column":16},"end":{"line":230,"column":27}},"44":{"start":{"line":233,"column":12},"end":{"line":235,"column":13}},"45":{"start":{"line":234,"column":16},"end":{"line":234,"column":27}},"46":{"start":{"line":236,"column":12},"end":{"line":238,"column":13}},"47":{"start":{"line":237,"column":16},"end":{"line":237,"column":27}},"48":{"start":{"line":239,"column":12},"end":{"line":254,"column":13}},"49":{"start":{"line":240,"column":16},"end":{"line":240,"column":36}},"50":{"start":{"line":241,"column":16},"end":{"line":241,"column":46}},"51":{"start":{"line":242,"column":16},"end":{"line":242,"column":30}},"52":{"start":{"line":243,"column":16},"end":{"line":243,"column":36}},"53":{"start":{"line":244,"column":16},"end":{"line":244,"column":62}},"54":{"start":{"line":245,"column":16},"end":{"line":247,"column":17}},"55":{"start":{"line":246,"column":20},"end":{"line":246,"column":41}},"56":{"start":{"line":249,"column":16},"end":{"line":253,"column":17}},"57":{"start":{"line":250,"column":20},"end":{"line":250,"column":39}},"58":{"start":{"line":252,"column":20},"end":{"line":252,"column":41}},"59":{"start":{"line":262,"column":12},"end":{"line":262,"column":33}},"60":{"start":{"line":263,"column":12},"end":{"line":263,"column":112}},"61":{"start":{"line":272,"column":12},"end":{"line":272,"column":36}},"62":{"start":{"line":273,"column":12},"end":{"line":276,"column":13}},"63":{"start":{"line":274,"column":16},"end":{"line":274,"column":43}},"64":{"start":{"line":275,"column":16},"end":{"line":275,"column":41}},"65":{"start":{"line":283,"column":12},"end":{"line":286,"column":13}},"66":{"start":{"line":284,"column":16},"end":{"line":284,"column":37}},"67":{"start":{"line":285,"column":16},"end":{"line":285,"column":35}},"68":{"start":{"line":287,"column":12},"end":{"line":289,"column":13}},"69":{"start":{"line":288,"column":16},"end":{"line":288,"column":39}},"70":{"start":{"line":297,"column":12},"end":{"line":297,"column":54}},"71":{"start":{"line":298,"column":12},"end":{"line":301,"column":14}},"72":{"start":{"line":308,"column":12},"end":{"line":308,"column":32}},"73":{"start":{"line":315,"column":12},"end":{"line":315,"column":34}},"74":{"start":{"line":316,"column":12},"end":{"line":316,"column":33}},"75":{"start":{"line":320,"column":4},"end":{"line":320,"column":26}},"76":{"start":{"line":330,"column":4},"end":{"line":332,"column":6}},"77":{"start":{"line":331,"column":8},"end":{"line":331,"column":57}},"78":{"start":{"line":333,"column":4},"end":{"line":348,"column":7}},"79":{"start":{"line":342,"column":16},"end":{"line":344,"column":17}},"80":{"start":{"line":343,"column":20},"end":{"line":343,"column":58}},"81":{"start":{"line":345,"column":16},"end":{"line":345,"column":30}},"82":{"start":{"line":349,"column":4},"end":{"line":354,"column":7}},"83":{"start":{"line":352,"column":12},"end":{"line":352,"column":63}},"84":{"start":{"line":364,"column":4},"end":{"line":364,"column":34}},"85":{"start":{"line":365,"column":4},"end":{"line":365,"column":30}},"86":{"start":{"line":375,"column":4},"end":{"line":378,"column":6}},"87":{"start":{"line":376,"column":8},"end":{"line":376,"column":57}},"88":{"start":{"line":379,"column":4},"end":{"line":399,"column":7}},"89":{"start":{"line":388,"column":16},"end":{"line":388,"column":36}},"90":{"start":{"line":389,"column":16},"end":{"line":395,"column":17}},"91":{"start":{"line":390,"column":20},"end":{"line":392,"column":21}},"92":{"start":{"line":391,"column":24},"end":{"line":391,"column":77}},"93":{"start":{"line":394,"column":20},"end":{"line":394,"column":47}},"94":{"start":{"line":396,"column":16},"end":{"line":396,"column":25}},"95":{"start":{"line":400,"column":4},"end":{"line":405,"column":7}},"96":{"start":{"line":403,"column":12},"end":{"line":403,"column":47}},"97":{"start":{"line":415,"column":4},"end":{"line":415,"column":35}},"98":{"start":{"line":416,"column":4},"end":{"line":416,"column":31}},"99":{"start":{"line":418,"column":4},"end":{"line":418,"column":20}}},"branchMap":{"1":{"line":44,"type":"if","locations":[{"start":{"line":44,"column":16},"end":{"line":44,"column":16}},{"start":{"line":44,"column":16},"end":{"line":44,"column":16}}]},"2":{"line":144,"type":"cond-expr","locations":[{"start":{"line":144,"column":25},"end":{"line":144,"column":27}},{"start":{"line":144,"column":30},"end":{"line":144,"column":39}}]},"3":{"line":145,"type":"cond-expr","locations":[{"start":{"line":145,"column":24},"end":{"line":145,"column":34}},{"start":{"line":145,"column":37},"end":{"line":145,"column":49}}]},"4":{"line":146,"type":"cond-expr","locations":[{"start":{"line":146,"column":24},"end":{"line":146,"column":35}},{"start":{"line":146,"column":38},"end":{"line":146,"column":51}}]},"5":{"line":147,"type":"cond-expr","locations":[{"start":{"line":147,"column":24},"end":{"line":147,"column":41}},{"start":{"line":147,"column":44},"end":{"line":147,"column":49}}]},"6":{"line":148,"type":"cond-expr","locations":[{"start":{"line":148,"column":24},"end":{"line":148,"column":42}},{"start":{"line":148,"column":45},"end":{"line":148,"column":50}}]},"7":{"line":197,"type":"if","locations":[{"start":{"line":197,"column":12},"end":{"line":197,"column":12}},{"start":{"line":197,"column":12},"end":{"line":197,"column":12}}]},"8":{"line":198,"type":"if","locations":[{"start":{"line":198,"column":16},"end":{"line":198,"column":16}},{"start":{"line":198,"column":16},"end":{"line":198,"column":16}}]},"9":{"line":200,"type":"cond-expr","locations":[{"start":{"line":200,"column":41},"end":{"line":200,"column":42}},{"start":{"line":200,"column":45},"end":{"line":200,"column":46}}]},"10":{"line":203,"type":"if","locations":[{"start":{"line":203,"column":16},"end":{"line":203,"column":16}},{"start":{"line":203,"column":16},"end":{"line":203,"column":16}}]},"11":{"line":205,"type":"cond-expr","locations":[{"start":{"line":205,"column":41},"end":{"line":205,"column":42}},{"start":{"line":205,"column":45},"end":{"line":205,"column":46}}]},"12":{"line":209,"type":"if","locations":[{"start":{"line":209,"column":12},"end":{"line":209,"column":12}},{"start":{"line":209,"column":12},"end":{"line":209,"column":12}}]},"13":{"line":210,"type":"if","locations":[{"start":{"line":210,"column":16},"end":{"line":210,"column":16}},{"start":{"line":210,"column":16},"end":{"line":210,"column":16}}]},"14":{"line":212,"type":"cond-expr","locations":[{"start":{"line":212,"column":41},"end":{"line":212,"column":42}},{"start":{"line":212,"column":45},"end":{"line":212,"column":46}}]},"15":{"line":216,"type":"if","locations":[{"start":{"line":216,"column":16},"end":{"line":216,"column":16}},{"start":{"line":216,"column":16},"end":{"line":216,"column":16}}]},"16":{"line":218,"type":"cond-expr","locations":[{"start":{"line":218,"column":41},"end":{"line":218,"column":42}},{"start":{"line":218,"column":45},"end":{"line":218,"column":46}}]},"17":{"line":223,"type":"if","locations":[{"start":{"line":223,"column":12},"end":{"line":223,"column":12}},{"start":{"line":223,"column":12},"end":{"line":223,"column":12}}]},"18":{"line":228,"type":"if","locations":[{"start":{"line":228,"column":12},"end":{"line":228,"column":12}},{"start":{"line":228,"column":12},"end":{"line":228,"column":12}}]},"19":{"line":233,"type":"if","locations":[{"start":{"line":233,"column":12},"end":{"line":233,"column":12}},{"start":{"line":233,"column":12},"end":{"line":233,"column":12}}]},"20":{"line":236,"type":"if","locations":[{"start":{"line":236,"column":12},"end":{"line":236,"column":12}},{"start":{"line":236,"column":12},"end":{"line":236,"column":12}}]},"21":{"line":239,"type":"if","locations":[{"start":{"line":239,"column":12},"end":{"line":239,"column":12}},{"start":{"line":239,"column":12},"end":{"line":239,"column":12}}]},"22":{"line":245,"type":"if","locations":[{"start":{"line":245,"column":16},"end":{"line":245,"column":16}},{"start":{"line":245,"column":16},"end":{"line":245,"column":16}}]},"23":{"line":245,"type":"binary-expr","locations":[{"start":{"line":245,"column":20},"end":{"line":245,"column":23}},{"start":{"line":245,"column":27},"end":{"line":245,"column":30}}]},"24":{"line":249,"type":"if","locations":[{"start":{"line":249,"column":16},"end":{"line":249,"column":16}},{"start":{"line":249,"column":16},"end":{"line":249,"column":16}}]},"25":{"line":273,"type":"if","locations":[{"start":{"line":273,"column":12},"end":{"line":273,"column":12}},{"start":{"line":273,"column":12},"end":{"line":273,"column":12}}]},"26":{"line":283,"type":"if","locations":[{"start":{"line":283,"column":12},"end":{"line":283,"column":12}},{"start":{"line":283,"column":12},"end":{"line":283,"column":12}}]},"27":{"line":287,"type":"if","locations":[{"start":{"line":287,"column":12},"end":{"line":287,"column":12}},{"start":{"line":287,"column":12},"end":{"line":287,"column":12}}]},"28":{"line":342,"type":"if","locations":[{"start":{"line":342,"column":16},"end":{"line":342,"column":16}},{"start":{"line":342,"column":16},"end":{"line":342,"column":16}}]},"29":{"line":389,"type":"if","locations":[{"start":{"line":389,"column":16},"end":{"line":389,"column":16}},{"start":{"line":389,"column":16},"end":{"line":389,"column":16}}]},"30":{"line":390,"type":"if","locations":[{"start":{"line":390,"column":20},"end":{"line":390,"column":20}},{"start":{"line":390,"column":20},"end":{"line":390,"column":20}}]}},"code":["(function () { YUI.add('dd-scroll', function (Y, NAME) {","",""," /**"," * Base scroller class used to create the Plugin.DDNodeScroll and Plugin.DDWinScroll."," * This class should not be called on it's own, it's designed to be a plugin."," * @module dd"," * @submodule dd-scroll"," */"," /**"," * Base scroller class used to create the Plugin.DDNodeScroll and Plugin.DDWinScroll."," * This class should not be called on it's own, it's designed to be a plugin."," * @class Scroll"," * @extends Base"," * @namespace DD"," * @constructor"," */",""," var S = function() {"," S.superclass.constructor.apply(this, arguments);",""," },"," WS, NS,"," HOST = 'host',"," BUFFER = 'buffer',"," PARENT_SCROLL = 'parentScroll',"," WINDOW_SCROLL = 'windowScroll',"," SCROLL_TOP = 'scrollTop',"," SCROLL_LEFT = 'scrollLeft',"," OFFSET_WIDTH = 'offsetWidth',"," OFFSET_HEIGHT = 'offsetHeight';","",""," S.ATTRS = {"," /**"," * Internal config option to hold the node that we are scrolling. Should not be set by the developer."," * @attribute parentScroll"," * @protected"," * @type Node"," */"," parentScroll: {"," value: false,"," setter: function(node) {"," if (node) {"," return node;"," }"," return false;"," }"," },"," /**"," * The number of pixels from the edge of the screen to turn on scrolling. Default: 30"," * @attribute buffer"," * @type Number"," */"," buffer: {"," value: 30,"," validator: Y.Lang.isNumber"," },"," /**"," * The number of milliseconds delay to pass to the auto scroller. Default: 235"," * @attribute scrollDelay"," * @type Number"," */"," scrollDelay: {"," value: 235,"," validator: Y.Lang.isNumber"," },"," /**"," * The host we are plugged into."," * @attribute host"," * @type Object"," */"," host: {"," value: null"," },"," /**"," * Turn on window scroll support, default: false"," * @attribute windowScroll"," * @type Boolean"," */"," windowScroll: {"," value: false,"," validator: Y.Lang.isBoolean"," },"," /**"," * Allow vertical scrolling, default: true."," * @attribute vertical"," * @type Boolean"," */"," vertical: {"," value: true,"," validator: Y.Lang.isBoolean"," },"," /**"," * Allow horizontal scrolling, default: true."," * @attribute horizontal"," * @type Boolean"," */"," horizontal: {"," value: true,"," validator: Y.Lang.isBoolean"," }"," };",""," Y.extend(S, Y.Base, {"," /**"," * Tells if we are actively scrolling or not."," * @private"," * @property _scrolling"," * @type Boolean"," */"," _scrolling: null,"," /**"," * Cache of the Viewport dims."," * @private"," * @property _vpRegionCache"," * @type Object"," */"," _vpRegionCache: null,"," /**"," * Cache of the dragNode dims."," * @private"," * @property _dimCache"," * @type Object"," */"," _dimCache: null,"," /**"," * Holder for the Timer object returned from Y.later."," * @private"," * @property _scrollTimer"," * @type {Y.later}"," */"," _scrollTimer: null,"," /**"," * Sets the _vpRegionCache property with an Object containing the dims from the viewport."," * @private"," * @method _getVPRegion"," */"," _getVPRegion: function() {"," var r = {},"," n = this.get(PARENT_SCROLL),"," b = this.get(BUFFER),"," ws = this.get(WINDOW_SCROLL),"," xy = ((ws) ? [] : n.getXY()),"," w = ((ws) ? 'winWidth' : OFFSET_WIDTH),"," h = ((ws) ? 'winHeight' : OFFSET_HEIGHT),"," t = ((ws) ? n.get(SCROLL_TOP) : xy[1]),"," l = ((ws) ? n.get(SCROLL_LEFT) : xy[0]);",""," r = {"," top: t + b,"," right: (n.get(w) + l) - b,"," bottom: (n.get(h) + t) - b,"," left: l + b"," };"," this._vpRegionCache = r;"," return r;"," },"," initializer: function() {"," var h = this.get(HOST);"," h.after('drag:start', Y.bind(this.start, this));"," h.after('drag:end', Y.bind(this.end, this));"," h.on('drag:align', Y.bind(this.align, this));",""," //TODO - This doesn't work yet??"," Y.one('win').on('scroll', Y.bind(function() {"," this._vpRegionCache = null;"," }, this));"," },"," /**"," * Check to see if we need to fire the scroll timer. If scroll timer is running this will scroll the window."," * @private"," * @method _checkWinScroll"," * @param {Boolean} move Should we move the window. From Y.later"," */"," _checkWinScroll: function(move) {"," var r = this._getVPRegion(),"," ho = this.get(HOST),"," ws = this.get(WINDOW_SCROLL),"," xy = ho.lastXY,"," scroll = false,"," b = this.get(BUFFER),"," win = this.get(PARENT_SCROLL),"," sTop = win.get(SCROLL_TOP),"," sLeft = win.get(SCROLL_LEFT),"," w = this._dimCache.w,"," h = this._dimCache.h,"," bottom = xy[1] + h,"," top = xy[1],"," right = xy[0] + w,"," left = xy[0],"," nt = top,"," nl = left,"," st = sTop,"," sl = sLeft;",""," if (this.get('horizontal')) {"," if (left <= r.left) {"," scroll = true;"," nl = xy[0] - ((ws) ? b : 0);"," sl = sLeft - b;"," }"," if (right >= r.right) {"," scroll = true;"," nl = xy[0] + ((ws) ? b : 0);"," sl = sLeft + b;"," }"," }"," if (this.get('vertical')) {"," if (bottom >= r.bottom) {"," scroll = true;"," nt = xy[1] + ((ws) ? b : 0);"," st = sTop + b;",""," }"," if (top <= r.top) {"," scroll = true;"," nt = xy[1] - ((ws) ? b : 0);"," st = sTop - b;"," }"," }",""," if (st < 0) {"," st = 0;"," nt = xy[1];"," }",""," if (sl < 0) {"," sl = 0;"," nl = xy[0];"," }",""," if (nt < 0) {"," nt = xy[1];"," }"," if (nl < 0) {"," nl = xy[0];"," }"," if (move) {"," ho.actXY = [nl, nt];"," ho._alignNode([nl, nt], true); //We are srolling.."," xy = ho.actXY;"," ho.actXY = [nl, nt];"," ho._moveNode({ node: win, top: st, left: sl});"," if (!st && !sl) {"," this._cancelScroll();"," }"," } else {"," if (scroll) {"," this._initScroll();"," } else {"," this._cancelScroll();"," }"," }"," },"," /**"," * Cancel a previous scroll timer and init a new one."," * @private"," * @method _initScroll"," */"," _initScroll: function() {"," this._cancelScroll();"," this._scrollTimer = Y.Lang.later(this.get('scrollDelay'), this, this._checkWinScroll, [true], true);",""," },"," /**"," * Cancel a currently running scroll timer."," * @private"," * @method _cancelScroll"," */"," _cancelScroll: function() {"," this._scrolling = false;"," if (this._scrollTimer) {"," this._scrollTimer.cancel();"," delete this._scrollTimer;"," }"," },"," /**"," * Called from the drag:align event to determine if we need to scroll."," * @method align"," */"," align: function(e) {"," if (this._scrolling) {"," this._cancelScroll();"," e.preventDefault();"," }"," if (!this._scrolling) {"," this._checkWinScroll();"," }"," },"," /**"," * Set the cache of the dragNode dims."," * @private"," * @method _setDimCache"," */"," _setDimCache: function() {"," var node = this.get(HOST).get('dragNode');"," this._dimCache = {"," h: node.get(OFFSET_HEIGHT),"," w: node.get(OFFSET_WIDTH)"," };"," },"," /**"," * Called from the drag:start event"," * @method start"," */"," start: function() {"," this._setDimCache();"," },"," /**"," * Called from the drag:end event"," * @method end"," */"," end: function() {"," this._dimCache = null;"," this._cancelScroll();"," }"," });",""," Y.namespace('Plugin');","",""," /**"," * Extends the Scroll class to make the window scroll while dragging."," * @class DDWindowScroll"," * @extends Scroll"," * @namespace Plugin"," * @constructor"," */"," WS = function() {"," WS.superclass.constructor.apply(this, arguments);"," };"," WS.ATTRS = Y.merge(S.ATTRS, {"," /**"," * Turn on window scroll support, default: true"," * @attribute windowScroll"," * @type Boolean"," */"," windowScroll: {"," value: true,"," setter: function(scroll) {"," if (scroll) {"," this.set(PARENT_SCROLL, Y.one('win'));"," }"," return scroll;"," }"," }"," });"," Y.extend(WS, S, {"," //Shouldn't have to do this.."," initializer: function() {"," this.set('windowScroll', this.get('windowScroll'));"," }"," });"," /**"," * The Scroll instance will be placed on the Drag instance under the winscroll namespace."," * @property NS"," * @default winscroll"," * @readonly"," * @protected"," * @static"," * @type {String}"," */"," WS.NAME = WS.NS = 'winscroll';"," Y.Plugin.DDWinScroll = WS;","",""," /**"," * Extends the Scroll class to make a parent node scroll while dragging."," * @class DDNodeScroll"," * @extends Scroll"," * @namespace Plugin"," * @constructor"," */"," NS = function() {"," NS.superclass.constructor.apply(this, arguments);",""," };"," NS.ATTRS = Y.merge(S.ATTRS, {"," /**"," * The node we want to scroll. Used to set the internal parentScroll attribute."," * @attribute node"," * @type Node"," */"," node: {"," value: false,"," setter: function(node) {"," var n = Y.one(node);"," if (!n) {"," if (node !== false) {"," Y.error('DDNodeScroll: Invalid Node Given: ' + node);"," }"," } else {"," this.set(PARENT_SCROLL, n);"," }"," return n;"," }"," }"," });"," Y.extend(NS, S, {"," //Shouldn't have to do this.."," initializer: function() {"," this.set('node', this.get('node'));"," }"," });"," /**"," * The NodeScroll instance will be placed on the Drag instance under the nodescroll namespace."," * @property NS"," * @default nodescroll"," * @readonly"," * @protected"," * @static"," * @type {String}"," */"," NS.NAME = NS.NS = 'nodescroll';"," Y.Plugin.DDNodeScroll = NS;",""," Y.DD.Scroll = S;","","","","","}, '@VERSION@', {\"requires\": [\"dd-drag\"]});","","}());"]}; +} +var __cov_BZX4sZRTJcQW$pg46zZygw = __coverage__['build/dd-scroll/dd-scroll.js']; +__cov_BZX4sZRTJcQW$pg46zZygw.s['1']++;YUI.add('dd-scroll',function(Y,NAME){__cov_BZX4sZRTJcQW$pg46zZygw.f['1']++;__cov_BZX4sZRTJcQW$pg46zZygw.s['2']++;var S=function(){__cov_BZX4sZRTJcQW$pg46zZygw.f['2']++;__cov_BZX4sZRTJcQW$pg46zZygw.s['3']++;S.superclass.constructor.apply(this,arguments);},WS,NS,HOST='host',BUFFER='buffer',PARENT_SCROLL='parentScroll',WINDOW_SCROLL='windowScroll',SCROLL_TOP='scrollTop',SCROLL_LEFT='scrollLeft',OFFSET_WIDTH='offsetWidth',OFFSET_HEIGHT='offsetHeight';__cov_BZX4sZRTJcQW$pg46zZygw.s['4']++;S.ATTRS={parentScroll:{value:false,setter:function(node){__cov_BZX4sZRTJcQW$pg46zZygw.f['3']++;__cov_BZX4sZRTJcQW$pg46zZygw.s['5']++;if(node){__cov_BZX4sZRTJcQW$pg46zZygw.b['1'][0]++;__cov_BZX4sZRTJcQW$pg46zZygw.s['6']++;return node;}else{__cov_BZX4sZRTJcQW$pg46zZygw.b['1'][1]++;}__cov_BZX4sZRTJcQW$pg46zZygw.s['7']++;return false;}},buffer:{value:30,validator:Y.Lang.isNumber},scrollDelay:{value:235,validator:Y.Lang.isNumber},host:{value:null},windowScroll:{value:false,validator:Y.Lang.isBoolean},vertical:{value:true,validator:Y.Lang.isBoolean},horizontal:{value:true,validator:Y.Lang.isBoolean}};__cov_BZX4sZRTJcQW$pg46zZygw.s['8']++;Y.extend(S,Y.Base,{_scrolling:null,_vpRegionCache:null,_dimCache:null,_scrollTimer:null,_getVPRegion:function(){__cov_BZX4sZRTJcQW$pg46zZygw.f['4']++;__cov_BZX4sZRTJcQW$pg46zZygw.s['9']++;var r={},n=this.get(PARENT_SCROLL),b=this.get(BUFFER),ws=this.get(WINDOW_SCROLL),xy=ws?(__cov_BZX4sZRTJcQW$pg46zZygw.b['2'][0]++,[]):(__cov_BZX4sZRTJcQW$pg46zZygw.b['2'][1]++,n.getXY()),w=ws?(__cov_BZX4sZRTJcQW$pg46zZygw.b['3'][0]++,'winWidth'):(__cov_BZX4sZRTJcQW$pg46zZygw.b['3'][1]++,OFFSET_WIDTH),h=ws?(__cov_BZX4sZRTJcQW$pg46zZygw.b['4'][0]++,'winHeight'):(__cov_BZX4sZRTJcQW$pg46zZygw.b['4'][1]++,OFFSET_HEIGHT),t=ws?(__cov_BZX4sZRTJcQW$pg46zZygw.b['5'][0]++,n.get(SCROLL_TOP)):(__cov_BZX4sZRTJcQW$pg46zZygw.b['5'][1]++,xy[1]),l=ws?(__cov_BZX4sZRTJcQW$pg46zZygw.b['6'][0]++,n.get(SCROLL_LEFT)):(__cov_BZX4sZRTJcQW$pg46zZygw.b['6'][1]++,xy[0]);__cov_BZX4sZRTJcQW$pg46zZygw.s['10']++;r={top:t+b,right:n.get(w)+l-b,bottom:n.get(h)+t-b,left:l+b};__cov_BZX4sZRTJcQW$pg46zZygw.s['11']++;this._vpRegionCache=r;__cov_BZX4sZRTJcQW$pg46zZygw.s['12']++;return r;},initializer:function(){__cov_BZX4sZRTJcQW$pg46zZygw.f['5']++;__cov_BZX4sZRTJcQW$pg46zZygw.s['13']++;var h=this.get(HOST);__cov_BZX4sZRTJcQW$pg46zZygw.s['14']++;h.after('drag:start',Y.bind(this.start,this));__cov_BZX4sZRTJcQW$pg46zZygw.s['15']++;h.after('drag:end',Y.bind(this.end,this));__cov_BZX4sZRTJcQW$pg46zZygw.s['16']++;h.on('drag:align',Y.bind(this.align,this));__cov_BZX4sZRTJcQW$pg46zZygw.s['17']++;Y.one('win').on('scroll',Y.bind(function(){__cov_BZX4sZRTJcQW$pg46zZygw.f['6']++;__cov_BZX4sZRTJcQW$pg46zZygw.s['18']++;this._vpRegionCache=null;},this));},_checkWinScroll:function(move){__cov_BZX4sZRTJcQW$pg46zZygw.f['7']++;__cov_BZX4sZRTJcQW$pg46zZygw.s['19']++;var r=this._getVPRegion(),ho=this.get(HOST),ws=this.get(WINDOW_SCROLL),xy=ho.lastXY,scroll=false,b=this.get(BUFFER),win=this.get(PARENT_SCROLL),sTop=win.get(SCROLL_TOP),sLeft=win.get(SCROLL_LEFT),w=this._dimCache.w,h=this._dimCache.h,bottom=xy[1]+h,top=xy[1],right=xy[0]+w,left=xy[0],nt=top,nl=left,st=sTop,sl=sLeft;__cov_BZX4sZRTJcQW$pg46zZygw.s['20']++;if(this.get('horizontal')){__cov_BZX4sZRTJcQW$pg46zZygw.b['7'][0]++;__cov_BZX4sZRTJcQW$pg46zZygw.s['21']++;if(left<=r.left){__cov_BZX4sZRTJcQW$pg46zZygw.b['8'][0]++;__cov_BZX4sZRTJcQW$pg46zZygw.s['22']++;scroll=true;__cov_BZX4sZRTJcQW$pg46zZygw.s['23']++;nl=xy[0]-(ws?(__cov_BZX4sZRTJcQW$pg46zZygw.b['9'][0]++,b):(__cov_BZX4sZRTJcQW$pg46zZygw.b['9'][1]++,0));__cov_BZX4sZRTJcQW$pg46zZygw.s['24']++;sl=sLeft-b;}else{__cov_BZX4sZRTJcQW$pg46zZygw.b['8'][1]++;}__cov_BZX4sZRTJcQW$pg46zZygw.s['25']++;if(right>=r.right){__cov_BZX4sZRTJcQW$pg46zZygw.b['10'][0]++;__cov_BZX4sZRTJcQW$pg46zZygw.s['26']++;scroll=true;__cov_BZX4sZRTJcQW$pg46zZygw.s['27']++;nl=xy[0]+(ws?(__cov_BZX4sZRTJcQW$pg46zZygw.b['11'][0]++,b):(__cov_BZX4sZRTJcQW$pg46zZygw.b['11'][1]++,0));__cov_BZX4sZRTJcQW$pg46zZygw.s['28']++;sl=sLeft+b;}else{__cov_BZX4sZRTJcQW$pg46zZygw.b['10'][1]++;}}else{__cov_BZX4sZRTJcQW$pg46zZygw.b['7'][1]++;}__cov_BZX4sZRTJcQW$pg46zZygw.s['29']++;if(this.get('vertical')){__cov_BZX4sZRTJcQW$pg46zZygw.b['12'][0]++;__cov_BZX4sZRTJcQW$pg46zZygw.s['30']++;if(bottom>=r.bottom){__cov_BZX4sZRTJcQW$pg46zZygw.b['13'][0]++;__cov_BZX4sZRTJcQW$pg46zZygw.s['31']++;scroll=true;__cov_BZX4sZRTJcQW$pg46zZygw.s['32']++;nt=xy[1]+(ws?(__cov_BZX4sZRTJcQW$pg46zZygw.b['14'][0]++,b):(__cov_BZX4sZRTJcQW$pg46zZygw.b['14'][1]++,0));__cov_BZX4sZRTJcQW$pg46zZygw.s['33']++;st=sTop+b;}else{__cov_BZX4sZRTJcQW$pg46zZygw.b['13'][1]++;}__cov_BZX4sZRTJcQW$pg46zZygw.s['34']++;if(top<=r.top){__cov_BZX4sZRTJcQW$pg46zZygw.b['15'][0]++;__cov_BZX4sZRTJcQW$pg46zZygw.s['35']++;scroll=true;__cov_BZX4sZRTJcQW$pg46zZygw.s['36']++;nt=xy[1]-(ws?(__cov_BZX4sZRTJcQW$pg46zZygw.b['16'][0]++,b):(__cov_BZX4sZRTJcQW$pg46zZygw.b['16'][1]++,0));__cov_BZX4sZRTJcQW$pg46zZygw.s['37']++;st=sTop-b;}else{__cov_BZX4sZRTJcQW$pg46zZygw.b['15'][1]++;}}else{__cov_BZX4sZRTJcQW$pg46zZygw.b['12'][1]++;}__cov_BZX4sZRTJcQW$pg46zZygw.s['38']++;if(st<0){__cov_BZX4sZRTJcQW$pg46zZygw.b['17'][0]++;__cov_BZX4sZRTJcQW$pg46zZygw.s['39']++;st=0;__cov_BZX4sZRTJcQW$pg46zZygw.s['40']++;nt=xy[1];}else{__cov_BZX4sZRTJcQW$pg46zZygw.b['17'][1]++;}__cov_BZX4sZRTJcQW$pg46zZygw.s['41']++;if(sl<0){__cov_BZX4sZRTJcQW$pg46zZygw.b['18'][0]++;__cov_BZX4sZRTJcQW$pg46zZygw.s['42']++;sl=0;__cov_BZX4sZRTJcQW$pg46zZygw.s['43']++;nl=xy[0];}else{__cov_BZX4sZRTJcQW$pg46zZygw.b['18'][1]++;}__cov_BZX4sZRTJcQW$pg46zZygw.s['44']++;if(nt<0){__cov_BZX4sZRTJcQW$pg46zZygw.b['19'][0]++;__cov_BZX4sZRTJcQW$pg46zZygw.s['45']++;nt=xy[1];}else{__cov_BZX4sZRTJcQW$pg46zZygw.b['19'][1]++;}__cov_BZX4sZRTJcQW$pg46zZygw.s['46']++;if(nl<0){__cov_BZX4sZRTJcQW$pg46zZygw.b['20'][0]++;__cov_BZX4sZRTJcQW$pg46zZygw.s['47']++;nl=xy[0];}else{__cov_BZX4sZRTJcQW$pg46zZygw.b['20'][1]++;}__cov_BZX4sZRTJcQW$pg46zZygw.s['48']++;if(move){__cov_BZX4sZRTJcQW$pg46zZygw.b['21'][0]++;__cov_BZX4sZRTJcQW$pg46zZygw.s['49']++;ho.actXY=[nl,nt];__cov_BZX4sZRTJcQW$pg46zZygw.s['50']++;ho._alignNode([nl,nt],true);__cov_BZX4sZRTJcQW$pg46zZygw.s['51']++;xy=ho.actXY;__cov_BZX4sZRTJcQW$pg46zZygw.s['52']++;ho.actXY=[nl,nt];__cov_BZX4sZRTJcQW$pg46zZygw.s['53']++;ho._moveNode({node:win,top:st,left:sl});__cov_BZX4sZRTJcQW$pg46zZygw.s['54']++;if((__cov_BZX4sZRTJcQW$pg46zZygw.b['23'][0]++,!st)&&(__cov_BZX4sZRTJcQW$pg46zZygw.b['23'][1]++,!sl)){__cov_BZX4sZRTJcQW$pg46zZygw.b['22'][0]++;__cov_BZX4sZRTJcQW$pg46zZygw.s['55']++;this._cancelScroll();}else{__cov_BZX4sZRTJcQW$pg46zZygw.b['22'][1]++;}}else{__cov_BZX4sZRTJcQW$pg46zZygw.b['21'][1]++;__cov_BZX4sZRTJcQW$pg46zZygw.s['56']++;if(scroll){__cov_BZX4sZRTJcQW$pg46zZygw.b['24'][0]++;__cov_BZX4sZRTJcQW$pg46zZygw.s['57']++;this._initScroll();}else{__cov_BZX4sZRTJcQW$pg46zZygw.b['24'][1]++;__cov_BZX4sZRTJcQW$pg46zZygw.s['58']++;this._cancelScroll();}}},_initScroll:function(){__cov_BZX4sZRTJcQW$pg46zZygw.f['8']++;__cov_BZX4sZRTJcQW$pg46zZygw.s['59']++;this._cancelScroll();__cov_BZX4sZRTJcQW$pg46zZygw.s['60']++;this._scrollTimer=Y.Lang.later(this.get('scrollDelay'),this,this._checkWinScroll,[true],true);},_cancelScroll:function(){__cov_BZX4sZRTJcQW$pg46zZygw.f['9']++;__cov_BZX4sZRTJcQW$pg46zZygw.s['61']++;this._scrolling=false;__cov_BZX4sZRTJcQW$pg46zZygw.s['62']++;if(this._scrollTimer){__cov_BZX4sZRTJcQW$pg46zZygw.b['25'][0]++;__cov_BZX4sZRTJcQW$pg46zZygw.s['63']++;this._scrollTimer.cancel();__cov_BZX4sZRTJcQW$pg46zZygw.s['64']++;delete this._scrollTimer;}else{__cov_BZX4sZRTJcQW$pg46zZygw.b['25'][1]++;}},align:function(e){__cov_BZX4sZRTJcQW$pg46zZygw.f['10']++;__cov_BZX4sZRTJcQW$pg46zZygw.s['65']++;if(this._scrolling){__cov_BZX4sZRTJcQW$pg46zZygw.b['26'][0]++;__cov_BZX4sZRTJcQW$pg46zZygw.s['66']++;this._cancelScroll();__cov_BZX4sZRTJcQW$pg46zZygw.s['67']++;e.preventDefault();}else{__cov_BZX4sZRTJcQW$pg46zZygw.b['26'][1]++;}__cov_BZX4sZRTJcQW$pg46zZygw.s['68']++;if(!this._scrolling){__cov_BZX4sZRTJcQW$pg46zZygw.b['27'][0]++;__cov_BZX4sZRTJcQW$pg46zZygw.s['69']++;this._checkWinScroll();}else{__cov_BZX4sZRTJcQW$pg46zZygw.b['27'][1]++;}},_setDimCache:function(){__cov_BZX4sZRTJcQW$pg46zZygw.f['11']++;__cov_BZX4sZRTJcQW$pg46zZygw.s['70']++;var node=this.get(HOST).get('dragNode');__cov_BZX4sZRTJcQW$pg46zZygw.s['71']++;this._dimCache={h:node.get(OFFSET_HEIGHT),w:node.get(OFFSET_WIDTH)};},start:function(){__cov_BZX4sZRTJcQW$pg46zZygw.f['12']++;__cov_BZX4sZRTJcQW$pg46zZygw.s['72']++;this._setDimCache();},end:function(){__cov_BZX4sZRTJcQW$pg46zZygw.f['13']++;__cov_BZX4sZRTJcQW$pg46zZygw.s['73']++;this._dimCache=null;__cov_BZX4sZRTJcQW$pg46zZygw.s['74']++;this._cancelScroll();}});__cov_BZX4sZRTJcQW$pg46zZygw.s['75']++;Y.namespace('Plugin');__cov_BZX4sZRTJcQW$pg46zZygw.s['76']++;WS=function(){__cov_BZX4sZRTJcQW$pg46zZygw.f['14']++;__cov_BZX4sZRTJcQW$pg46zZygw.s['77']++;WS.superclass.constructor.apply(this,arguments);};__cov_BZX4sZRTJcQW$pg46zZygw.s['78']++;WS.ATTRS=Y.merge(S.ATTRS,{windowScroll:{value:true,setter:function(scroll){__cov_BZX4sZRTJcQW$pg46zZygw.f['15']++;__cov_BZX4sZRTJcQW$pg46zZygw.s['79']++;if(scroll){__cov_BZX4sZRTJcQW$pg46zZygw.b['28'][0]++;__cov_BZX4sZRTJcQW$pg46zZygw.s['80']++;this.set(PARENT_SCROLL,Y.one('win'));}else{__cov_BZX4sZRTJcQW$pg46zZygw.b['28'][1]++;}__cov_BZX4sZRTJcQW$pg46zZygw.s['81']++;return scroll;}}});__cov_BZX4sZRTJcQW$pg46zZygw.s['82']++;Y.extend(WS,S,{initializer:function(){__cov_BZX4sZRTJcQW$pg46zZygw.f['16']++;__cov_BZX4sZRTJcQW$pg46zZygw.s['83']++;this.set('windowScroll',this.get('windowScroll'));}});__cov_BZX4sZRTJcQW$pg46zZygw.s['84']++;WS.NAME=WS.NS='winscroll';__cov_BZX4sZRTJcQW$pg46zZygw.s['85']++;Y.Plugin.DDWinScroll=WS;__cov_BZX4sZRTJcQW$pg46zZygw.s['86']++;NS=function(){__cov_BZX4sZRTJcQW$pg46zZygw.f['17']++;__cov_BZX4sZRTJcQW$pg46zZygw.s['87']++;NS.superclass.constructor.apply(this,arguments);};__cov_BZX4sZRTJcQW$pg46zZygw.s['88']++;NS.ATTRS=Y.merge(S.ATTRS,{node:{value:false,setter:function(node){__cov_BZX4sZRTJcQW$pg46zZygw.f['18']++;__cov_BZX4sZRTJcQW$pg46zZygw.s['89']++;var n=Y.one(node);__cov_BZX4sZRTJcQW$pg46zZygw.s['90']++;if(!n){__cov_BZX4sZRTJcQW$pg46zZygw.b['29'][0]++;__cov_BZX4sZRTJcQW$pg46zZygw.s['91']++;if(node!==false){__cov_BZX4sZRTJcQW$pg46zZygw.b['30'][0]++;__cov_BZX4sZRTJcQW$pg46zZygw.s['92']++;Y.error('DDNodeScroll: Invalid Node Given: '+node);}else{__cov_BZX4sZRTJcQW$pg46zZygw.b['30'][1]++;}}else{__cov_BZX4sZRTJcQW$pg46zZygw.b['29'][1]++;__cov_BZX4sZRTJcQW$pg46zZygw.s['93']++;this.set(PARENT_SCROLL,n);}__cov_BZX4sZRTJcQW$pg46zZygw.s['94']++;return n;}}});__cov_BZX4sZRTJcQW$pg46zZygw.s['95']++;Y.extend(NS,S,{initializer:function(){__cov_BZX4sZRTJcQW$pg46zZygw.f['19']++;__cov_BZX4sZRTJcQW$pg46zZygw.s['96']++;this.set('node',this.get('node'));}});__cov_BZX4sZRTJcQW$pg46zZygw.s['97']++;NS.NAME=NS.NS='nodescroll';__cov_BZX4sZRTJcQW$pg46zZygw.s['98']++;Y.Plugin.DDNodeScroll=NS;__cov_BZX4sZRTJcQW$pg46zZygw.s['99']++;Y.DD.Scroll=S;},'@VERSION@',{'requires':['dd-drag']}); diff --git a/src/build/dd-scroll/dd-scroll-debug.js b/src/build/dd-scroll/dd-scroll-debug.js new file mode 100644 index 00000000000..34fd84297ea --- /dev/null +++ b/src/build/dd-scroll/dd-scroll-debug.js @@ -0,0 +1,423 @@ +YUI.add('dd-scroll', function (Y, NAME) { + + + /** + * Base scroller class used to create the Plugin.DDNodeScroll and Plugin.DDWinScroll. + * This class should not be called on it's own, it's designed to be a plugin. + * @module dd + * @submodule dd-scroll + */ + /** + * Base scroller class used to create the Plugin.DDNodeScroll and Plugin.DDWinScroll. + * This class should not be called on it's own, it's designed to be a plugin. + * @class Scroll + * @extends Base + * @namespace DD + * @constructor + */ + + var S = function() { + S.superclass.constructor.apply(this, arguments); + + }, + WS, NS, + HOST = 'host', + BUFFER = 'buffer', + PARENT_SCROLL = 'parentScroll', + WINDOW_SCROLL = 'windowScroll', + SCROLL_TOP = 'scrollTop', + SCROLL_LEFT = 'scrollLeft', + OFFSET_WIDTH = 'offsetWidth', + OFFSET_HEIGHT = 'offsetHeight'; + + + S.ATTRS = { + /** + * Internal config option to hold the node that we are scrolling. Should not be set by the developer. + * @attribute parentScroll + * @protected + * @type Node + */ + parentScroll: { + value: false, + setter: function(node) { + if (node) { + return node; + } + return false; + } + }, + /** + * The number of pixels from the edge of the screen to turn on scrolling. Default: 30 + * @attribute buffer + * @type Number + */ + buffer: { + value: 30, + validator: Y.Lang.isNumber + }, + /** + * The number of milliseconds delay to pass to the auto scroller. Default: 235 + * @attribute scrollDelay + * @type Number + */ + scrollDelay: { + value: 235, + validator: Y.Lang.isNumber + }, + /** + * The host we are plugged into. + * @attribute host + * @type Object + */ + host: { + value: null + }, + /** + * Turn on window scroll support, default: false + * @attribute windowScroll + * @type Boolean + */ + windowScroll: { + value: false, + validator: Y.Lang.isBoolean + }, + /** + * Allow vertical scrolling, default: true. + * @attribute vertical + * @type Boolean + */ + vertical: { + value: true, + validator: Y.Lang.isBoolean + }, + /** + * Allow horizontal scrolling, default: true. + * @attribute horizontal + * @type Boolean + */ + horizontal: { + value: true, + validator: Y.Lang.isBoolean + } + }; + + Y.extend(S, Y.Base, { + /** + * Tells if we are actively scrolling or not. + * @private + * @property _scrolling + * @type Boolean + */ + _scrolling: null, + /** + * Cache of the Viewport dims. + * @private + * @property _vpRegionCache + * @type Object + */ + _vpRegionCache: null, + /** + * Cache of the dragNode dims. + * @private + * @property _dimCache + * @type Object + */ + _dimCache: null, + /** + * Holder for the Timer object returned from Y.later. + * @private + * @property _scrollTimer + * @type {Y.later} + */ + _scrollTimer: null, + /** + * Sets the _vpRegionCache property with an Object containing the dims from the viewport. + * @private + * @method _getVPRegion + */ + _getVPRegion: function() { + var r = {}, + n = this.get(PARENT_SCROLL), + b = this.get(BUFFER), + ws = this.get(WINDOW_SCROLL), + xy = ((ws) ? [] : n.getXY()), + w = ((ws) ? 'winWidth' : OFFSET_WIDTH), + h = ((ws) ? 'winHeight' : OFFSET_HEIGHT), + t = ((ws) ? n.get(SCROLL_TOP) : xy[1]), + l = ((ws) ? n.get(SCROLL_LEFT) : xy[0]); + + r = { + top: t + b, + right: (n.get(w) + l) - b, + bottom: (n.get(h) + t) - b, + left: l + b + }; + this._vpRegionCache = r; + return r; + }, + initializer: function() { + var h = this.get(HOST); + h.after('drag:start', Y.bind(this.start, this)); + h.after('drag:end', Y.bind(this.end, this)); + h.on('drag:align', Y.bind(this.align, this)); + + //TODO - This doesn't work yet?? + Y.one('win').on('scroll', Y.bind(function() { + this._vpRegionCache = null; + }, this)); + }, + /** + * Check to see if we need to fire the scroll timer. If scroll timer is running this will scroll the window. + * @private + * @method _checkWinScroll + * @param {Boolean} move Should we move the window. From Y.later + */ + _checkWinScroll: function(move) { + var r = this._getVPRegion(), + ho = this.get(HOST), + ws = this.get(WINDOW_SCROLL), + xy = ho.lastXY, + scroll = false, + b = this.get(BUFFER), + win = this.get(PARENT_SCROLL), + sTop = win.get(SCROLL_TOP), + sLeft = win.get(SCROLL_LEFT), + w = this._dimCache.w, + h = this._dimCache.h, + bottom = xy[1] + h, + top = xy[1], + right = xy[0] + w, + left = xy[0], + nt = top, + nl = left, + st = sTop, + sl = sLeft; + + if (this.get('horizontal')) { + if (left <= r.left) { + scroll = true; + nl = xy[0] - ((ws) ? b : 0); + sl = sLeft - b; + } + if (right >= r.right) { + scroll = true; + nl = xy[0] + ((ws) ? b : 0); + sl = sLeft + b; + } + } + if (this.get('vertical')) { + if (bottom >= r.bottom) { + scroll = true; + nt = xy[1] + ((ws) ? b : 0); + st = sTop + b; + + } + if (top <= r.top) { + scroll = true; + nt = xy[1] - ((ws) ? b : 0); + st = sTop - b; + } + } + + if (st < 0) { + st = 0; + nt = xy[1]; + } + + if (sl < 0) { + sl = 0; + nl = xy[0]; + } + + if (nt < 0) { + nt = xy[1]; + } + if (nl < 0) { + nl = xy[0]; + } + if (move) { + ho.actXY = [nl, nt]; + ho._alignNode([nl, nt], true); //We are srolling.. + xy = ho.actXY; + ho.actXY = [nl, nt]; + ho._moveNode({ node: win, top: st, left: sl}); + if (!st && !sl) { + this._cancelScroll(); + } + } else { + if (scroll) { + this._initScroll(); + } else { + this._cancelScroll(); + } + } + }, + /** + * Cancel a previous scroll timer and init a new one. + * @private + * @method _initScroll + */ + _initScroll: function() { + this._cancelScroll(); + this._scrollTimer = Y.Lang.later(this.get('scrollDelay'), this, this._checkWinScroll, [true], true); + + }, + /** + * Cancel a currently running scroll timer. + * @private + * @method _cancelScroll + */ + _cancelScroll: function() { + this._scrolling = false; + if (this._scrollTimer) { + this._scrollTimer.cancel(); + delete this._scrollTimer; + } + }, + /** + * Called from the drag:align event to determine if we need to scroll. + * @method align + */ + align: function(e) { + if (this._scrolling) { + this._cancelScroll(); + e.preventDefault(); + } + if (!this._scrolling) { + this._checkWinScroll(); + } + }, + /** + * Set the cache of the dragNode dims. + * @private + * @method _setDimCache + */ + _setDimCache: function() { + var node = this.get(HOST).get('dragNode'); + this._dimCache = { + h: node.get(OFFSET_HEIGHT), + w: node.get(OFFSET_WIDTH) + }; + }, + /** + * Called from the drag:start event + * @method start + */ + start: function() { + this._setDimCache(); + }, + /** + * Called from the drag:end event + * @method end + */ + end: function() { + this._dimCache = null; + this._cancelScroll(); + } + }); + + Y.namespace('Plugin'); + + + /** + * Extends the Scroll class to make the window scroll while dragging. + * @class DDWindowScroll + * @extends Scroll + * @namespace Plugin + * @constructor + */ + WS = function() { + WS.superclass.constructor.apply(this, arguments); + }; + WS.ATTRS = Y.merge(S.ATTRS, { + /** + * Turn on window scroll support, default: true + * @attribute windowScroll + * @type Boolean + */ + windowScroll: { + value: true, + setter: function(scroll) { + if (scroll) { + this.set(PARENT_SCROLL, Y.one('win')); + } + return scroll; + } + } + }); + Y.extend(WS, S, { + //Shouldn't have to do this.. + initializer: function() { + this.set('windowScroll', this.get('windowScroll')); + } + }); + /** + * The Scroll instance will be placed on the Drag instance under the winscroll namespace. + * @property NS + * @default winscroll + * @readonly + * @protected + * @static + * @type {String} + */ + WS.NAME = WS.NS = 'winscroll'; + Y.Plugin.DDWinScroll = WS; + + + /** + * Extends the Scroll class to make a parent node scroll while dragging. + * @class DDNodeScroll + * @extends Scroll + * @namespace Plugin + * @constructor + */ + NS = function() { + NS.superclass.constructor.apply(this, arguments); + + }; + NS.ATTRS = Y.merge(S.ATTRS, { + /** + * The node we want to scroll. Used to set the internal parentScroll attribute. + * @attribute node + * @type Node + */ + node: { + value: false, + setter: function(node) { + var n = Y.one(node); + if (!n) { + if (node !== false) { + Y.error('DDNodeScroll: Invalid Node Given: ' + node); + } + } else { + this.set(PARENT_SCROLL, n); + } + return n; + } + } + }); + Y.extend(NS, S, { + //Shouldn't have to do this.. + initializer: function() { + this.set('node', this.get('node')); + } + }); + /** + * The NodeScroll instance will be placed on the Drag instance under the nodescroll namespace. + * @property NS + * @default nodescroll + * @readonly + * @protected + * @static + * @type {String} + */ + NS.NAME = NS.NS = 'nodescroll'; + Y.Plugin.DDNodeScroll = NS; + + Y.DD.Scroll = S; + + + + +}, '@VERSION@', {"requires": ["dd-drag"]}); diff --git a/src/build/dd-scroll/dd-scroll-min.js b/src/build/dd-scroll/dd-scroll-min.js new file mode 100644 index 00000000000..6e9ad98cd0b --- /dev/null +++ b/src/build/dd-scroll/dd-scroll-min.js @@ -0,0 +1 @@ +YUI.add("dd-scroll",function(e,t){var n=function(){n.superclass.constructor.apply(this,arguments)},r,i,s="host",o="buffer",u="parentScroll",a="windowScroll",f="scrollTop",l="scrollLeft",c="offsetWidth",h="offsetHeight";n.ATTRS={parentScroll:{value:!1,setter:function(e){return e?e:!1}},buffer:{value:30,validator:e.Lang.isNumber},scrollDelay:{value:235,validator:e.Lang.isNumber},host:{value:null},windowScroll:{value:!1,validator:e.Lang.isBoolean},vertical:{value:!0,validator:e.Lang.isBoolean},horizontal:{value:!0,validator:e.Lang.isBoolean}},e.extend(n,e.Base,{_scrolling:null,_vpRegionCache:null,_dimCache:null,_scrollTimer:null,_getVPRegion:function(){var e={},t=this.get(u),n=this.get(o),r=this.get(a),i=r?[]:t.getXY(),s=r?"winWidth":c,p=r?"winHeight":h,d=r?t.get(f):i[1],v=r?t.get(l):i[0];return e={top:d+n,right:t.get(s)+v-n,bottom:t.get(p)+d-n,left:v+n},this._vpRegionCache=e,e},initializer:function(){var t=this.get(s);t.after("drag:start",e.bind(this.start,this)),t.after("drag:end",e.bind(this.end,this)),t.on("drag:align",e.bind(this.align,this)),e.one("win").on("scroll",e.bind(function(){this._vpRegionCache=null},this))},_checkWinScroll:function(e){var t=this._getVPRegion(),n=this.get(s),r=this.get(a),i=n.lastXY,c=!1,h=this.get(o),p=this.get(u),d=p.get(f),v=p.get(l),m=this._dimCache.w,g=this._dimCache.h,y=i[1]+g,b=i[1],w=i[0]+m,E=i[0],S=b,x=E,T=d,N=v;this.get("horizontal")&&(E<=t.left&&(c=!0,x=i[0]-(r?h:0),N=v-h),w>=t.right&&(c=!0,x=i[0]+(r?h:0),N=v+h)),this.get("vertical")&&(y>=t.bottom&&(c=!0,S=i[1]+(r?h:0),T=d+h),b<=t.top&&(c=!0,S=i[1]-(r?h:0),T=d-h)),T<0&&(T=0,S=i[1]),N<0&&(N=0,x=i[0]),S<0&&(S=i[1]),x<0&&(x=i[0]),e?(n.actXY=[x,S],n._alignNode([x,S],!0),i=n.actXY,n.actXY=[x,S],n._moveNode({node:p,top:T,left:N}),!T&&!N&&this._cancelScroll()):c?this._initScroll():this._cancelScroll()},_initScroll:function(){this._cancelScroll(),this._scrollTimer=e.Lang.later(this.get("scrollDelay"),this,this._checkWinScroll,[!0],!0)},_cancelScroll:function(){this._scrolling=!1,this._scrollTimer&&(this._scrollTimer.cancel(),delete this._scrollTimer)},align:function(e){this._scrolling&&(this._cancelScroll(),e.preventDefault()),this._scrolling||this._checkWinScroll()},_setDimCache:function(){var e=this.get(s).get("dragNode");this._dimCache={h:e.get(h),w:e.get(c)}},start:function(){this._setDimCache()},end:function(){this._dimCache=null,this._cancelScroll()}}),e.namespace("Plugin"),r=function(){r.superclass.constructor.apply(this,arguments)},r.ATTRS=e.merge(n.ATTRS,{windowScroll:{value:!0,setter:function(t){return t&&this.set(u,e.one("win")),t}}}),e.extend(r,n,{initializer:function(){this.set("windowScroll",this.get("windowScroll"))}}),r.NAME=r.NS="winscroll",e.Plugin.DDWinScroll=r,i=function(){i.superclass.constructor.apply(this,arguments)},i.ATTRS=e.merge(n.ATTRS,{node:{value:!1,setter:function(t){var n=e.one(t);return n?this.set(u,n):t!==!1&&e.error("DDNodeScroll: Invalid Node Given: "+t),n}}}),e.extend(i,n,{initializer:function(){this.set("node",this.get("node"))}}),i.NAME=i.NS="nodescroll",e.Plugin.DDNodeScroll=i,e.DD.Scroll=n},"@VERSION@",{requires:["dd-drag"]}); diff --git a/src/build/dd-scroll/dd-scroll.js b/src/build/dd-scroll/dd-scroll.js new file mode 100644 index 00000000000..34fd84297ea --- /dev/null +++ b/src/build/dd-scroll/dd-scroll.js @@ -0,0 +1,423 @@ +YUI.add('dd-scroll', function (Y, NAME) { + + + /** + * Base scroller class used to create the Plugin.DDNodeScroll and Plugin.DDWinScroll. + * This class should not be called on it's own, it's designed to be a plugin. + * @module dd + * @submodule dd-scroll + */ + /** + * Base scroller class used to create the Plugin.DDNodeScroll and Plugin.DDWinScroll. + * This class should not be called on it's own, it's designed to be a plugin. + * @class Scroll + * @extends Base + * @namespace DD + * @constructor + */ + + var S = function() { + S.superclass.constructor.apply(this, arguments); + + }, + WS, NS, + HOST = 'host', + BUFFER = 'buffer', + PARENT_SCROLL = 'parentScroll', + WINDOW_SCROLL = 'windowScroll', + SCROLL_TOP = 'scrollTop', + SCROLL_LEFT = 'scrollLeft', + OFFSET_WIDTH = 'offsetWidth', + OFFSET_HEIGHT = 'offsetHeight'; + + + S.ATTRS = { + /** + * Internal config option to hold the node that we are scrolling. Should not be set by the developer. + * @attribute parentScroll + * @protected + * @type Node + */ + parentScroll: { + value: false, + setter: function(node) { + if (node) { + return node; + } + return false; + } + }, + /** + * The number of pixels from the edge of the screen to turn on scrolling. Default: 30 + * @attribute buffer + * @type Number + */ + buffer: { + value: 30, + validator: Y.Lang.isNumber + }, + /** + * The number of milliseconds delay to pass to the auto scroller. Default: 235 + * @attribute scrollDelay + * @type Number + */ + scrollDelay: { + value: 235, + validator: Y.Lang.isNumber + }, + /** + * The host we are plugged into. + * @attribute host + * @type Object + */ + host: { + value: null + }, + /** + * Turn on window scroll support, default: false + * @attribute windowScroll + * @type Boolean + */ + windowScroll: { + value: false, + validator: Y.Lang.isBoolean + }, + /** + * Allow vertical scrolling, default: true. + * @attribute vertical + * @type Boolean + */ + vertical: { + value: true, + validator: Y.Lang.isBoolean + }, + /** + * Allow horizontal scrolling, default: true. + * @attribute horizontal + * @type Boolean + */ + horizontal: { + value: true, + validator: Y.Lang.isBoolean + } + }; + + Y.extend(S, Y.Base, { + /** + * Tells if we are actively scrolling or not. + * @private + * @property _scrolling + * @type Boolean + */ + _scrolling: null, + /** + * Cache of the Viewport dims. + * @private + * @property _vpRegionCache + * @type Object + */ + _vpRegionCache: null, + /** + * Cache of the dragNode dims. + * @private + * @property _dimCache + * @type Object + */ + _dimCache: null, + /** + * Holder for the Timer object returned from Y.later. + * @private + * @property _scrollTimer + * @type {Y.later} + */ + _scrollTimer: null, + /** + * Sets the _vpRegionCache property with an Object containing the dims from the viewport. + * @private + * @method _getVPRegion + */ + _getVPRegion: function() { + var r = {}, + n = this.get(PARENT_SCROLL), + b = this.get(BUFFER), + ws = this.get(WINDOW_SCROLL), + xy = ((ws) ? [] : n.getXY()), + w = ((ws) ? 'winWidth' : OFFSET_WIDTH), + h = ((ws) ? 'winHeight' : OFFSET_HEIGHT), + t = ((ws) ? n.get(SCROLL_TOP) : xy[1]), + l = ((ws) ? n.get(SCROLL_LEFT) : xy[0]); + + r = { + top: t + b, + right: (n.get(w) + l) - b, + bottom: (n.get(h) + t) - b, + left: l + b + }; + this._vpRegionCache = r; + return r; + }, + initializer: function() { + var h = this.get(HOST); + h.after('drag:start', Y.bind(this.start, this)); + h.after('drag:end', Y.bind(this.end, this)); + h.on('drag:align', Y.bind(this.align, this)); + + //TODO - This doesn't work yet?? + Y.one('win').on('scroll', Y.bind(function() { + this._vpRegionCache = null; + }, this)); + }, + /** + * Check to see if we need to fire the scroll timer. If scroll timer is running this will scroll the window. + * @private + * @method _checkWinScroll + * @param {Boolean} move Should we move the window. From Y.later + */ + _checkWinScroll: function(move) { + var r = this._getVPRegion(), + ho = this.get(HOST), + ws = this.get(WINDOW_SCROLL), + xy = ho.lastXY, + scroll = false, + b = this.get(BUFFER), + win = this.get(PARENT_SCROLL), + sTop = win.get(SCROLL_TOP), + sLeft = win.get(SCROLL_LEFT), + w = this._dimCache.w, + h = this._dimCache.h, + bottom = xy[1] + h, + top = xy[1], + right = xy[0] + w, + left = xy[0], + nt = top, + nl = left, + st = sTop, + sl = sLeft; + + if (this.get('horizontal')) { + if (left <= r.left) { + scroll = true; + nl = xy[0] - ((ws) ? b : 0); + sl = sLeft - b; + } + if (right >= r.right) { + scroll = true; + nl = xy[0] + ((ws) ? b : 0); + sl = sLeft + b; + } + } + if (this.get('vertical')) { + if (bottom >= r.bottom) { + scroll = true; + nt = xy[1] + ((ws) ? b : 0); + st = sTop + b; + + } + if (top <= r.top) { + scroll = true; + nt = xy[1] - ((ws) ? b : 0); + st = sTop - b; + } + } + + if (st < 0) { + st = 0; + nt = xy[1]; + } + + if (sl < 0) { + sl = 0; + nl = xy[0]; + } + + if (nt < 0) { + nt = xy[1]; + } + if (nl < 0) { + nl = xy[0]; + } + if (move) { + ho.actXY = [nl, nt]; + ho._alignNode([nl, nt], true); //We are srolling.. + xy = ho.actXY; + ho.actXY = [nl, nt]; + ho._moveNode({ node: win, top: st, left: sl}); + if (!st && !sl) { + this._cancelScroll(); + } + } else { + if (scroll) { + this._initScroll(); + } else { + this._cancelScroll(); + } + } + }, + /** + * Cancel a previous scroll timer and init a new one. + * @private + * @method _initScroll + */ + _initScroll: function() { + this._cancelScroll(); + this._scrollTimer = Y.Lang.later(this.get('scrollDelay'), this, this._checkWinScroll, [true], true); + + }, + /** + * Cancel a currently running scroll timer. + * @private + * @method _cancelScroll + */ + _cancelScroll: function() { + this._scrolling = false; + if (this._scrollTimer) { + this._scrollTimer.cancel(); + delete this._scrollTimer; + } + }, + /** + * Called from the drag:align event to determine if we need to scroll. + * @method align + */ + align: function(e) { + if (this._scrolling) { + this._cancelScroll(); + e.preventDefault(); + } + if (!this._scrolling) { + this._checkWinScroll(); + } + }, + /** + * Set the cache of the dragNode dims. + * @private + * @method _setDimCache + */ + _setDimCache: function() { + var node = this.get(HOST).get('dragNode'); + this._dimCache = { + h: node.get(OFFSET_HEIGHT), + w: node.get(OFFSET_WIDTH) + }; + }, + /** + * Called from the drag:start event + * @method start + */ + start: function() { + this._setDimCache(); + }, + /** + * Called from the drag:end event + * @method end + */ + end: function() { + this._dimCache = null; + this._cancelScroll(); + } + }); + + Y.namespace('Plugin'); + + + /** + * Extends the Scroll class to make the window scroll while dragging. + * @class DDWindowScroll + * @extends Scroll + * @namespace Plugin + * @constructor + */ + WS = function() { + WS.superclass.constructor.apply(this, arguments); + }; + WS.ATTRS = Y.merge(S.ATTRS, { + /** + * Turn on window scroll support, default: true + * @attribute windowScroll + * @type Boolean + */ + windowScroll: { + value: true, + setter: function(scroll) { + if (scroll) { + this.set(PARENT_SCROLL, Y.one('win')); + } + return scroll; + } + } + }); + Y.extend(WS, S, { + //Shouldn't have to do this.. + initializer: function() { + this.set('windowScroll', this.get('windowScroll')); + } + }); + /** + * The Scroll instance will be placed on the Drag instance under the winscroll namespace. + * @property NS + * @default winscroll + * @readonly + * @protected + * @static + * @type {String} + */ + WS.NAME = WS.NS = 'winscroll'; + Y.Plugin.DDWinScroll = WS; + + + /** + * Extends the Scroll class to make a parent node scroll while dragging. + * @class DDNodeScroll + * @extends Scroll + * @namespace Plugin + * @constructor + */ + NS = function() { + NS.superclass.constructor.apply(this, arguments); + + }; + NS.ATTRS = Y.merge(S.ATTRS, { + /** + * The node we want to scroll. Used to set the internal parentScroll attribute. + * @attribute node + * @type Node + */ + node: { + value: false, + setter: function(node) { + var n = Y.one(node); + if (!n) { + if (node !== false) { + Y.error('DDNodeScroll: Invalid Node Given: ' + node); + } + } else { + this.set(PARENT_SCROLL, n); + } + return n; + } + } + }); + Y.extend(NS, S, { + //Shouldn't have to do this.. + initializer: function() { + this.set('node', this.get('node')); + } + }); + /** + * The NodeScroll instance will be placed on the Drag instance under the nodescroll namespace. + * @property NS + * @default nodescroll + * @readonly + * @protected + * @static + * @type {String} + */ + NS.NAME = NS.NS = 'nodescroll'; + Y.Plugin.DDNodeScroll = NS; + + Y.DD.Scroll = S; + + + + +}, '@VERSION@', {"requires": ["dd-drag"]}); diff --git a/src/dd/js/drop.js b/src/dd/js/drop.js index c2b9b8f62e7..f21d1342a3c 100644 --- a/src/dd/js/drop.js +++ b/src/dd/js/drop.js @@ -69,8 +69,13 @@ //DD init speed up. + // (GS) Causes errors. + // (GS) See: http://yuilibrary.com/trac-archive/tickets/2532985.html + // (GS) However, changing from async to sync + // (GS) will cause change propagation, so leave it alone + // (GS) until further investigation and thorough testing. Y.on('domready', Y.bind(function() { - Y.later(100, this, this._createShim); + Y.later(100, this, Drop_createShim); }, this)); DDM._regTarget(this); @@ -176,6 +181,56 @@ } }; + function Drop_createShim() { + //No playground, defer + if (!DDM._pg) { + Y.later(10, this, Drop_createShim); + return; + } + if (this.shim) return; + + var s = this.get('node'); + + if (this.get('useShim')) { + createShimNode(this, s); + } else { + this.shim = s; + } + } + + function createShimNode(drop, s) { + var id, node; + try { + id = s.get("id"); + } catch(ex) { + // _stateProxy is null, TypeError thrown getting + // _stateProxy[id]. + // See: http://yuilibrary.com/trac-archive/tickets/2532985.html + return s; + } + + s = Y.Node.create('
'); + node = drop.get(NODE); + s.setStyles({ + height: node.get(OFFSET_HEIGHT) + 'px', + width: node.get(OFFSET_WIDTH) + 'px', + backgroundColor: 'yellow', + opacity: '.5', + zIndex: '1', + overflow: 'hidden', + top: '-900px', + left: '-900px', + position: 'absolute' + }); + DDM._pg.appendChild(s); + + s.on('mouseover', Y.bind(drop._handleOverEvent, drop)); + s.on('mouseout', Y.bind(drop._handleOutEvent, drop)); + drop.shim = s; + drop.fire("shimCreated", {drag: DDM.activeDrag }); + return s; + } + Y.extend(Drop, Y.Base, { /** * The default bubbleTarget for this object. Default: Y.DD.DDM @@ -433,46 +488,7 @@ left: xy[0] }; }, - /** - * Creates the Target shim and adds it to the DDM's playground.. - * @private - * @method _createShim - */ - _createShim: function() { - //No playground, defer - if (!DDM._pg) { - Y.later(10, this, this._createShim); - return; - } - //Shim already here, cancel - if (this.shim) { - return; - } - var s = this.get('node'); - - if (this.get('useShim')) { - s = Y.Node.create('
'); - s.setStyles({ - height: this.get(NODE).get(OFFSET_HEIGHT) + 'px', - width: this.get(NODE).get(OFFSET_WIDTH) + 'px', - backgroundColor: 'yellow', - opacity: '.5', - zIndex: '1', - overflow: 'hidden', - top: '-900px', - left: '-900px', - position: 'absolute' - }); - - DDM._pg.appendChild(s); - s.on('mouseover', Y.bind(this._handleOverEvent, this)); - s.on('mouseout', Y.bind(this._handleOutEvent, this)); - } - - - this.shim = s; - }, /** * This handles the over target call made from this object or from the DDM * @private diff --git a/src/dd/tests/unit/assets/dd-tests.js b/src/dd/tests/unit/assets/dd-tests.js index 4c038b60e31..a7385b12520 100644 --- a/src/dd/tests/unit/assets/dd-tests.js +++ b/src/dd/tests/unit/assets/dd-tests.js @@ -100,10 +100,13 @@ YUI.add('dd-tests', function(Y) { }, setUp : function() { - }, + }, tearDown : function() { + // Tests seem to be affected by cleanup. + // Y.all(".yui3-dd-shim, .yui3-dd-proxy").remove(true); }, + test_shim: function() { var s = Y.DD.DDM._pg; Y.Assert.isNull(s, 'Shim: Node Instance'); @@ -138,6 +141,7 @@ YUI.add('dd-tests', function(Y) { }); }, test_drag_setup: function() { + // (GS) Assignment to undeclared identifier? dd = new Y.DD.Drag({ node: '#drag', bubbles: Y.DD.DDM }); Y.Assert.isInstanceOf(Y.DD.Drag, dd, 'dd: Drag Instance'); Y.Assert.isTrue(dd.get('node').hasClass('yui3-dd-draggable'), 'dd: Drag Instance ClassName'); @@ -222,22 +226,40 @@ YUI.add('dd-tests', function(Y) { Y.DD.DDM._docMove = _docMove; Y.DD.DDM._move = _move; }, + test_drop_overs: function() { - dd.target._createShim(); - dd.target._handleOverEvent(); - var zIndex = parseInt(dd.target.shim.getStyle('zIndex'), 0); - Y.Assert.areSame(999, zIndex, 'Failed to change zIndex of shim'); - - dd.target._handleOutEvent(); - var zIndex = parseInt(dd.target.shim.getStyle('zIndex'), 0); - Y.Assert.areSame(1, zIndex, 'Failed to change zIndex of shim'); - - dd.target.overTarget = true; - Y.DD.DDM.activeDrag = dd.target; - dd.target._handleOut(true); - - + drop = new Y.DD.Drop({ node: '#drop', useShim: true, bubbles: Y.DD.DDM }); + + // (GS):- + // Avoid boxed-into-a-corner situation of needing to call + // calling "_private" methods. + // + // TODO: + // Make those methods truly private, and not part of the + // object's public interface, and listen to the shimCreated + // event, which is fired when the shim is asynchronously created. + // If & when shim creation becomes sync, consider deprecating + // this event. + drop.on("drop:shimCreated", function() { + var shim = drop.shim, + shimElement = document.getElementById(shim.get("id")); + Y.Event.simulate(shimElement, "mouseover"); + var zIndex = parseInt(shim.getStyle('zIndex'), 0); + + // (GS) Why test for arbitrary implementation + // details such as exactly 999? + Y.Assert.areSame(999, zIndex, 'Failed to change zIndex of shim'); + + Y.Event.simulate(shimElement, "mouseout"); + var zIndex = parseInt(shim.getStyle('zIndex'), 0); + Y.Assert.areSame(1, zIndex, 'Failed to change zIndex of shim'); + + dd.target.overTarget = true; + Y.DD.DDM.activeDrag = dd.target; + dd.target._handleOut(true); + }); }, + test_drag_handles: function() { Y.Assert.isNull(dd._handles, 'Drag has handles already'); dd.addHandle('foo'); @@ -820,12 +842,30 @@ YUI.add('dd-tests', function(Y) { Y.Assert.isTrue(radioInput.get('checked')); }, 100); + }, + + 'test _createShim typerror with destroyed node' : function() { + var wrap = Y.one('#wrap'); + var divs = wrap.all("div"); + divs.each(function (div) { + div.plug(Y.Plugin.Drop); + }); + + // TypeError: node is null. (node = _stateProxy) + // Y.DD.Drop._createShim can get called after + // Drop destruction. + // http://yuilibrary.com/trac-archive/tickets/2532985.html + wrap.empty(); } }; var suite = new Y.Test.Suite('DragDrop'); suite.add(new Y.Test.Case(template)); + suite.tearDown = function() { + Y.all(".yui3-dd-shim, .yui3-dd-proxy").remove(true); + }; + Y.Test.Runner.add(suite); }); diff --git a/src/dd/tests/unit/index.html b/src/dd/tests/unit/index.html index 6efe171fb9c..6da32ff2d1a 100644 --- a/src/dd/tests/unit/index.html +++ b/src/dd/tests/unit/index.html @@ -49,4 +49,4 @@ - + \ No newline at end of file