{"id":0,"registry":{"isSimplifiedRegistry":true,"0":{"submorphs":[],"scripts":[],"id":"04BFEABB-BEB4-425A-97DC-7C4C864B504A","shape":{"__isSmartRef__":true,"id":1},"droppingEnabled":true,"halosEnabled":true,"registeredForMouseEvents":true,"_Position":{"__isSmartRef__":true,"id":8},"showsHalos":false,"name":"ResizeCorner","partsBinMetaInfo":{"__isSmartRef__":true,"id":9},"__SourceModuleName__":"Global.lively.morphic.Core","draggingEnabled":true,"dragStartPoint":null,"originalExtent":{"__isSmartRef__":true,"id":14},"originalTargetExtent":null,"renderContextTable":{"__isSmartRef__":true,"id":15},"eventHandler":{"__isSmartRef__":true,"id":16},"priorExtent":{"__isSmartRef__":true,"id":17},"originalTargetInnerBounds":null,"isResizeCorner":true,"relativeOrigin":null,"derivationIds":[7147,"16E962DF-21E9-4FE6-8B9B-953F0E908113","ADD0B5C0-0DC6-4D8E-9C2A-0EC7E3C71F21","4307EC46-FFDF-4A06-A632-D51F903FDBE5"],"moved":true,"attributeConnections":[{"__isSmartRef__":true,"id":18}],"doNotSerialize":["$$cornerName"],"doNotCopyProperties":["$$cornerName"],"originalTargetBounds":null,"cornerName":"bottomRight","draggableWithoutHalo":true,"_Rotation":0,"_Scale":1,"__serializedLivelyClosures__":{"__isSmartRef__":true,"id":19},"__LivelyClassName__":"lively.morphic.Box"},"1":{"position":{"__isSmartRef__":true,"id":2},"_Extent":{"__isSmartRef__":true,"id":3},"_BorderWidth":0,"_BorderColor":{"__isSmartRef__":true,"id":4},"_Fill":{"__isSmartRef__":true,"id":5},"__SourceModuleName__":"Global.lively.morphic.Shapes","renderContextTable":{"__isSmartRef__":true,"id":6},"_ClipMode":"visible","_Padding":{"__isSmartRef__":true,"id":7},"__LivelyClassName__":"lively.morphic.Shapes.Rectangle"},"2":{"x":0,"y":0,"__SourceModuleName__":"Global.lively.morphic.Graphics","__LivelyClassName__":"Point"},"3":{"x":44,"y":44,"__SourceModuleName__":"Global.lively.morphic.Graphics","__LivelyClassName__":"Point"},"4":{"r":0.568,"g":0.568,"b":0.568,"a":1,"__SourceModuleName__":"Global.lively.morphic.Graphics","__LivelyClassName__":"Color"},"5":{"r":0.258,"g":0.258,"b":0.258,"a":1,"__LivelyClassName__":"Color","__SourceModuleName__":"Global.lively.morphic.Graphics"},"6":{"init":"initHTML","appendShape":"renderHTML","setPosition":"setPositionHTML","setExtent":"setExtentHTML","setPadding":"setPaddingHTML","setFill":"setFillHTML","setBorderColor":"setBorderColorHTML","setBorderWidth":"setBorderWidthHTML","setStrokeOpacity":"setStrokeOpacityHTML","setBorderRadius":"setBorderRadiusHTML","setBorderStyle":"setBorderStyleHTML","setOpacity":"setOpacityHTML","setClipMode":"setClipModeHTML"},"7":{"x":0,"y":0,"width":0,"height":0,"__SourceModuleName__":"Global.lively.morphic.Graphics","__LivelyClassName__":"Rectangle"},"8":{"x":0,"y":0,"__LivelyClassName__":"Point","__SourceModuleName__":"Global.lively.morphic.Graphics"},"9":{"partsSpaceName":"PartsBin/iPad Widgets/","__SourceModuleName__":"Global.lively.PartsBin","migrationLevel":4,"comment":"Resize an object without using halos.","partName":"ResizeCorner","changes":[{"__isSmartRef__":true,"id":10},{"__isSmartRef__":true,"id":12}],"__LivelyClassName__":"lively.PartsBin.PartsBinMetaInfo"},"10":{"date":{"__isSmartRef__":true,"id":11},"author":"sstamm","message":"draggable without halo and larger to fit iPad guidelines","id":"82526196-8CCF-49FE-A06C-32F070B03BDB"},"11":{"isSerializedDate":true,"string":"Tue Feb 28 2012 16:41:29 GMT+0100"},"12":{"date":{"__isSmartRef__":true,"id":13},"author":"athomschke","message":"","id":"BF560416-8D31-4F25-93E8-F757EC9A9687"},"13":{"isSerializedDate":true,"string":"Wed Apr 04 2012 12:16:46 GMT+0200"},"14":{"x":239,"y":138,"__SourceModuleName__":"Global.lively.morphic.Graphics","__LivelyClassName__":"Point"},"15":{"replaceRenderContext":"replaceRenderContextHTML","init":"initHTML","append":"appendHTML","remove":"removeHTML","triggerEvent":"triggerEventHTML","setTransform":"setTransformHTML","setPosition":"setPositionHTML","setRotation":"setRotationHTML","setExtent":"setExtentHTML","setScale":"setScaleHTML","setVisible":"setVisibleHTML","adjustOrigin":"adjustOriginHTML","setPivotPoint":"setPivotPointHTML","setClipMode":"setClipModeHTML","showsVerticalScrollBar":"showsVerticalScrollBarHTML","showsHorizontalScrollBar":"showsHorizontalScrollBarHTML","getScrollBarExtent":"getScrollBarExtentHTML","setHandStyle":"setHandStyleHTML","setPointerEvents":"setPointerEventsHTML","setToolTip":"setToolTipHTML","focus":"focusHTML","blur":"blurHTML","setFocusable":"setFocusableHTML"},"16":{"morph":{"__isSmartRef__":true,"id":0},"__SourceModuleName__":"Global.lively.morphic.Events","__LivelyClassName__":"lively.morphic.EventHandler"},"17":{"x":10,"y":10,"__SourceModuleName__":"Global.lively.morphic.Graphics","__LivelyClassName__":"Point"},"18":{"sourceObj":{"__isSmartRef__":true,"id":0},"sourceAttrName":"cornerName","targetObj":{"__isSmartRef__":true,"id":0},"targetMethodName":"alignToOwner","__SourceModuleName__":"Global.lively.bindings","__LivelyClassName__":"AttributeConnection"},"19":{"onDrag":{"__isSmartRef__":true,"id":20},"onDragEnd":{"__isSmartRef__":true,"id":28},"onDragStart":{"__isSmartRef__":true,"id":36},"reset":{"__isSmartRef__":true,"id":44},"morphMenuItems":{"__isSmartRef__":true,"id":47},"alignToOwner":{"__isSmartRef__":true,"id":54}},"20":{"varMapping":{"__isSmartRef__":true,"id":21},"source":"function onDrag(evt) {\n    // alert(\"onDrag\")\n    // this.owner.setPosition(pt(0,0))\n    // this.owner.setOrigin(pt(0,0))\n    var moveDelta = evt.mousePoint.subPt(this.dragStartPoint)\n    \n    // moveDelta = moveDelta.maxPt(pt(0,0))\n    var ownerExtent = this.owner.getExtent();\n\n    // TODO does not work\n    if (evt.isShiftDown()) {\n        var maxDelta = Math.max(moveDelta.x, moveDelta.y);\n        if (maxDelta == 0) return;\n        var factor = ownerExtent.x /  ownerExtent.y\n        moveDelta = pt(maxDelta * factor, maxDelta )\n    }\n    var accessor = \"with\" + this.cornerName.charAt(0).toUpperCase() + this.cornerName.substring(1);\n\n    var newCorner = this.originalTargetBounds[this.cornerName]().addPt(moveDelta);\n    var newBounds = this.originalTargetBounds[accessor ](newCorner);\n\n    this.owner.setBounds(newBounds);\n   \n    // var newExtent = this.originalTargetExtent.addPt(moveDelta)\n    // alertOK(\"new extent\" + newExtent)\n    // this.owner.setExtent(newExtent);\n    this.owner.submorphs.select(function(ea) {\n        return ea.isResizeCorner\n    }).invoke('alignToOwner');\n    if (this.owner.halos) {\n        this.owner.halos.invoke('alignAtTarget')\n    }\n    // alertOK(\"relative \" + this.relativeOrigin)\n    var newOrigin =  pt(0,0).extent(this.owner.getExtent()).relativeToAbsPoint(this.relativeOrigin)\n\n    // TODO IMPLEMENT updating the origin does not work yet\n    // this.owner.setOrigin(newOrigin);\n    // alertOK(\"new origin \" + newOrigin)\n\n}","funcProperties":{"__isSmartRef__":true,"id":26},"__SourceModuleName__":"Global.lively.lang.Closure","__LivelyClassName__":"lively.Closure"},"21":{"this":{"__isSmartRef__":true,"id":0},"__serializedLivelyClosures__":{"__isSmartRef__":true,"id":22}},"22":{"$super":{"__isSmartRef__":true,"id":23}},"23":{"varMapping":{"__isSmartRef__":true,"id":24},"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":25},"__SourceModuleName__":"Global.lively.lang.Closure","__LivelyClassName__":"lively.Closure"},"24":{"obj":{"__isSmartRef__":true,"id":0},"name":"onDrag"},"25":{},"26":{"timestamp":{"__isSmartRef__":true,"id":27},"user":"sstamm","tags":[]},"27":{"isSerializedDate":true,"string":"Thu Feb 23 2012 12:08:52 GMT+0100"},"28":{"varMapping":{"__isSmartRef__":true,"id":29},"source":"function onDragEnd(evt) {\n    this.dragStartPoint = null;\n    this.originalTargetBounds = null;\n    this.relativeOrigin = null;\n}","funcProperties":{"__isSmartRef__":true,"id":34},"__SourceModuleName__":"Global.lively.lang.Closure","__LivelyClassName__":"lively.Closure"},"29":{"this":{"__isSmartRef__":true,"id":0},"__serializedLivelyClosures__":{"__isSmartRef__":true,"id":30}},"30":{"$super":{"__isSmartRef__":true,"id":31}},"31":{"varMapping":{"__isSmartRef__":true,"id":32},"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":33},"__SourceModuleName__":"Global.lively.lang.Closure","__LivelyClassName__":"lively.Closure"},"32":{"obj":{"__isSmartRef__":true,"id":0},"name":"onDragEnd"},"33":{},"34":{"timestamp":{"__isSmartRef__":true,"id":35},"user":"sstamm","tags":[]},"35":{"isSerializedDate":true,"string":"Thu Feb 23 2012 12:09:00 GMT+0100"},"36":{"varMapping":{"__isSmartRef__":true,"id":37},"source":"function onDragStart(evt) {\n    var absToRelativePoint =  function (r, absPt) {\n\t\treturn new Point(\n\t\t\t(absPt.x - r.x) / r.width,\n\t\t\t(absPt.y - r.y) / r.height)\n\t}\n    // absToRelativePoint(new Rectangle(10,10,100,100), pt(20,20))\n    // absToRelativePoint(new Rectangle(10,10,100,100), pt(0,0))\n    // absToRelativePoint(new Rectangle(-100,-100,200,200), pt(0,0))\n\n\n    this.dragStartPoint = evt.mousePoint;\n    this.originalTargetBounds= this.owner.bounds();\n    this.relativeOrigin =  absToRelativePoint(pt(0,0).extent(this.owner.getExtent()), this.owner.getOrigin())\n}","funcProperties":{"__isSmartRef__":true,"id":42},"__SourceModuleName__":"Global.lively.lang.Closure","__LivelyClassName__":"lively.Closure"},"37":{"this":{"__isSmartRef__":true,"id":0},"__serializedLivelyClosures__":{"__isSmartRef__":true,"id":38}},"38":{"$super":{"__isSmartRef__":true,"id":39}},"39":{"varMapping":{"__isSmartRef__":true,"id":40},"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":41},"__SourceModuleName__":"Global.lively.lang.Closure","__LivelyClassName__":"lively.Closure"},"40":{"obj":{"__isSmartRef__":true,"id":0},"name":"onDragStart"},"41":{},"42":{"timestamp":{"__isSmartRef__":true,"id":43},"user":"sstamm","tags":[]},"43":{"isSerializedDate":true,"string":"Thu Feb 23 2012 12:08:40 GMT+0100"},"44":{"varMapping":{"__isSmartRef__":true,"id":45},"source":"function reset() {\n    this.isResizeCorner = true\n    this.cornerName = 'bottomRight'\n    this.setExtent(pt(10,10));\n    this.setPosition(pt(0,0))\n}","funcProperties":{"__isSmartRef__":true,"id":46},"__SourceModuleName__":"Global.lively.lang.Closure","__LivelyClassName__":"lively.Closure"},"45":{"this":{"__isSmartRef__":true,"id":0}},"46":{},"47":{"varMapping":{"__isSmartRef__":true,"id":48},"source":"function morphMenuItems() {\n    return $super().concat([\n        [\"corner\", [\n            [\"top left\", function() { this.cornerName = 'topLeft'}.bind(this)],\n            [\"top right\", function() { this.cornerName = 'topRight'}.bind(this)],\n            [\"bottom right\", function() { this.cornerName = 'bottomRight'}.bind(this)],\n            [\"bottom left\", function() { this.cornerName = 'bottomLeft'}.bind(this)],\n        ]]\n    ])\t\n}","funcProperties":{"__isSmartRef__":true,"id":53},"__SourceModuleName__":"Global.lively.lang.Closure","__LivelyClassName__":"lively.Closure"},"48":{"this":{"__isSmartRef__":true,"id":0},"__serializedLivelyClosures__":{"__isSmartRef__":true,"id":49}},"49":{"$super":{"__isSmartRef__":true,"id":50}},"50":{"varMapping":{"__isSmartRef__":true,"id":51},"source":"function () {\n\t\t\t\ttry {\n\t\t\t\t\treturn obj.constructor.prototype[name].apply(obj, arguments)\n\t\t\t\t} catch(e) {\n\t\t\t\t\talert('Error in $super call: ' + e + '\\n' + e.stack);\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}","funcProperties":{"__isSmartRef__":true,"id":52},"__SourceModuleName__":"Global.lively.lang.Closure","__LivelyClassName__":"lively.Closure"},"51":{"obj":{"__isSmartRef__":true,"id":0},"name":"morphMenuItems"},"52":{},"53":{},"54":{"varMapping":{"__isSmartRef__":true,"id":55},"source":"function alignToOwner() {\n    this.align(this.bounds()[this.cornerName](), this.owner.shape.bounds()[this.cornerName]() )\n}","funcProperties":{"__isSmartRef__":true,"id":56},"__SourceModuleName__":"Global.lively.lang.Closure","__LivelyClassName__":"lively.Closure"},"55":{"this":{"__isSmartRef__":true,"id":0}},"56":{}}}