diff --git a/demo/css/matter-inspector.css b/demo/css/matter-inspector.css new file mode 100644 index 0000000..83f74e1 --- /dev/null +++ b/demo/css/matter-inspector.css @@ -0,0 +1,129 @@ +.ins-cursor-move canvas { + cursor: move !important; +} + +.ins-container { + position: fixed; + overflow: auto; + width: 220px; + height: 98%; + left: 0; + background: #3d3d3d; + border-right: 2px solid #444; + padding: 1% 20px; + font-family: Arial; + font-size: 12px; + color: #aaa; +} + +.ins-world-tree { + overflow: auto; + /* height: 90%; */ + /* position: relative; */ + position: absolute; + left: -17px; + right: 0px; + top: 92px; + bottom: 8px; + /* width: 260px; */ +} + +.ins-control-group { + display: block; + clear: both; + overflow: hidden; +} + +.ins-button { + display: block; + float: left; + margin: 20px 0 20px 10px; + padding: 10px; + background: #3a3a3a; + border: 0; + color: #ddd; +} + +.jstree-default .jstree-wholerow-hovered, +.jstree-default .jstree-hovered { + background: transparent; + border-radius: 0; + box-shadow: none; +} + +.jstree-default .jstree-wholerow { + height: 26px; +} + +.jstree-default .jstree-wholerow-clicked, +.jstree-default .jstree-clicked { + /*background: #4a4a4a;*/ + /*background: #373737;*/ + background: transparent; + border-radius: 0; + box-shadow: none; + transition: none; +} + +.jstree-default .jstree-clicked:before { + content: ''; + display: block; + /* width: 100%; */ + position: absolute; + z-index: -1; + left: 0; + right: 0; + height: 26px; + background: #373737; + border-radius: 0; + box-shadow: none; +} + +.jstree-default .jstree-node, +.jstree-default .jstree-leaf .jstree-ocl { + background: transparent; +} +.jstree-default .jstree-open .jstree-ocl { + background-position: -36px -4px; +} +.jstree-default .jstree-closed .jstree-ocl { + background-position: -4px -4px; +} + +.jstree-anchor { + padding: 1px 0; + transition: none; +} + +.jstree-anchor .jstree-icon { + display: none; +} + +.jstree-node-type-bodies > .jstree-anchor, +.jstree-node-type-constraints > .jstree-anchor, +.jstree-node-type-composites > .jstree-anchor { + color: #888; + font-weight: bold; +} + +.ins-container *::-webkit-scrollbar { + width: 12px; + height: 12px; +} + +.ins-container *::-webkit-scrollbar-thumb:vertical { + border-left: 5px solid rgba(0,0,0,0.2); + width: 6px; + /*background: rgba(0,0,0,0.2);*/ +} + +.ins-container *::-webkit-scrollbar-thumb:horizontal { + border-top: 5px solid rgba(0,0,0,0.2); + height: 6px; + /*background: rgba(0,0,0,0.2);*/ +} + +.ins-container *::-webkit-scrollbar-track, +.ins-container *::-webkit-scrollbar-corner { + background: transparent; +} \ No newline at end of file diff --git a/demo/css/style.css b/demo/css/style.css index e8cee63..fb3ac4f 100644 --- a/demo/css/style.css +++ b/demo/css/style.css @@ -99,31 +99,6 @@ canvas:active { color: #000; } -.inspector-container { - position: absolute; - overflow: auto; - width: 220px; - height: 100%; - left: 0; - background: #444; - padding: 20px; - font-family: Arial; - font-size: 12px; - color: #aaa; -} - -.ins-control-group { - display: block; - clear: both; - overflow: hidden; -} - -.ins-button { - display: block; - float: left; - margin: 20px 0 20px 10px; - padding: 10px; - background: #3a3a3a; - border: 0; - color: #ddd; +.dg.a { + margin-right: 0; } \ No newline at end of file diff --git a/demo/dev.html b/demo/dev.html index 799324e..c1cf991 100644 --- a/demo/dev.html +++ b/demo/dev.html @@ -7,11 +7,12 @@ + + - diff --git a/demo/js/Demo.js b/demo/js/Demo.js index 35bd1b8..af2e5a1 100644 --- a/demo/js/Demo.js +++ b/demo/js/Demo.js @@ -818,6 +818,19 @@ _mouseConstraint = MouseConstraint.create(_engine); World.add(_engine.world, _mouseConstraint); }); + + Events.on(_inspector, 'import', function() { + _mouseConstraint = MouseConstraint.create(_engine); + World.add(_engine.world, _mouseConstraint); + }); + + Events.on(_inspector, 'selectStart', function() { + _mouseConstraint.constraint.render.visible = false; + }); + + Events.on(_inspector, 'selectEnd', function() { + _mouseConstraint.constraint.render.visible = true; + }); } // go fullscreen when using a mobile device diff --git a/demo/js/lib/jstree/themes/default/style.css b/demo/js/lib/jstree/themes/default/style.css index d149d6c..2e65548 100644 --- a/demo/js/lib/jstree/themes/default/style.css +++ b/demo/js/lib/jstree/themes/default/style.css @@ -807,146 +807,4 @@ } .jstree-default-large.jstree-rtl .jstree-last { background: transparent; -} -@media (max-width: 768px) { - .jstree-default-responsive { - /* - .jstree-open > .jstree-ocl, - .jstree-closed > .jstree-ocl { border-radius:20px; background-color:white; } - */ - } - .jstree-default-responsive .jstree-icon { - background-image: url("40px.png"); - } - .jstree-default-responsive .jstree-node, - .jstree-default-responsive .jstree-leaf > .jstree-ocl { - background: transparent; - } - .jstree-default-responsive .jstree-node { - min-height: 40px; - line-height: 40px; - margin-left: 40px; - min-width: 40px; - white-space: nowrap; - } - .jstree-default-responsive .jstree-anchor { - line-height: 40px; - height: 40px; - } - .jstree-default-responsive .jstree-icon, - .jstree-default-responsive .jstree-icon:empty { - width: 40px; - height: 40px; - line-height: 40px; - } - .jstree-default-responsive > .jstree-container-ul > .jstree-node { - margin-left: 0; - } - .jstree-default-responsive.jstree-rtl .jstree-node { - margin-left: 0; - margin-right: 40px; - } - .jstree-default-responsive.jstree-rtl .jstree-container-ul > .jstree-node { - margin-right: 0; - } - .jstree-default-responsive .jstree-ocl, - .jstree-default-responsive .jstree-themeicon, - .jstree-default-responsive .jstree-checkbox { - background-size: 120px 200px; - } - .jstree-default-responsive .jstree-leaf > .jstree-ocl { - background: transparent; - } - .jstree-default-responsive .jstree-open > .jstree-ocl { - background-position: 0 0px !important; - } - .jstree-default-responsive .jstree-closed > .jstree-ocl { - background-position: 0 -40px !important; - } - .jstree-default-responsive.jstree-rtl .jstree-closed > .jstree-ocl { - background-position: -40px 0px !important; - } - .jstree-default-responsive .jstree-themeicon { - background-position: -40px -40px; - } - .jstree-default-responsive .jstree-checkbox, - .jstree-default-responsive .jstree-checkbox:hover { - background-position: -40px -80px; - } - .jstree-default-responsive .jstree-clicked > .jstree-checkbox, - .jstree-default-responsive .jstree-clicked > .jstree-checkbox:hover { - background-position: 0 -80px; - } - .jstree-default-responsive .jstree-anchor > .jstree-undetermined, - .jstree-default-responsive .jstree-anchor > .jstree-undetermined:hover { - background-position: 0 -120px; - } - .jstree-default-responsive .jstree-anchor { - font-weight: bold; - font-size: 1.1em; - text-shadow: 1px 1px white; - } - .jstree-default-responsive > .jstree-striped { - background: transparent; - } - .jstree-default-responsive .jstree-wholerow { - border-top: 1px solid rgba(255, 255, 255, 0.7); - border-bottom: 1px solid rgba(64, 64, 64, 0.2); - background: #ebebeb; - height: 40px; - } - .jstree-default-responsive .jstree-wholerow-hovered { - background: #e7f4f9; - } - .jstree-default-responsive .jstree-wholerow-clicked { - background: #beebff; - } - .jstree-default-responsive .jstree-children .jstree-last > .jstree-wholerow { - box-shadow: inset 0 -6px 3px -5px #666666; - } - .jstree-default-responsive .jstree-children .jstree-open > .jstree-wholerow { - box-shadow: inset 0 6px 3px -5px #666666; - border-top: 0; - } - .jstree-default-responsive .jstree-children .jstree-open + .jstree-open { - box-shadow: none; - } - .jstree-default-responsive .jstree-node, - .jstree-default-responsive .jstree-icon, - .jstree-default-responsive .jstree-node > .jstree-ocl, - .jstree-default-responsive .jstree-themeicon, - .jstree-default-responsive .jstree-checkbox { - background-image: url("40px.png"); - background-size: 120px 200px; - } - .jstree-default-responsive .jstree-node { - background-position: -80px 0; - background-repeat: repeat-y; - } - .jstree-default-responsive .jstree-last { - background: transparent; - } - .jstree-default-responsive .jstree-leaf > .jstree-ocl { - background-position: -40px -120px; - } - .jstree-default-responsive .jstree-last > .jstree-ocl { - background-position: -40px -160px; - } - .jstree-default-responsive .jstree-themeicon-custom { - background-color: transparent; - background-image: none; - background-position: 0 0; - } - .jstree-default-responsive .jstree-file { - background: url("40px.png") 0 -160px no-repeat; - background-size: 120px 200px; - } - .jstree-default-responsive .jstree-folder { - background: url("40px.png") -40px -40px no-repeat; - background-size: 120px 200px; - } -} -.jstree-default > .jstree-container-ul > .jstree-node { - margin-left: 0; - margin-right: 0; -} +} \ No newline at end of file diff --git a/src/tools/Inspector.js b/src/tools/Inspector.js index 1263e98..297e46f 100644 --- a/src/tools/Inspector.js +++ b/src/tools/Inspector.js @@ -9,7 +9,8 @@ var Inspector = {}; (function() { - var _key; + var _key, + $body; /** * Creates a new inspector tool and inserts it into the page. Requires jQuery and jsTree. @@ -24,7 +25,9 @@ var Inspector = {}; return; } + $body = $('body'); _key = window.key || {}; + Inspector.instance = inspector; var inspector = { controls: { @@ -33,7 +36,10 @@ var Inspector = {}; }, engine: engine, isPaused: false, - selected: [] + selected: [], + selectStart: null, + selectEnd: null, + selectBounds: Bounds.create() }; if (Resurrect) { @@ -45,6 +51,7 @@ var Inspector = {}; _initControls(inspector); _initEvents(inspector); + _setPaused(inspector, true); return inspector; }; @@ -52,8 +59,38 @@ var Inspector = {}; var _initControls = function(inspector) { var engine = inspector.engine; - var $inspectorContainer = $('