{"id":0,"registry":{"0":{"submorphs":[{"__isSmartRef__":true,"id":1}],"scripts":[],"id":760,"shape":{"__isSmartRef__":true,"id":79},"droppingEnabled":true,"halosEnabled":true,"registeredForMouseEvents":true,"_Position":{"__isSmartRef__":true,"id":85},"showsHalos":false,"name":"GrabbingControl","partsBinMetaInfo":{"__isSmartRef__":true,"id":86},"__SourceModuleName__":"Global.lively.morphic.Core","renderContextTable":{"__isSmartRef__":true,"id":87},"eventHandler":{"__isSmartRef__":true,"id":88},"attributeConnections":[],"doNotSerialize":[],"doNotCopyProperties":[],"priorExtent":{"__isSmartRef__":true,"id":89},"distanceToDragEvent":{"__isSmartRef__":true,"id":90},"layout":{"__isSmartRef__":true,"id":91},"_Rotation":0,"_Scale":1.002003004005006,"__LivelyClassName__":"lively.morphic.Box"},"1":{"submorphs":[{"__isSmartRef__":true,"id":2}],"scripts":[],"id":761,"shape":{"__isSmartRef__":true,"id":16},"grabbingEnabled":false,"droppingEnabled":false,"halosEnabled":true,"registeredForMouseEvents":true,"value":false,"toggle":false,"isActive":true,"normalFill":{"__isSmartRef__":true,"id":20},"lighterFill":{"__isSmartRef__":true,"id":31},"label":{"__isSmartRef__":true,"id":2},"name":"StartStopButton","showsHalos":false,"partsBinMetaInfo":{"__isSmartRef__":true,"id":40},"attributeConnections":[{"__isSmartRef__":true,"id":41},{"__isSmartRef__":true,"id":42}],"doNotSerialize":["$$running","$$fire"],"doNotCopyProperties":["$$running","$$fire"],"__SourceModuleName__":"Global.lively.morphic.Widgets","priorExtent":{"__isSmartRef__":true,"id":43},"renderContextTable":{"__isSmartRef__":true,"id":44},"eventHandler":{"__isSmartRef__":true,"id":45},"connections":{"__isSmartRef__":true,"id":46},"_Position":{"__isSmartRef__":true,"id":48},"owner":{"__isSmartRef__":true,"id":0},"scriptAnnotations":{"__isSmartRef__":true,"id":49},"distanceToDragEvent":{"__isSmartRef__":true,"id":58},"running":true,"_Rotation":0,"_Scale":1,"__serializedLivelyClosures__":{"__isSmartRef__":true,"id":59},"__LivelyClassName__":"lively.morphic.Button"},"2":{"submorphs":[],"scripts":[],"id":762,"shape":{"__isSmartRef__":true,"id":3},"grabbingEnabled":false,"droppingEnabled":false,"halosEnabled":true,"fixedWidth":true,"_WhiteSpaceHandling":"pre-wrap","fixedHeight":true,"allowInput":false,"_FontFamily":"Helvetica","registeredForMouseEvents":true,"_Position":{"__isSmartRef__":true,"id":8},"_MaxTextWidth":139.97501364208009,"_MaxTextHeight":21,"textStyle":null,"padding":{"__isSmartRef__":true,"id":9},"_Padding":{"__isSmartRef__":true,"id":10},"owner":{"__isSmartRef__":true,"id":1},"isLabel":true,"eventsAreIgnored":true,"__SourceModuleName__":"Global.lively.morphic.TextCore","_ClipMode":"hidden","priorExtent":{"__isSmartRef__":true,"id":11},"textChunks":[{"__isSmartRef__":true,"id":12}],"_Align":"center","renderContextTable":{"__isSmartRef__":true,"id":14},"eventHandler":{"__isSmartRef__":true,"id":15},"_HandStyle":"default","_PointerEvents":"none","attributeConnections":[],"doNotSerialize":[],"doNotCopyProperties":[],"__LivelyClassName__":"lively.morphic.Text"},"3":{"position":{"__isSmartRef__":true,"id":4},"_Extent":{"__isSmartRef__":true,"id":5},"_BorderWidth":0,"_BorderColor":{"__isSmartRef__":true,"id":6},"_Fill":null,"__SourceModuleName__":"Global.lively.morphic.Shapes","renderContextTable":{"__isSmartRef__":true,"id":7},"__LivelyClassName__":"lively.morphic.Shapes.Rectangle"},"4":{"x":0,"y":0,"__SourceModuleName__":"Global","__LivelyClassName__":"Point"},"5":{"x":139.97501364208009,"y":21,"__LivelyClassName__":"Point","__SourceModuleName__":"Global"},"6":{"r":0,"g":0,"b":0,"a":1,"__SourceModuleName__":"Global","__LivelyClassName__":"Color"},"7":{"init":"initHTML","appendShape":"renderHTML","setPosition":"setPositionHTML","setExtent":"setExtentHTML","setFill":"setFillHTML","setBorderColor":"setBorderColorHTML","setBorderWidth":"setBorderWidthHTML","setStrokeOpacity":"setStrokeOpacityHTML","setBorderRadius":"setBorderRadiusHTML","setBorderStyle":"setBorderStyleHTML","setOpacity":"setOpacityHTML"},"8":{"x":0,"y":0,"__SourceModuleName__":"Global","__LivelyClassName__":"Point"},"9":{"x":5,"y":5,"width":0,"height":0,"__SourceModuleName__":"Global","__LivelyClassName__":"Rectangle"},"10":{"x":0,"y":0,"width":0,"height":0,"__SourceModuleName__":"Global","__LivelyClassName__":"Rectangle"},"11":{"x":139.97501364208009,"y":21,"__LivelyClassName__":"Point","__SourceModuleName__":"Global"},"12":{"style":{"__isSmartRef__":true,"id":13},"chunkOwner":{"__isSmartRef__":true,"id":2},"__SourceModuleName__":"Global.lively.morphic.TextCore","storedString":"disable grabbing","__LivelyClassName__":"lively.morphic.TextChunk"},"13":{"__SourceModuleName__":"Global.lively.morphic.TextCore","__LivelyClassName__":"lively.morphic.TextEmphasis"},"14":{"replaceRenderContext":"replaceRenderContextHTML","init":"initHTML","append":"appendHTML","remove":"removeHTML","triggerEvent":"triggerEventHTML","setTransform":"setTransformHTML","setPosition":"setPositionHTML","setRotation":"setRotationHTML","setExtent":"setExtentHTML","setScale":"setScaleHTML","setVisible":"setVisibleHTML","setOrigin":"setOriginHTML","setPivotPoint":"setPivotPointHTML","setClipMode":"setClipModeHTML","setHandStyle":"setHandStyleHTML","setPointerEvents":"setPointerEventsHTML","setToolTip":"setToolTipHTML","focus":"focusHTML","blur":"blurHTML","setFocusable":"setFocusableHTML","updateText":"updateTextHTML","setTextExtent":"setTextExtentHTML","setMaxTextWidth":"setMaxTextWidthHTML","setMaxTextHeight":"setMaxTextHeightHTML","getTextExtent":"getTextExtentHTML","getTextString":"getTextStringHTML","ignoreTextEvents":"ignoreTextEventsHTML","enableTextEvents":"enableTextEventsHTML","setFontFamily":"setFontFamilyHTML","setFontSize":"setFontSizeHTML","setTextColor":"setTextColorHTML","setPadding":"setPaddingHTML","setAlign":"setAlignHTML","setVerticalAlign":"setVerticalAlignHTML","setDisplay":"setDisplayHTML","setWhiteSpaceHandling":"setWhiteSpaceHandlingHTML"},"15":{"morph":{"__isSmartRef__":true,"id":2},"__SourceModuleName__":"Global.lively.morphic.Events","__LivelyClassName__":"lively.morphic.EventHandler"},"16":{"position":{"__isSmartRef__":true,"id":17},"_Extent":{"__isSmartRef__":true,"id":18},"_BorderWidth":1.1840000000000002,"_BorderColor":{"__isSmartRef__":true,"id":19},"_Fill":{"__isSmartRef__":true,"id":20},"_BorderRadius":5.2,"__SourceModuleName__":"Global.lively.morphic.Shapes","renderContextTable":{"__isSmartRef__":true,"id":30},"__LivelyClassName__":"lively.morphic.Shapes.Rectangle"},"17":{"x":0,"y":0,"__SourceModuleName__":"Global","__LivelyClassName__":"Point"},"18":{"x":139.97501364208009,"y":21,"__SourceModuleName__":"Global","__LivelyClassName__":"Point"},"19":{"r":0.839,"g":0.839,"b":0.839,"a":1,"__SourceModuleName__":"Global","__LivelyClassName__":"Color"},"20":{"stops":[{"__isSmartRef__":true,"id":21},{"__isSmartRef__":true,"id":23},{"__isSmartRef__":true,"id":25},{"__isSmartRef__":true,"id":27}],"vector":{"__isSmartRef__":true,"id":29},"__SourceModuleName__":"Global.lively.morphic.Shapes","__LivelyClassName__":"lively.morphic.LinearGradient"},"21":{"offset":0,"color":{"__isSmartRef__":true,"id":22}},"22":{"r":0.9600000000000001,"g":0.9600000000000001,"b":0.9600000000000001,"a":1,"__SourceModuleName__":"Global","__LivelyClassName__":"Color"},"23":{"offset":0.4,"color":{"__isSmartRef__":true,"id":24}},"24":{"r":0.8200000000000001,"g":0.8200000000000001,"b":0.8200000000000001,"a":1,"__SourceModuleName__":"Global","__LivelyClassName__":"Color"},"25":{"offset":0.6,"color":{"__isSmartRef__":true,"id":26}},"26":{"r":0.8200000000000001,"g":0.8200000000000001,"b":0.8200000000000001,"a":1,"__SourceModuleName__":"Global","__LivelyClassName__":"Color"},"27":{"offset":1,"color":{"__isSmartRef__":true,"id":28}},"28":{"r":0.94,"g":0.94,"b":0.94,"a":1,"__SourceModuleName__":"Global","__LivelyClassName__":"Color"},"29":{"x":0,"y":0,"width":0,"height":1,"__SourceModuleName__":"Global","__LivelyClassName__":"Rectangle"},"30":{"init":"initHTML","appendShape":"renderHTML","setPosition":"setPositionHTML","setExtent":"setExtentHTML","setFill":"setFillHTML","setBorderColor":"setBorderColorHTML","setBorderWidth":"setBorderWidthHTML","setStrokeOpacity":"setStrokeOpacityHTML","setBorderRadius":"setBorderRadiusHTML","setBorderStyle":"setBorderStyleHTML","setOpacity":"setOpacityHTML"},"31":{"stops":[{"__isSmartRef__":true,"id":32},{"__isSmartRef__":true,"id":34},{"__isSmartRef__":true,"id":36},{"__isSmartRef__":true,"id":38}],"vector":{"__isSmartRef__":true,"id":29},"__SourceModuleName__":"Global.lively.morphic.Shapes","__LivelyClassName__":"lively.morphic.LinearGradient"},"32":{"offset":0,"color":{"__isSmartRef__":true,"id":33}},"33":{"r":0.98,"g":0.98,"b":0.98,"a":1,"__SourceModuleName__":"Global","__LivelyClassName__":"Color"},"34":{"offset":0.4,"color":{"__isSmartRef__":true,"id":35}},"35":{"r":0.91,"g":0.91,"b":0.91,"a":1,"__SourceModuleName__":"Global","__LivelyClassName__":"Color"},"36":{"offset":0.6,"color":{"__isSmartRef__":true,"id":37}},"37":{"r":0.91,"g":0.91,"b":0.91,"a":1,"__SourceModuleName__":"Global","__LivelyClassName__":"Color"},"38":{"offset":1,"color":{"__isSmartRef__":true,"id":39}},"39":{"r":0.97,"g":0.97,"b":0.97,"a":1,"__SourceModuleName__":"Global","__LivelyClassName__":"Color"},"40":{"partsSpaceName":"PartsBin/Inputs/","__SourceModuleName__":"Global.lively.PartsBin","migrationLevel":2,"partName":"StartStopButton","comment":"Has a script that is called on button press","__LivelyClassName__":"lively.PartsBin.PartsBinMetaInfo"},"41":{"sourceObj":{"__isSmartRef__":true,"id":1},"sourceAttrName":"running","targetObj":{"__isSmartRef__":true,"id":1},"targetMethodName":"updateLabel","__SourceModuleName__":"Global.lively.bindings","__LivelyClassName__":"AttributeConnection"},"42":{"sourceObj":{"__isSmartRef__":true,"id":1},"sourceAttrName":"fire","targetObj":{"__isSmartRef__":true,"id":1},"targetMethodName":"onFire","__SourceModuleName__":"Global.lively.bindings","__LivelyClassName__":"AttributeConnection"},"43":{"x":139.0470371267925,"y":21,"__SourceModuleName__":"Global","__LivelyClassName__":"Point"},"44":{"replaceRenderContext":"replaceRenderContextHTML","init":"initHTML","append":"appendHTML","remove":"removeHTML","triggerEvent":"triggerEventHTML","setTransform":"setTransformHTML","setPosition":"setPositionHTML","setRotation":"setRotationHTML","setExtent":"setExtentHTML","setScale":"setScaleHTML","setVisible":"setVisibleHTML","setOrigin":"setOriginHTML","setPivotPoint":"setPivotPointHTML","setClipMode":"setClipModeHTML","setHandStyle":"setHandStyleHTML","setPointerEvents":"setPointerEventsHTML","setToolTip":"setToolTipHTML","focus":"focusHTML","blur":"blurHTML","setFocusable":"setFocusableHTML"},"45":{"morph":{"__isSmartRef__":true,"id":1},"__SourceModuleName__":"Global.lively.morphic.Events","__LivelyClassName__":"lively.morphic.EventHandler"},"46":{"running":{"__isSmartRef__":true,"id":47}},"47":{},"48":{"x":12.011805911956586,"y":8.29248716698001,"__SourceModuleName__":"Global","__LivelyClassName__":"Point"},"49":{"updateLabel":{"__isSmartRef__":true,"id":50},"setupGrabbing":{"__isSmartRef__":true,"id":52},"onFire":{"__isSmartRef__":true,"id":54},"onrestore":{"__isSmartRef__":true,"id":56}},"50":{"time":{"__isSmartRef__":true,"id":51},"user":"jenslincke"},"51":{"isSerializedDate":true,"string":"Tue Jun 28 2011 08:08:00 GMT-0700 (PDT)"},"52":{"time":{"__isSmartRef__":true,"id":53},"user":"robertkrahn"},"53":{"isSerializedDate":true,"string":"Mon Jul 04 2011 09:03:21 GMT-0700 (PDT)"},"54":{"time":{"__isSmartRef__":true,"id":55},"user":"jenslincke"},"55":{"isSerializedDate":true,"string":"Tue Jun 28 2011 08:06:51 GMT-0700 (PDT)"},"56":{"time":{"__isSmartRef__":true,"id":57},"user":"robertkrahn"},"57":{"isSerializedDate":true,"string":"Mon Jul 04 2011 08:28:26 GMT-0700 (PDT)"},"58":{"x":109.96452154306895,"y":-14.128593913472798,"__SourceModuleName__":"Global","__LivelyClassName__":"Point"},"59":{"onrestore":{"__isSmartRef__":true,"id":60},"setupGrabbing":{"__isSmartRef__":true,"id":67},"onFire":{"__isSmartRef__":true,"id":70},"reset":{"__isSmartRef__":true,"id":73},"updateLabel":{"__isSmartRef__":true,"id":76}},"60":{"varMapping":{"__isSmartRef__":true,"id":61},"source":"function onrestore() {\n    $super()\n    this.setupGrabbing()\n    if (this.running) GrabbingLayer.beGlobal()\n}","funcProperties":{"__isSmartRef__":true,"id":66},"__SourceModuleName__":"Global","__LivelyClassName__":"lively.Closure"},"61":{"this":{"__isSmartRef__":true,"id":1},"__serializedLivelyClosures__":{"__isSmartRef__":true,"id":62}},"62":{"$super":{"__isSmartRef__":true,"id":63}},"63":{"varMapping":{"__isSmartRef__":true,"id":64},"source":"function () {\n                try {\n                    return obj.constructor.prototype[name].apply(obj, arguments)\n                } catch(e) {\n                    alert('Error in $super call: ' + e + '\\n' + e.stack);\n                    return null;\n                }\n            }","funcProperties":{"__isSmartRef__":true,"id":65},"__SourceModuleName__":"Global","__LivelyClassName__":"lively.Closure"},"64":{"obj":{"__isSmartRef__":true,"id":1},"name":"onrestore"},"65":{},"66":{},"67":{"varMapping":{"__isSmartRef__":true,"id":68},"source":"function setupGrabbing() {\n// this.setupGrabbing()\nmodule('lively.LayerableMorphs').load()\n\ncop.create('GrabbingLayer').refineClass(lively.morphic.Morph, {\n    get draggingEnabled() {return true},\n\n    onDragStart: function(evt) {\n        if (cop.proceed(evt)) return;\n        evt.hand.grabMorph(this)\n    },\n\n     onDrag: function(evt) {\n        cop.proceed(evt)\n        return true;\n    },\n\n    onDragEnd: function(evt) {\n        cop.proceed(evt)\n        return true;\n    },\n})\n.refineClass(lively.morphic.Text, {\n    get draggingEnabled() {return true},\n\n    onDragStart: function(evt) {\n        if (cop.proceed(evt)) return;\n        // only grab when in outer area of bounds\n        var bounds = this.innerBounds(),\n            smallerBounds = bounds.insetBy(6),\n            pos = this.localize(evt.getPosition());\n        if (bounds.containsPoint(pos) && !smallerBounds.containsPoint(pos))\n            evt.hand.grabMorph(this)\n    },\n\n     onDrag: function(evt) {\n        cop.proceed(evt)\n        return true;\n    },\n\n    onDragEnd: function(evt) {\n        cop.proceed(evt)\n        return true;\n    },\n})\n\n\nvar targetObj = lively.morphic.Window.prototype\nif (!targetObj.withoutLayers)\n    targetObj.withoutLayers = [];\n\nif (!targetObj.withoutLayers.include(GrabbingLayer))\n    targetObj.withoutLayers.push(GrabbingLayer)\n\n}","funcProperties":{"__isSmartRef__":true,"id":69},"__SourceModuleName__":"Global","__LivelyClassName__":"lively.Closure"},"68":{"this":{"__isSmartRef__":true,"id":1}},"69":{},"70":{"varMapping":{"__isSmartRef__":true,"id":71},"source":"function onFire() {\n    this.setupGrabbing();\n\n    this.running = !this.running;\n\n    if(this.running) {\n        GrabbingLayer.beGlobal()\n    } else {\n        GrabbingLayer.beNotGlobal()\n    }\n\n}","funcProperties":{"__isSmartRef__":true,"id":72},"__SourceModuleName__":"Global","__LivelyClassName__":"lively.Closure"},"71":{"this":{"__isSmartRef__":true,"id":1}},"72":{},"73":{"varMapping":{"__isSmartRef__":true,"id":74},"source":"function reset() {\n    this.connections = {running: {}}\n    connect(this, 'running', this, 'updateLabel')\n    connect(this, 'fire', this, 'onFire')\n}","funcProperties":{"__isSmartRef__":true,"id":75},"__SourceModuleName__":"Global","__LivelyClassName__":"lively.Closure"},"74":{"this":{"__isSmartRef__":true,"id":1}},"75":{},"76":{"varMapping":{"__isSmartRef__":true,"id":77},"source":"function updateLabel() {\n    if (this.running) {\n        this.setLabel(\"disable grabbing\")\n    } else {\n        this.setLabel(\"enable grabbing\")\n\n    }\n}","funcProperties":{"__isSmartRef__":true,"id":78},"__SourceModuleName__":"Global","__LivelyClassName__":"lively.Closure"},"77":{"this":{"__isSmartRef__":true,"id":1}},"78":{},"79":{"position":{"__isSmartRef__":true,"id":80},"_Extent":{"__isSmartRef__":true,"id":81},"_BorderWidth":1,"_BorderColor":{"__isSmartRef__":true,"id":82},"_Fill":{"__isSmartRef__":true,"id":83},"__SourceModuleName__":"Global.lively.morphic.Shapes","renderContextTable":{"__isSmartRef__":true,"id":84},"_BorderRadius":17.045,"_Opacity":1,"_BorderStyle":"solid","__LivelyClassName__":"lively.morphic.Shapes.Rectangle"},"80":{"x":0,"y":0,"__SourceModuleName__":"Global","__LivelyClassName__":"Point"},"81":{"x":162.56498346216785,"y":37.1051521075718,"__SourceModuleName__":"Global","__LivelyClassName__":"Point"},"82":{"r":0,"g":0,"b":0,"a":1,"__SourceModuleName__":"Global","__LivelyClassName__":"Color"},"83":{"r":0.921,"g":0.921,"b":0.921,"a":1,"__LivelyClassName__":"Color","__SourceModuleName__":"Global"},"84":{"init":"initHTML","appendShape":"renderHTML","setPosition":"setPositionHTML","setExtent":"setExtentHTML","setFill":"setFillHTML","setBorderColor":"setBorderColorHTML","setBorderWidth":"setBorderWidthHTML","setStrokeOpacity":"setStrokeOpacityHTML","setBorderRadius":"setBorderRadiusHTML","setBorderStyle":"setBorderStyleHTML","setOpacity":"setOpacityHTML"},"85":{"x":0,"y":0,"__LivelyClassName__":"Point","__SourceModuleName__":"Global"},"86":{"partsSpaceName":"PartsBin/Controls/","__SourceModuleName__":"Global.lively.PartsBin","comment":"a control that enables and disables global grabbing behavior","migrationLevel":4,"partName":"GrabbingControl","__LivelyClassName__":"lively.PartsBin.PartsBinMetaInfo"},"87":{"replaceRenderContext":"replaceRenderContextHTML","init":"initHTML","append":"appendHTML","remove":"removeHTML","triggerEvent":"triggerEventHTML","setTransform":"setTransformHTML","setPosition":"setPositionHTML","setRotation":"setRotationHTML","setExtent":"setExtentHTML","setScale":"setScaleHTML","setVisible":"setVisibleHTML","setOrigin":"setOriginHTML","setPivotPoint":"setPivotPointHTML","setClipMode":"setClipModeHTML","setHandStyle":"setHandStyleHTML","setPointerEvents":"setPointerEventsHTML","setToolTip":"setToolTipHTML","focus":"focusHTML","blur":"blurHTML","setFocusable":"setFocusableHTML"},"88":{"morph":{"__isSmartRef__":true,"id":0},"__SourceModuleName__":"Global.lively.morphic.Events","__LivelyClassName__":"lively.morphic.EventHandler"},"89":{"x":162.56498346216785,"y":38.03312862285944,"__SourceModuleName__":"Global","__LivelyClassName__":"Point"},"90":{"x":180.23268380804404,"y":-6.469891213622091,"__SourceModuleName__":"Global","__LivelyClassName__":"Point"},"91":{},"isSimplifiedRegistry":true}}