mirror of
https://github.com/liabru/matter-js.git
synced 2024-12-26 13:49:01 -05:00
moved Matter.Inspector and Matter.Gui to the MatterTools project
This commit is contained in:
parent
aff85ed120
commit
a77a5fc626
19 changed files with 6283 additions and 3675 deletions
|
@ -1,511 +0,0 @@
|
||||||
/*
|
|
||||||
* Shared
|
|
||||||
*/
|
|
||||||
|
|
||||||
.ins-container,
|
|
||||||
.jstree,
|
|
||||||
body .dg .c,
|
|
||||||
body .dg .cr.function,
|
|
||||||
body .dg .c select,
|
|
||||||
body .dg .property-name,
|
|
||||||
body .dg .title {
|
|
||||||
-webkit-touch-callout: none;
|
|
||||||
-webkit-user-select: none;
|
|
||||||
-khtml-user-select: none;
|
|
||||||
-moz-user-select: none;
|
|
||||||
-ms-user-select: none;
|
|
||||||
user-select: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Matter.Gui
|
|
||||||
*/
|
|
||||||
|
|
||||||
body .dg.main {
|
|
||||||
box-shadow: 0 0 8px rgba(0,0,0,0.7);
|
|
||||||
}
|
|
||||||
|
|
||||||
@media only screen and (max-width : 1350px) {
|
|
||||||
body.gui-auto-hide .dg.ac {
|
|
||||||
right: -233px;
|
|
||||||
}
|
|
||||||
|
|
||||||
body .dg.ac:hover,
|
|
||||||
body.gui-show .dg.ac {
|
|
||||||
right: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
body.gui-auto-hide.gui-transitions .dg.ac {
|
|
||||||
-webkit-transition: all 500ms cubic-bezier(0.965, 0.025, 0.735, 0.415);
|
|
||||||
-moz-transition: all 500ms cubic-bezier(0.965, 0.025, 0.735, 0.415);
|
|
||||||
-o-transition: all 500ms cubic-bezier(0.965, 0.025, 0.735, 0.415);
|
|
||||||
transition: all 500ms cubic-bezier(0.965, 0.025, 0.735, 0.415);
|
|
||||||
|
|
||||||
-webkit-transition-timing-function: cubic-bezier(0.965, 0.025, 0.735, 0.415);
|
|
||||||
-moz-transition-timing-function: cubic-bezier(0.965, 0.025, 0.735, 0.415);
|
|
||||||
-o-transition-timing-function: cubic-bezier(0.965, 0.025, 0.735, 0.415);
|
|
||||||
transition-timing-function: cubic-bezier(0.965, 0.025, 0.735, 0.415);
|
|
||||||
|
|
||||||
transition-delay: 3s;
|
|
||||||
-webkit-transition-delay: 3s;
|
|
||||||
}
|
|
||||||
|
|
||||||
body.gui-transitions .dg.ac:hover,
|
|
||||||
body.gui-show.gui-transitions .dg.ac {
|
|
||||||
-webkit-transition: all 500ms cubic-bezier(0.095, 0.665, 0.400, 0.835);
|
|
||||||
-moz-transition: all 500ms cubic-bezier(0.095, 0.665, 0.400, 0.835);
|
|
||||||
-o-transition: all 500ms cubic-bezier(0.095, 0.665, 0.400, 0.835);
|
|
||||||
transition: all 500ms cubic-bezier(0.095, 0.665, 0.400, 0.835);
|
|
||||||
|
|
||||||
-webkit-transition-timing-function: cubic-bezier(0.095, 0.665, 0.400, 0.835);
|
|
||||||
-moz-transition-timing-function: cubic-bezier(0.095, 0.665, 0.400, 0.835);
|
|
||||||
-o-transition-timing-function: cubic-bezier(0.095, 0.665, 0.400, 0.835);
|
|
||||||
transition-timing-function: cubic-bezier(0.095, 0.665, 0.400, 0.835);
|
|
||||||
|
|
||||||
transition-delay: 0;
|
|
||||||
-webkit-transition-delay: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
body .dg.main.taller-than-window .close-button {
|
|
||||||
border-top: 1px solid #444;
|
|
||||||
border-right: 4px solid #444;
|
|
||||||
}
|
|
||||||
|
|
||||||
body .dg.main .close-button {
|
|
||||||
background-color: #444;
|
|
||||||
}
|
|
||||||
|
|
||||||
body .dg.main .close-button:hover {
|
|
||||||
background-color: #555;
|
|
||||||
}
|
|
||||||
|
|
||||||
body .dg.main::-webkit-scrollbar {
|
|
||||||
background: #3d3d3d;
|
|
||||||
width: 9px;
|
|
||||||
}
|
|
||||||
|
|
||||||
body .dg.main::-webkit-scrollbar-thumb {
|
|
||||||
background: transparent;
|
|
||||||
width: 5px;
|
|
||||||
border-left: 5px solid #3d3d3d;
|
|
||||||
border-right: 6px solid rgba(0,0,0,0.2);
|
|
||||||
border-radius: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
body .dg {
|
|
||||||
color: #aaa;
|
|
||||||
text-shadow: none !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
body .dg li:not(.folder) {
|
|
||||||
background: #3d3d3d;
|
|
||||||
border-bottom: 0px;
|
|
||||||
padding: 0 0 0 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
body .dg li.save-row .button {
|
|
||||||
text-shadow: none !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
body .dg li.title {
|
|
||||||
padding-left: 22px;
|
|
||||||
border-bottom: 1px solid #555;
|
|
||||||
background: #444 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 10px 10px no-repeat;
|
|
||||||
}
|
|
||||||
|
|
||||||
body .dg .cr.boolean:hover {
|
|
||||||
background: #3d3d3d;
|
|
||||||
}
|
|
||||||
|
|
||||||
body .dg .cr.function {
|
|
||||||
border-top: 1px solid #444;
|
|
||||||
background: #333;
|
|
||||||
color: #aaa;
|
|
||||||
border-bottom: 1px solid #333;
|
|
||||||
}
|
|
||||||
|
|
||||||
body .dg .cr.function:hover {
|
|
||||||
background: #3a3a3a;
|
|
||||||
border-bottom: 1px solid #2fa1d6;
|
|
||||||
}
|
|
||||||
|
|
||||||
body .dg .cr.function:active {
|
|
||||||
border-top: 2px solid #444;
|
|
||||||
border-bottom: 0;
|
|
||||||
background: #2e2e2e;
|
|
||||||
}
|
|
||||||
|
|
||||||
body .dg .c select {
|
|
||||||
margin-top: 2px;
|
|
||||||
margin-left: -5px;
|
|
||||||
padding: 3px 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
body .dg .c select,
|
|
||||||
body .dg .c input[type=text],
|
|
||||||
body .dg .cr.number input[type=text] {
|
|
||||||
background: #333;
|
|
||||||
color: #999;
|
|
||||||
border: 0;
|
|
||||||
font-size: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
body .dg .c select,
|
|
||||||
body .dg .c select:focus {
|
|
||||||
width: 88px;
|
|
||||||
outline: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
body .dg .c input[type=text]:hover {
|
|
||||||
background: #444;
|
|
||||||
}
|
|
||||||
|
|
||||||
body .dg .c input[type=text]:focus {
|
|
||||||
background: #444;
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
body .dg .c .slider {
|
|
||||||
background: #555;
|
|
||||||
}
|
|
||||||
|
|
||||||
body .dg .c .slider:hover {
|
|
||||||
background: #666;
|
|
||||||
}
|
|
||||||
|
|
||||||
body .dg .c .slider-fg {
|
|
||||||
background: #777;
|
|
||||||
}
|
|
||||||
|
|
||||||
body .dg .c .slider:hover .slider-fg {
|
|
||||||
background: #999;
|
|
||||||
}
|
|
||||||
|
|
||||||
body .dg li.folder {
|
|
||||||
border-left: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
body .dg.a {
|
|
||||||
border-right:4px solid #3d3d3d;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Matter.Inspector
|
|
||||||
*/
|
|
||||||
|
|
||||||
.ins-cursor-move canvas {
|
|
||||||
cursor: move !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ins-cursor-rotate canvas {
|
|
||||||
cursor: ew-resize !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ins-cursor-scale canvas {
|
|
||||||
cursor: nwse-resize !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ins-container {
|
|
||||||
position: fixed;
|
|
||||||
overflow: auto;
|
|
||||||
width: 260px;
|
|
||||||
bottom: 0;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
background: #3d3d3d;
|
|
||||||
padding: 0;
|
|
||||||
font-family: Arial;
|
|
||||||
font-size: 12px;
|
|
||||||
color: #aaa;
|
|
||||||
border-right: 2px solid #3d3d3d;
|
|
||||||
box-shadow: 0 0 8px rgba(0,0,0,0.7);
|
|
||||||
}
|
|
||||||
|
|
||||||
@media only screen and (max-width : 1350px) {
|
|
||||||
.ins-auto-hide .ins-container {
|
|
||||||
left: -245px;
|
|
||||||
border-right: 1px dotted #888;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ins-container:hover,
|
|
||||||
.ins-show .ins-container {
|
|
||||||
left: 0px;
|
|
||||||
border-right: 0px dotted #888;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ins-transitions .ins-container {
|
|
||||||
-webkit-transition: all 500ms cubic-bezier(0.965, 0.025, 0.735, 0.415);
|
|
||||||
-moz-transition: all 500ms cubic-bezier(0.965, 0.025, 0.735, 0.415);
|
|
||||||
-o-transition: all 500ms cubic-bezier(0.965, 0.025, 0.735, 0.415);
|
|
||||||
transition: all 500ms cubic-bezier(0.965, 0.025, 0.735, 0.415);
|
|
||||||
|
|
||||||
-webkit-transition-timing-function: cubic-bezier(0.965, 0.025, 0.735, 0.415);
|
|
||||||
-moz-transition-timing-function: cubic-bezier(0.965, 0.025, 0.735, 0.415);
|
|
||||||
-o-transition-timing-function: cubic-bezier(0.965, 0.025, 0.735, 0.415);
|
|
||||||
transition-timing-function: cubic-bezier(0.965, 0.025, 0.735, 0.415);
|
|
||||||
|
|
||||||
transition-delay: 3s;
|
|
||||||
-webkit-transition-delay: 3s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ins-transitions .ins-container:hover,
|
|
||||||
.ins-transitions.ins-show .ins-container {
|
|
||||||
-webkit-transition: all 500ms cubic-bezier(0.095, 0.665, 0.400, 0.835);
|
|
||||||
-moz-transition: all 500ms cubic-bezier(0.095, 0.665, 0.400, 0.835);
|
|
||||||
-o-transition: all 500ms cubic-bezier(0.095, 0.665, 0.400, 0.835);
|
|
||||||
transition: all 500ms cubic-bezier(0.095, 0.665, 0.400, 0.835);
|
|
||||||
|
|
||||||
-webkit-transition-timing-function: cubic-bezier(0.095, 0.665, 0.400, 0.835);
|
|
||||||
-moz-transition-timing-function: cubic-bezier(0.095, 0.665, 0.400, 0.835);
|
|
||||||
-o-transition-timing-function: cubic-bezier(0.095, 0.665, 0.400, 0.835);
|
|
||||||
transition-timing-function: cubic-bezier(0.095, 0.665, 0.400, 0.835);
|
|
||||||
|
|
||||||
transition-delay: 0;
|
|
||||||
-webkit-transition-delay: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.ins-add-button.ins-button {
|
|
||||||
float: right;
|
|
||||||
width: auto;
|
|
||||||
height: auto;
|
|
||||||
padding: 2px 5px;
|
|
||||||
margin: 2px 29px;
|
|
||||||
min-width: 0;
|
|
||||||
position: relative;
|
|
||||||
z-index: 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ins-search-box {
|
|
||||||
margin: 14px 23px;
|
|
||||||
border: 0;
|
|
||||||
padding: 7px 8px;
|
|
||||||
font-size: 12px;
|
|
||||||
width: 80%;
|
|
||||||
box-sizing: border-box;
|
|
||||||
border-radius: 3px;
|
|
||||||
background: #444;
|
|
||||||
border: 1px solid #444;
|
|
||||||
color: #999;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ins-search-box:focus {
|
|
||||||
background: #484848;
|
|
||||||
color: #aaa;
|
|
||||||
border: 1px solid rgba(255,255,255,0.1);
|
|
||||||
outline: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ins-search-box::-webkit-search-cancel-button {
|
|
||||||
-webkit-appearance: none;
|
|
||||||
height: 15px;
|
|
||||||
width: 8px;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ins-search-box::-webkit-search-cancel-button:before {
|
|
||||||
height: 10px;
|
|
||||||
width: 10px;
|
|
||||||
content: 'x';
|
|
||||||
font-family: Arial;
|
|
||||||
line-height: 0;
|
|
||||||
font-size: 13px;
|
|
||||||
color: #999;
|
|
||||||
font-weight: bold;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ins-search-box::-webkit-input-placeholder {
|
|
||||||
color: #777;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ins-search-box:-moz-placeholder {
|
|
||||||
color: #777;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ins-search-box::-moz-placeholder {
|
|
||||||
color: #777;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ins-search-box:-ms-input-placeholder {
|
|
||||||
color: #777;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ins-world-tree {
|
|
||||||
overflow: auto;
|
|
||||||
position: absolute;
|
|
||||||
left: -24px;
|
|
||||||
right: 0px;
|
|
||||||
top: 110px;
|
|
||||||
bottom: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ins-control-group {
|
|
||||||
display: block;
|
|
||||||
clear: both;
|
|
||||||
overflow: hidden;
|
|
||||||
padding: 14px 20px 12px 20px;
|
|
||||||
background: #444;
|
|
||||||
border-bottom: 1px solid #555;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ins-button {
|
|
||||||
display: block;
|
|
||||||
float: left;
|
|
||||||
margin: 0 2px;
|
|
||||||
font-size: 11px;
|
|
||||||
line-height: 1;
|
|
||||||
padding: 6px 8px;
|
|
||||||
min-width: 49px;
|
|
||||||
text-align: center;
|
|
||||||
background: #333;
|
|
||||||
border: 0;
|
|
||||||
color: #aaa;
|
|
||||||
border-radius: 2px;
|
|
||||||
border-bottom: 2px solid #2e2e2e;
|
|
||||||
box-sizing: border-box;
|
|
||||||
outline: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ins-button:hover {
|
|
||||||
background: #3a3a3a;
|
|
||||||
border-bottom: 2px solid #2fa1d6;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ins-button:active {
|
|
||||||
border-top: 2px solid #444;
|
|
||||||
border-bottom: 0;
|
|
||||||
background: #2e2e2e;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jstree-default .jstree-search {
|
|
||||||
font-style: italic;
|
|
||||||
color: #aaa;
|
|
||||||
font-weight: normal;
|
|
||||||
}
|
|
||||||
|
|
||||||
.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: transparent;
|
|
||||||
border-radius: 0;
|
|
||||||
box-shadow: none;
|
|
||||||
transition: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jstree-default .jstree-leaf .jstree-clicked {
|
|
||||||
color: #bbb !important;
|
|
||||||
|
|
||||||
-webkit-transition: color 100ms linear;
|
|
||||||
-moz-transition: color 100ms linear;
|
|
||||||
-o-transition: color 100ms linear;
|
|
||||||
transition: color 100ms linear;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jstree-default .jstree-container-ul> .jstree-node > .jstree-anchor:before,
|
|
||||||
.jstree-default .jstree-open > .jstree-children > .jstree-node > .jstree-anchor:before {
|
|
||||||
content: '';
|
|
||||||
display: block;
|
|
||||||
position: absolute;
|
|
||||||
left: 0;
|
|
||||||
right: 1px;
|
|
||||||
height: 26px;
|
|
||||||
background: transparent;
|
|
||||||
border-radius: 0;
|
|
||||||
box-shadow: none;
|
|
||||||
border-right: none;
|
|
||||||
pointer-events: none;
|
|
||||||
background: rgba(0,0,0,0);
|
|
||||||
|
|
||||||
-webkit-transition: background 100ms linear;
|
|
||||||
-moz-transition: background 100ms linear;
|
|
||||||
-o-transition: background 100ms linear;
|
|
||||||
transition: background 100ms linear;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jstree-default .jstree-anchor.jstree-clicked:before {
|
|
||||||
background: rgba(0,0,0,0.1) !important;
|
|
||||||
|
|
||||||
-webkit-transition: background 100ms linear;
|
|
||||||
-moz-transition: background 100ms linear;
|
|
||||||
-o-transition: background 100ms linear;
|
|
||||||
transition: background 100ms linear;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jstree-default .jstree-node-type-body > .jstree-anchor:before {
|
|
||||||
border-right: 3px solid #e1115f !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jstree-default .jstree-node-type-constraint > .jstree-anchor:before {
|
|
||||||
border-right: 3px solid #1ed36f !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jstree-default .jstree-node-type-composite > .jstree-anchor:before {
|
|
||||||
border-right: 3px solid #2fa1d6 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.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: 10px;
|
|
||||||
height: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ins-container *::-webkit-scrollbar-thumb:vertical {
|
|
||||||
border-left: 3px solid #3d3d3d;
|
|
||||||
background: rgba(0,0,0,0.2);
|
|
||||||
width: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ins-container *::-webkit-scrollbar-thumb:horizontal {
|
|
||||||
border-top: 3px solid #3d3d3d;
|
|
||||||
background: rgba(0,0,0,0.2);
|
|
||||||
height: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ins-container *::-webkit-scrollbar-track,
|
|
||||||
.ins-container *::-webkit-scrollbar-corner {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
#vakata-dnd {
|
|
||||||
font-family: Arial;
|
|
||||||
font-size: 12px;
|
|
||||||
color: #aaa;
|
|
||||||
}
|
|
|
@ -39,7 +39,7 @@ h1 {
|
||||||
.container {
|
.container {
|
||||||
max-width: 800px;
|
max-width: 800px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
padding: 64px 280px 0 280px;
|
padding: 48px 280px 0 32px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ins-auto-hide .container {
|
.ins-auto-hide .container {
|
||||||
|
|
|
@ -6,25 +6,21 @@
|
||||||
<meta name="viewport" content="width=device-width,minimal-ui">
|
<meta name="viewport" content="width=device-width,minimal-ui">
|
||||||
<meta name="robots" content="noindex">
|
<meta name="robots" content="noindex">
|
||||||
|
|
||||||
<!-- only required if using Matter.Gui -->
|
|
||||||
<script type="text/javascript" src="./js/lib/dat.gui.min.js"></script>
|
|
||||||
<script type="text/javascript" src="./js/lib/resurrect.js"></script>
|
|
||||||
|
|
||||||
<!-- only required if using Matter.Inspector -->
|
|
||||||
<link rel="stylesheet" href="./js/lib/jstree/themes/default/style.css" type="text/css">
|
|
||||||
<link rel="stylesheet" href="./css/matter-tools.css" type="text/css">
|
|
||||||
<script type="text/javascript" src="./js/lib/jquery-1.11.0.min.js"></script>
|
|
||||||
<script type="text/javascript" src="./js/lib/jstree/jstree.min.js"></script>
|
|
||||||
<script type="text/javascript" src="./js/lib/keymaster.js"></script>
|
|
||||||
|
|
||||||
<!-- only required if using Matter.RenderPixi -->
|
<!-- only required if using Matter.RenderPixi -->
|
||||||
<script type="text/javascript" src="./js/lib/pixi.dev.js"></script>
|
<script type="text/javascript" src="./js/lib/pixi.dev.js"></script>
|
||||||
|
|
||||||
<!-- matter.js demo code -->
|
<!-- matter lib edge master version -->
|
||||||
<script type="text/javascript" src="./js/lib/matter-dev.js"></script>
|
<script type="text/javascript" src="./js/lib/matter-dev.js"></script>
|
||||||
|
|
||||||
|
<!-- only required if using MatterTools -->
|
||||||
|
<link rel="stylesheet" href="./js/lib/matter-tools/matter-tools.css" type="text/css">
|
||||||
|
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
|
||||||
|
<script type="text/javascript" src="./js/lib/matter-tools/matter-tools-dev.js"></script>
|
||||||
|
|
||||||
|
<!-- matter demo code -->
|
||||||
|
<link rel="stylesheet" href="./css/style.css" type="text/css">
|
||||||
<script type="text/javascript" src="./js/Demo.js"></script>
|
<script type="text/javascript" src="./js/Demo.js"></script>
|
||||||
|
|
||||||
<link rel="stylesheet" href="./css/style.css" type="text/css">
|
|
||||||
<title>Matter.js Demo (Dev. Build)</title>
|
<title>Matter.js Demo (Dev. Build)</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -5,12 +5,22 @@
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
<meta name="viewport" content="width=device-width">
|
<meta name="viewport" content="width=device-width">
|
||||||
<meta name="robots" content="noindex">
|
<meta name="robots" content="noindex">
|
||||||
|
|
||||||
|
<!-- only required if using Matter.RenderPixi -->
|
||||||
<script type="text/javascript" src="./js/lib/pixi.dev.js"></script>
|
<script type="text/javascript" src="./js/lib/pixi.dev.js"></script>
|
||||||
<script type="text/javascript" src="./js/lib/dat.gui.min.js"></script>
|
|
||||||
<script type="text/javascript" src="./js/lib/resurrect.js"></script>
|
<!-- matter lib v0.7.0 -->
|
||||||
<script type="text/javascript" src="./js/lib/matter-0.7.0.js"></script>
|
<script type="text/javascript" src="./js/lib/matter-0.7.0.js"></script>
|
||||||
<script type="text/javascript" src="./js/Demo.js"></script>
|
|
||||||
|
<!-- only required if using MatterTools -->
|
||||||
|
<link rel="stylesheet" href="./js/lib/matter-tools/matter-tools.css" type="text/css">
|
||||||
|
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
|
||||||
|
<script type="text/javascript" src="./js/lib/matter-tools/matter-tools-dev.js"></script>
|
||||||
|
|
||||||
|
<!-- matter demo code -->
|
||||||
<link rel="stylesheet" href="./css/style.css" type="text/css">
|
<link rel="stylesheet" href="./css/style.css" type="text/css">
|
||||||
|
<script type="text/javascript" src="./js/Demo.js"></script>
|
||||||
|
|
||||||
<title>Matter.js Physics Engine Demo</title>
|
<title>Matter.js Physics Engine Demo</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
// Matter aliases
|
// Matter aliases
|
||||||
var Engine = Matter.Engine,
|
var Engine = Matter.Engine,
|
||||||
Gui = Matter.Gui,
|
|
||||||
World = Matter.World,
|
World = Matter.World,
|
||||||
Bodies = Matter.Bodies,
|
Bodies = Matter.Bodies,
|
||||||
Body = Matter.Body,
|
Body = Matter.Body,
|
||||||
|
@ -16,8 +15,11 @@
|
||||||
Vector = Matter.Vector,
|
Vector = Matter.Vector,
|
||||||
Vertices = Matter.Vertices,
|
Vertices = Matter.Vertices,
|
||||||
MouseConstraint = Matter.MouseConstraint,
|
MouseConstraint = Matter.MouseConstraint,
|
||||||
Query = Matter.Query,
|
Query = Matter.Query;
|
||||||
Inspector = Matter.Inspector;
|
|
||||||
|
// MatterTools aliases
|
||||||
|
var Gui = MatterTools.Gui,
|
||||||
|
Inspector = MatterTools.Inspector;
|
||||||
|
|
||||||
var Demo = {};
|
var Demo = {};
|
||||||
|
|
||||||
|
@ -27,6 +29,7 @@
|
||||||
_sceneName,
|
_sceneName,
|
||||||
_mouseConstraint,
|
_mouseConstraint,
|
||||||
_sceneEvents = [],
|
_sceneEvents = [],
|
||||||
|
_useInspector = false,
|
||||||
_isMobile = /(ipad|iphone|ipod|android)/gi.test(navigator.userAgent);
|
_isMobile = /(ipad|iphone|ipod|android)/gi.test(navigator.userAgent);
|
||||||
|
|
||||||
// initialise the demo
|
// initialise the demo
|
||||||
|
@ -930,7 +933,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// create a Matter.Inspector
|
// create a Matter.Inspector
|
||||||
if (!_isMobile && Inspector) {
|
if (!_isMobile && Inspector && _useInspector) {
|
||||||
_inspector = Inspector.create(_engine);
|
_inspector = Inspector.create(_engine);
|
||||||
|
|
||||||
Events.on(_inspector, 'import', function() {
|
Events.on(_inspector, 'import', function() {
|
||||||
|
@ -1024,8 +1027,10 @@
|
||||||
Common._nextId = 0;
|
Common._nextId = 0;
|
||||||
|
|
||||||
// reset mouse offset
|
// reset mouse offset
|
||||||
|
if (_engine.input.mouse.offset) {
|
||||||
_engine.input.mouse.offset.x = 0;
|
_engine.input.mouse.offset.x = 0;
|
||||||
_engine.input.mouse.offset.y = 0;
|
_engine.input.mouse.offset.y = 0;
|
||||||
|
}
|
||||||
|
|
||||||
_engine.enableSleeping = false;
|
_engine.enableSleeping = false;
|
||||||
_engine.world.gravity.y = 1;
|
_engine.world.gravity.y = 1;
|
||||||
|
|
94
demo/js/lib/dat.gui.min.js
vendored
94
demo/js/lib/dat.gui.min.js
vendored
File diff suppressed because one or more lines are too long
4
demo/js/lib/jquery-1.11.0.min.js
vendored
4
demo/js/lib/jquery-1.11.0.min.js
vendored
File diff suppressed because one or more lines are too long
4
demo/js/lib/jstree/jstree.min.js
vendored
4
demo/js/lib/jstree/jstree.min.js
vendored
File diff suppressed because one or more lines are too long
Binary file not shown.
Before Width: | Height: | Size: 1.4 KiB |
|
@ -1,810 +0,0 @@
|
||||||
/* jsTree default theme */
|
|
||||||
.jstree-node,
|
|
||||||
.jstree-children,
|
|
||||||
.jstree-container-ul {
|
|
||||||
display: block;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
list-style-type: none;
|
|
||||||
list-style-image: none;
|
|
||||||
}
|
|
||||||
.jstree-node {
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
.jstree-anchor {
|
|
||||||
display: inline-block;
|
|
||||||
color: black;
|
|
||||||
white-space: nowrap;
|
|
||||||
padding: 0 4px 0 1px;
|
|
||||||
margin: 0;
|
|
||||||
vertical-align: top;
|
|
||||||
}
|
|
||||||
.jstree-anchor:focus {
|
|
||||||
outline: 0;
|
|
||||||
}
|
|
||||||
.jstree-anchor,
|
|
||||||
.jstree-anchor:link,
|
|
||||||
.jstree-anchor:visited,
|
|
||||||
.jstree-anchor:hover,
|
|
||||||
.jstree-anchor:active {
|
|
||||||
text-decoration: none;
|
|
||||||
color: inherit;
|
|
||||||
}
|
|
||||||
.jstree-icon {
|
|
||||||
display: inline-block;
|
|
||||||
text-decoration: none;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
vertical-align: top;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
.jstree-icon:empty {
|
|
||||||
display: inline-block;
|
|
||||||
text-decoration: none;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
vertical-align: top;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
.jstree-ocl {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
.jstree-leaf > .jstree-ocl {
|
|
||||||
cursor: default;
|
|
||||||
}
|
|
||||||
.jstree .jstree-open > .jstree-children {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
.jstree .jstree-closed > .jstree-children,
|
|
||||||
.jstree .jstree-leaf > .jstree-children {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.jstree-anchor > .jstree-themeicon {
|
|
||||||
margin-right: 2px;
|
|
||||||
}
|
|
||||||
.jstree-no-icons .jstree-themeicon,
|
|
||||||
.jstree-anchor > .jstree-themeicon-hidden {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.jstree-rtl .jstree-anchor {
|
|
||||||
padding: 0 1px 0 4px;
|
|
||||||
}
|
|
||||||
.jstree-rtl .jstree-anchor > .jstree-themeicon {
|
|
||||||
margin-left: 2px;
|
|
||||||
margin-right: 0;
|
|
||||||
}
|
|
||||||
.jstree-rtl .jstree-node {
|
|
||||||
margin-left: 0;
|
|
||||||
}
|
|
||||||
.jstree-rtl .jstree-container-ul > .jstree-node {
|
|
||||||
margin-right: 0;
|
|
||||||
}
|
|
||||||
.jstree-wholerow-ul {
|
|
||||||
position: relative;
|
|
||||||
display: inline-block;
|
|
||||||
min-width: 100%;
|
|
||||||
}
|
|
||||||
.jstree-wholerow-ul .jstree-leaf > .jstree-ocl {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
.jstree-wholerow-ul .jstree-anchor,
|
|
||||||
.jstree-wholerow-ul .jstree-icon {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
.jstree-wholerow-ul .jstree-wholerow {
|
|
||||||
width: 100%;
|
|
||||||
cursor: pointer;
|
|
||||||
position: absolute;
|
|
||||||
left: 0;
|
|
||||||
-webkit-user-select: none;
|
|
||||||
-moz-user-select: none;
|
|
||||||
-ms-user-select: none;
|
|
||||||
user-select: none;
|
|
||||||
}
|
|
||||||
.vakata-context {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.vakata-context,
|
|
||||||
.vakata-context ul {
|
|
||||||
margin: 0;
|
|
||||||
padding: 2px;
|
|
||||||
position: absolute;
|
|
||||||
background: #f5f5f5;
|
|
||||||
border: 1px solid #979797;
|
|
||||||
-moz-box-shadow: 5px 5px 4px -4px #666666;
|
|
||||||
-webkit-box-shadow: 2px 2px 2px #999999;
|
|
||||||
box-shadow: 2px 2px 2px #999999;
|
|
||||||
}
|
|
||||||
.vakata-context ul {
|
|
||||||
list-style: none;
|
|
||||||
left: 100%;
|
|
||||||
margin-top: -2.7em;
|
|
||||||
margin-left: -4px;
|
|
||||||
}
|
|
||||||
.vakata-context .vakata-context-right ul {
|
|
||||||
left: auto;
|
|
||||||
right: 100%;
|
|
||||||
margin-left: auto;
|
|
||||||
margin-right: -4px;
|
|
||||||
}
|
|
||||||
.vakata-context li {
|
|
||||||
list-style: none;
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
.vakata-context li > a {
|
|
||||||
display: block;
|
|
||||||
padding: 0 2em 0 2em;
|
|
||||||
text-decoration: none;
|
|
||||||
width: auto;
|
|
||||||
color: black;
|
|
||||||
white-space: nowrap;
|
|
||||||
line-height: 2.4em;
|
|
||||||
-moz-text-shadow: 1px 1px 0 white;
|
|
||||||
-webkit-text-shadow: 1px 1px 0 white;
|
|
||||||
text-shadow: 1px 1px 0 white;
|
|
||||||
-moz-border-radius: 1px;
|
|
||||||
-webkit-border-radius: 1px;
|
|
||||||
border-radius: 1px;
|
|
||||||
}
|
|
||||||
.vakata-context li > a:hover {
|
|
||||||
position: relative;
|
|
||||||
background-color: #e8eff7;
|
|
||||||
-moz-box-shadow: 0 0 2px #0a6aa1;
|
|
||||||
-webkit-box-shadow: 0 0 2px #0a6aa1;
|
|
||||||
box-shadow: 0 0 2px #0a6aa1;
|
|
||||||
}
|
|
||||||
.vakata-context li > a.vakata-context-parent {
|
|
||||||
background-image: url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAIORI4JlrqN1oMSnmmZDQUAOw==");
|
|
||||||
background-position: right center;
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
}
|
|
||||||
.vakata-context li > a:focus {
|
|
||||||
outline: 0;
|
|
||||||
}
|
|
||||||
.vakata-context .vakata-context-hover > a {
|
|
||||||
position: relative;
|
|
||||||
background-color: #e8eff7;
|
|
||||||
-moz-box-shadow: 0 0 2px #0a6aa1;
|
|
||||||
-webkit-box-shadow: 0 0 2px #0a6aa1;
|
|
||||||
box-shadow: 0 0 2px #0a6aa1;
|
|
||||||
}
|
|
||||||
.vakata-context .vakata-context-separator a,
|
|
||||||
.vakata-context .vakata-context-separator a:hover {
|
|
||||||
background: white;
|
|
||||||
border: 0;
|
|
||||||
border-top: 1px solid #e2e3e3;
|
|
||||||
height: 1px;
|
|
||||||
min-height: 1px;
|
|
||||||
max-height: 1px;
|
|
||||||
padding: 0;
|
|
||||||
margin: 0 0 0 2.4em;
|
|
||||||
border-left: 1px solid #e0e0e0;
|
|
||||||
-moz-text-shadow: 0 0 0 transparent;
|
|
||||||
-webkit-text-shadow: 0 0 0 transparent;
|
|
||||||
text-shadow: 0 0 0 transparent;
|
|
||||||
-moz-box-shadow: 0 0 0 transparent;
|
|
||||||
-webkit-box-shadow: 0 0 0 transparent;
|
|
||||||
box-shadow: 0 0 0 transparent;
|
|
||||||
-moz-border-radius: 0;
|
|
||||||
-webkit-border-radius: 0;
|
|
||||||
border-radius: 0;
|
|
||||||
}
|
|
||||||
.vakata-context .vakata-contextmenu-disabled a,
|
|
||||||
.vakata-context .vakata-contextmenu-disabled a:hover {
|
|
||||||
color: silver;
|
|
||||||
background-color: transparent;
|
|
||||||
border: 0;
|
|
||||||
box-shadow: 0 0 0;
|
|
||||||
}
|
|
||||||
.vakata-context li > a > i {
|
|
||||||
text-decoration: none;
|
|
||||||
display: inline-block;
|
|
||||||
width: 2.4em;
|
|
||||||
height: 2.4em;
|
|
||||||
background: transparent;
|
|
||||||
margin: 0 0 0 -2em;
|
|
||||||
vertical-align: top;
|
|
||||||
text-align: center;
|
|
||||||
line-height: 2.4em;
|
|
||||||
}
|
|
||||||
.vakata-context li > a > i:empty {
|
|
||||||
width: 2.4em;
|
|
||||||
line-height: 2.4em;
|
|
||||||
}
|
|
||||||
.vakata-context li > a .vakata-contextmenu-sep {
|
|
||||||
display: inline-block;
|
|
||||||
width: 1px;
|
|
||||||
height: 2.4em;
|
|
||||||
background: white;
|
|
||||||
margin: 0 0.5em 0 0;
|
|
||||||
border-left: 1px solid #e2e3e3;
|
|
||||||
}
|
|
||||||
.vakata-context .vakata-contextmenu-shortcut {
|
|
||||||
font-size: 0.8em;
|
|
||||||
color: silver;
|
|
||||||
opacity: 0.5;
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.vakata-context-rtl ul {
|
|
||||||
left: auto;
|
|
||||||
right: 100%;
|
|
||||||
margin-left: auto;
|
|
||||||
margin-right: -4px;
|
|
||||||
}
|
|
||||||
.vakata-context-rtl li > a.vakata-context-parent {
|
|
||||||
background-image: url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAINjI+AC7rWHIsPtmoxLAA7");
|
|
||||||
background-position: left center;
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
}
|
|
||||||
.vakata-context-rtl .vakata-context-separator > a {
|
|
||||||
margin: 0 2.4em 0 0;
|
|
||||||
border-left: 0;
|
|
||||||
border-right: 1px solid #e2e3e3;
|
|
||||||
}
|
|
||||||
.vakata-context-rtl .vakata-context-left ul {
|
|
||||||
right: auto;
|
|
||||||
left: 100%;
|
|
||||||
margin-left: -4px;
|
|
||||||
margin-right: auto;
|
|
||||||
}
|
|
||||||
.vakata-context-rtl li > a > i {
|
|
||||||
margin: 0 -2em 0 0;
|
|
||||||
}
|
|
||||||
.vakata-context-rtl li > a .vakata-contextmenu-sep {
|
|
||||||
margin: 0 0 0 0.5em;
|
|
||||||
border-left-color: white;
|
|
||||||
background: #e2e3e3;
|
|
||||||
}
|
|
||||||
#jstree-marker {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
border-right: 0;
|
|
||||||
border-top: 5px solid transparent;
|
|
||||||
border-bottom: 5px solid transparent;
|
|
||||||
border-left: 5px solid;
|
|
||||||
width: 0;
|
|
||||||
height: 0;
|
|
||||||
font-size: 0;
|
|
||||||
line-height: 0;
|
|
||||||
}
|
|
||||||
#jstree-dnd {
|
|
||||||
line-height: 16px;
|
|
||||||
margin: 0;
|
|
||||||
padding: 4px;
|
|
||||||
}
|
|
||||||
#jstree-dnd .jstree-icon,
|
|
||||||
#jstree-dnd .jstree-copy {
|
|
||||||
display: inline-block;
|
|
||||||
text-decoration: none;
|
|
||||||
margin: 0 2px 0 0;
|
|
||||||
padding: 0;
|
|
||||||
width: 16px;
|
|
||||||
height: 16px;
|
|
||||||
}
|
|
||||||
#jstree-dnd .jstree-ok {
|
|
||||||
background: green;
|
|
||||||
}
|
|
||||||
#jstree-dnd .jstree-er {
|
|
||||||
background: red;
|
|
||||||
}
|
|
||||||
#jstree-dnd .jstree-copy {
|
|
||||||
margin: 0 2px 0 2px;
|
|
||||||
}
|
|
||||||
.jstree-default .jstree-node,
|
|
||||||
.jstree-default .jstree-icon {
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-color: transparent;
|
|
||||||
}
|
|
||||||
.jstree-default .jstree-anchor,
|
|
||||||
.jstree-default .jstree-wholerow {
|
|
||||||
transition: background-color 0.15s, box-shadow 0.15s;
|
|
||||||
}
|
|
||||||
.jstree-default .jstree-hovered {
|
|
||||||
background: #e7f4f9;
|
|
||||||
border-radius: 2px;
|
|
||||||
box-shadow: inset 0 0 1px #ccc;
|
|
||||||
}
|
|
||||||
.jstree-default .jstree-clicked {
|
|
||||||
background: #beebff;
|
|
||||||
border-radius: 2px;
|
|
||||||
box-shadow: inset 0 0 1px #999;
|
|
||||||
}
|
|
||||||
.jstree-default .jstree-no-icons .jstree-anchor > .jstree-themeicon {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.jstree-default .jstree-disabled {
|
|
||||||
background: transparent;
|
|
||||||
color: #666;
|
|
||||||
}
|
|
||||||
.jstree-default .jstree-disabled.jstree-hovered {
|
|
||||||
background: transparent;
|
|
||||||
box-shadow: none;
|
|
||||||
}
|
|
||||||
.jstree-default .jstree-disabled.jstree-clicked {
|
|
||||||
background: #efefef;
|
|
||||||
}
|
|
||||||
.jstree-default .jstree-disabled > .jstree-icon {
|
|
||||||
opacity: 0.8;
|
|
||||||
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'jstree-grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#jstree-grayscale");
|
|
||||||
/* Firefox 10+ */
|
|
||||||
filter: gray;
|
|
||||||
/* IE6-9 */
|
|
||||||
-webkit-filter: grayscale(100%);
|
|
||||||
/* Chrome 19+ & Safari 6+ */
|
|
||||||
}
|
|
||||||
.jstree-default .jstree-search {
|
|
||||||
font-style: italic;
|
|
||||||
color: #8b0000;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
.jstree-default .jstree-no-checkboxes .jstree-checkbox {
|
|
||||||
display: none !important;
|
|
||||||
}
|
|
||||||
.jstree-default.jstree-checkbox-no-clicked .jstree-clicked {
|
|
||||||
background: transparent;
|
|
||||||
box-shadow: none;
|
|
||||||
}
|
|
||||||
.jstree-default.jstree-checkbox-no-clicked .jstree-clicked.jstree-hovered {
|
|
||||||
background: #e7f4f9;
|
|
||||||
}
|
|
||||||
.jstree-default.jstree-checkbox-no-clicked > .jstree-wholerow-ul .jstree-wholerow-clicked {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
.jstree-default.jstree-checkbox-no-clicked > .jstree-wholerow-ul .jstree-wholerow-clicked.jstree-wholerow-hovered {
|
|
||||||
background: #e7f4f9;
|
|
||||||
}
|
|
||||||
#jstree-dnd.jstree-default .jstree-ok,
|
|
||||||
#jstree-dnd.jstree-default .jstree-er {
|
|
||||||
background-image: url("32px.png");
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-color: transparent;
|
|
||||||
}
|
|
||||||
#jstree-dnd.jstree-default i {
|
|
||||||
background: transparent;
|
|
||||||
width: 16px;
|
|
||||||
height: 16px;
|
|
||||||
}
|
|
||||||
#jstree-dnd.jstree-default .jstree-ok {
|
|
||||||
background-position: -9px -71px;
|
|
||||||
}
|
|
||||||
#jstree-dnd.jstree-default .jstree-er {
|
|
||||||
background-position: -39px -71px;
|
|
||||||
}
|
|
||||||
.jstree-default > .jstree-striped {
|
|
||||||
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAkCAMAAAB/qqA+AAAABlBMVEUAAAAAAAClZ7nPAAAAAnRSTlMNAMM9s3UAAAAXSURBVHjajcEBAQAAAIKg/H/aCQZ70AUBjAATb6YPDgAAAABJRU5ErkJggg==") left top repeat;
|
|
||||||
}
|
|
||||||
.jstree-default > .jstree-wholerow-ul .jstree-hovered,
|
|
||||||
.jstree-default > .jstree-wholerow-ul .jstree-clicked {
|
|
||||||
background: transparent;
|
|
||||||
box-shadow: none;
|
|
||||||
border-radius: 0;
|
|
||||||
}
|
|
||||||
.jstree-default .jstree-wholerow {
|
|
||||||
-moz-box-sizing: border-box;
|
|
||||||
-webkit-box-sizing: border-box;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
.jstree-default .jstree-wholerow-hovered {
|
|
||||||
background: #e7f4f9;
|
|
||||||
}
|
|
||||||
.jstree-default .jstree-wholerow-clicked {
|
|
||||||
background: #beebff;
|
|
||||||
background: -moz-linear-gradient(top, #beebff 0%, #a8e4ff 100%);
|
|
||||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #beebff), color-stop(100%, #a8e4ff));
|
|
||||||
background: -webkit-linear-gradient(top, #beebff 0%, #a8e4ff 100%);
|
|
||||||
background: -o-linear-gradient(top, #beebff 0%, #a8e4ff 100%);
|
|
||||||
background: -ms-linear-gradient(top, #beebff 0%, #a8e4ff 100%);
|
|
||||||
background: linear-gradient(to bottom, #beebff 0%, #a8e4ff 100%);
|
|
||||||
/*filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='@color1', endColorstr='@color2',GradientType=0 );*/
|
|
||||||
}
|
|
||||||
.jstree-default .jstree-node {
|
|
||||||
min-height: 24px;
|
|
||||||
line-height: 24px;
|
|
||||||
margin-left: 24px;
|
|
||||||
min-width: 24px;
|
|
||||||
}
|
|
||||||
.jstree-default .jstree-anchor {
|
|
||||||
line-height: 24px;
|
|
||||||
height: 24px;
|
|
||||||
}
|
|
||||||
.jstree-default .jstree-icon {
|
|
||||||
width: 24px;
|
|
||||||
height: 24px;
|
|
||||||
line-height: 24px;
|
|
||||||
}
|
|
||||||
.jstree-default .jstree-icon:empty {
|
|
||||||
width: 24px;
|
|
||||||
height: 24px;
|
|
||||||
line-height: 24px;
|
|
||||||
}
|
|
||||||
.jstree-default.jstree-rtl .jstree-node {
|
|
||||||
margin-right: 24px;
|
|
||||||
}
|
|
||||||
.jstree-default .jstree-wholerow {
|
|
||||||
height: 24px;
|
|
||||||
}
|
|
||||||
.jstree-default .jstree-node,
|
|
||||||
.jstree-default .jstree-icon {
|
|
||||||
background-image: url("32px.png");
|
|
||||||
}
|
|
||||||
.jstree-default .jstree-node {
|
|
||||||
background-position: -292px -4px;
|
|
||||||
background-repeat: repeat-y;
|
|
||||||
}
|
|
||||||
.jstree-default .jstree-last {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
.jstree-default .jstree-open > .jstree-ocl {
|
|
||||||
background-position: -132px -4px;
|
|
||||||
}
|
|
||||||
.jstree-default .jstree-closed > .jstree-ocl {
|
|
||||||
background-position: -100px -4px;
|
|
||||||
}
|
|
||||||
.jstree-default .jstree-leaf > .jstree-ocl {
|
|
||||||
background-position: -68px -4px;
|
|
||||||
}
|
|
||||||
.jstree-default .jstree-themeicon {
|
|
||||||
background-position: -260px -4px;
|
|
||||||
}
|
|
||||||
.jstree-default > .jstree-no-dots .jstree-node,
|
|
||||||
.jstree-default > .jstree-no-dots .jstree-leaf > .jstree-ocl {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
.jstree-default > .jstree-no-dots .jstree-open > .jstree-ocl {
|
|
||||||
background-position: -36px -4px;
|
|
||||||
}
|
|
||||||
.jstree-default > .jstree-no-dots .jstree-closed > .jstree-ocl {
|
|
||||||
background-position: -4px -4px;
|
|
||||||
}
|
|
||||||
.jstree-default .jstree-disabled {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
.jstree-default .jstree-disabled.jstree-hovered {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
.jstree-default .jstree-disabled.jstree-clicked {
|
|
||||||
background: #efefef;
|
|
||||||
}
|
|
||||||
.jstree-default .jstree-checkbox {
|
|
||||||
background-position: -164px -4px;
|
|
||||||
}
|
|
||||||
.jstree-default .jstree-checkbox:hover {
|
|
||||||
background-position: -164px -36px;
|
|
||||||
}
|
|
||||||
.jstree-default .jstree-clicked > .jstree-checkbox {
|
|
||||||
background-position: -228px -4px;
|
|
||||||
}
|
|
||||||
.jstree-default .jstree-clicked > .jstree-checkbox:hover {
|
|
||||||
background-position: -228px -36px;
|
|
||||||
}
|
|
||||||
.jstree-default .jstree-anchor > .jstree-undetermined {
|
|
||||||
background-position: -196px -4px;
|
|
||||||
}
|
|
||||||
.jstree-default .jstree-anchor > .jstree-undetermined:hover {
|
|
||||||
background-position: -196px -36px;
|
|
||||||
}
|
|
||||||
.jstree-default > .jstree-striped {
|
|
||||||
background-size: auto 48px;
|
|
||||||
}
|
|
||||||
.jstree-default.jstree-rtl .jstree-node {
|
|
||||||
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");
|
|
||||||
background-position: 100% 1px;
|
|
||||||
background-repeat: repeat-y;
|
|
||||||
}
|
|
||||||
.jstree-default.jstree-rtl .jstree-last {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
.jstree-default.jstree-rtl .jstree-open > .jstree-ocl {
|
|
||||||
background-position: -132px -36px;
|
|
||||||
}
|
|
||||||
.jstree-default.jstree-rtl .jstree-closed > .jstree-ocl {
|
|
||||||
background-position: -100px -36px;
|
|
||||||
}
|
|
||||||
.jstree-default.jstree-rtl .jstree-leaf > .jstree-ocl {
|
|
||||||
background-position: -68px -36px;
|
|
||||||
}
|
|
||||||
.jstree-default.jstree-rtl > .jstree-no-dots .jstree-node,
|
|
||||||
.jstree-default.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
.jstree-default.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl {
|
|
||||||
background-position: -36px -36px;
|
|
||||||
}
|
|
||||||
.jstree-default.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl {
|
|
||||||
background-position: -4px -36px;
|
|
||||||
}
|
|
||||||
.jstree-default .jstree-themeicon-custom {
|
|
||||||
background-color: transparent;
|
|
||||||
background-image: none;
|
|
||||||
background-position: 0 0;
|
|
||||||
}
|
|
||||||
.jstree-default > .jstree-container-ul .jstree-loading > .jstree-ocl {
|
|
||||||
background: url("throbber.gif") center center no-repeat;
|
|
||||||
}
|
|
||||||
.jstree-default .jstree-file {
|
|
||||||
background: url("32px.png") -100px -68px no-repeat;
|
|
||||||
}
|
|
||||||
.jstree-default .jstree-folder {
|
|
||||||
background: url("32px.png") -260px -4px no-repeat;
|
|
||||||
}
|
|
||||||
.jstree-default.jstree-rtl .jstree-node {
|
|
||||||
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");
|
|
||||||
}
|
|
||||||
.jstree-default.jstree-rtl .jstree-last {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
.jstree-default-small .jstree-node {
|
|
||||||
min-height: 18px;
|
|
||||||
line-height: 18px;
|
|
||||||
margin-left: 18px;
|
|
||||||
min-width: 18px;
|
|
||||||
}
|
|
||||||
.jstree-default-small .jstree-anchor {
|
|
||||||
line-height: 18px;
|
|
||||||
height: 18px;
|
|
||||||
}
|
|
||||||
.jstree-default-small .jstree-icon {
|
|
||||||
width: 18px;
|
|
||||||
height: 18px;
|
|
||||||
line-height: 18px;
|
|
||||||
}
|
|
||||||
.jstree-default-small .jstree-icon:empty {
|
|
||||||
width: 18px;
|
|
||||||
height: 18px;
|
|
||||||
line-height: 18px;
|
|
||||||
}
|
|
||||||
.jstree-default-small.jstree-rtl .jstree-node {
|
|
||||||
margin-right: 18px;
|
|
||||||
}
|
|
||||||
.jstree-default-small .jstree-wholerow {
|
|
||||||
height: 18px;
|
|
||||||
}
|
|
||||||
.jstree-default-small .jstree-node,
|
|
||||||
.jstree-default-small .jstree-icon {
|
|
||||||
background-image: url("32px.png");
|
|
||||||
}
|
|
||||||
.jstree-default-small .jstree-node {
|
|
||||||
background-position: -295px -7px;
|
|
||||||
background-repeat: repeat-y;
|
|
||||||
}
|
|
||||||
.jstree-default-small .jstree-last {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
.jstree-default-small .jstree-open > .jstree-ocl {
|
|
||||||
background-position: -135px -7px;
|
|
||||||
}
|
|
||||||
.jstree-default-small .jstree-closed > .jstree-ocl {
|
|
||||||
background-position: -103px -7px;
|
|
||||||
}
|
|
||||||
.jstree-default-small .jstree-leaf > .jstree-ocl {
|
|
||||||
background-position: -71px -7px;
|
|
||||||
}
|
|
||||||
.jstree-default-small .jstree-themeicon {
|
|
||||||
background-position: -263px -7px;
|
|
||||||
}
|
|
||||||
.jstree-default-small > .jstree-no-dots .jstree-node,
|
|
||||||
.jstree-default-small > .jstree-no-dots .jstree-leaf > .jstree-ocl {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
.jstree-default-small > .jstree-no-dots .jstree-open > .jstree-ocl {
|
|
||||||
background-position: -39px -7px;
|
|
||||||
}
|
|
||||||
.jstree-default-small > .jstree-no-dots .jstree-closed > .jstree-ocl {
|
|
||||||
background-position: -7px -7px;
|
|
||||||
}
|
|
||||||
.jstree-default-small .jstree-disabled {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
.jstree-default-small .jstree-disabled.jstree-hovered {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
.jstree-default-small .jstree-disabled.jstree-clicked {
|
|
||||||
background: #efefef;
|
|
||||||
}
|
|
||||||
.jstree-default-small .jstree-checkbox {
|
|
||||||
background-position: -167px -7px;
|
|
||||||
}
|
|
||||||
.jstree-default-small .jstree-checkbox:hover {
|
|
||||||
background-position: -167px -39px;
|
|
||||||
}
|
|
||||||
.jstree-default-small .jstree-clicked > .jstree-checkbox {
|
|
||||||
background-position: -231px -7px;
|
|
||||||
}
|
|
||||||
.jstree-default-small .jstree-clicked > .jstree-checkbox:hover {
|
|
||||||
background-position: -231px -39px;
|
|
||||||
}
|
|
||||||
.jstree-default-small .jstree-anchor > .jstree-undetermined {
|
|
||||||
background-position: -199px -7px;
|
|
||||||
}
|
|
||||||
.jstree-default-small .jstree-anchor > .jstree-undetermined:hover {
|
|
||||||
background-position: -199px -39px;
|
|
||||||
}
|
|
||||||
.jstree-default-small > .jstree-striped {
|
|
||||||
background-size: auto 36px;
|
|
||||||
}
|
|
||||||
.jstree-default-small.jstree-rtl .jstree-node {
|
|
||||||
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");
|
|
||||||
background-position: 100% 1px;
|
|
||||||
background-repeat: repeat-y;
|
|
||||||
}
|
|
||||||
.jstree-default-small.jstree-rtl .jstree-last {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
.jstree-default-small.jstree-rtl .jstree-open > .jstree-ocl {
|
|
||||||
background-position: -135px -39px;
|
|
||||||
}
|
|
||||||
.jstree-default-small.jstree-rtl .jstree-closed > .jstree-ocl {
|
|
||||||
background-position: -103px -39px;
|
|
||||||
}
|
|
||||||
.jstree-default-small.jstree-rtl .jstree-leaf > .jstree-ocl {
|
|
||||||
background-position: -71px -39px;
|
|
||||||
}
|
|
||||||
.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-node,
|
|
||||||
.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl {
|
|
||||||
background-position: -39px -39px;
|
|
||||||
}
|
|
||||||
.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl {
|
|
||||||
background-position: -7px -39px;
|
|
||||||
}
|
|
||||||
.jstree-default-small .jstree-themeicon-custom {
|
|
||||||
background-color: transparent;
|
|
||||||
background-image: none;
|
|
||||||
background-position: 0 0;
|
|
||||||
}
|
|
||||||
.jstree-default-small > .jstree-container-ul .jstree-loading > .jstree-ocl {
|
|
||||||
background: url("throbber.gif") center center no-repeat;
|
|
||||||
}
|
|
||||||
.jstree-default-small .jstree-file {
|
|
||||||
background: url("32px.png") -103px -71px no-repeat;
|
|
||||||
}
|
|
||||||
.jstree-default-small .jstree-folder {
|
|
||||||
background: url("32px.png") -263px -7px no-repeat;
|
|
||||||
}
|
|
||||||
.jstree-default-small.jstree-rtl .jstree-node {
|
|
||||||
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg==");
|
|
||||||
}
|
|
||||||
.jstree-default-small.jstree-rtl .jstree-last {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
.jstree-default-large .jstree-node {
|
|
||||||
min-height: 32px;
|
|
||||||
line-height: 32px;
|
|
||||||
margin-left: 32px;
|
|
||||||
min-width: 32px;
|
|
||||||
}
|
|
||||||
.jstree-default-large .jstree-anchor {
|
|
||||||
line-height: 32px;
|
|
||||||
height: 32px;
|
|
||||||
}
|
|
||||||
.jstree-default-large .jstree-icon {
|
|
||||||
width: 32px;
|
|
||||||
height: 32px;
|
|
||||||
line-height: 32px;
|
|
||||||
}
|
|
||||||
.jstree-default-large .jstree-icon:empty {
|
|
||||||
width: 32px;
|
|
||||||
height: 32px;
|
|
||||||
line-height: 32px;
|
|
||||||
}
|
|
||||||
.jstree-default-large.jstree-rtl .jstree-node {
|
|
||||||
margin-right: 32px;
|
|
||||||
}
|
|
||||||
.jstree-default-large .jstree-wholerow {
|
|
||||||
height: 32px;
|
|
||||||
}
|
|
||||||
.jstree-default-large .jstree-node,
|
|
||||||
.jstree-default-large .jstree-icon {
|
|
||||||
background-image: url("32px.png");
|
|
||||||
}
|
|
||||||
.jstree-default-large .jstree-node {
|
|
||||||
background-position: -288px 0px;
|
|
||||||
background-repeat: repeat-y;
|
|
||||||
}
|
|
||||||
.jstree-default-large .jstree-last {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
.jstree-default-large .jstree-open > .jstree-ocl {
|
|
||||||
background-position: -128px 0px;
|
|
||||||
}
|
|
||||||
.jstree-default-large .jstree-closed > .jstree-ocl {
|
|
||||||
background-position: -96px 0px;
|
|
||||||
}
|
|
||||||
.jstree-default-large .jstree-leaf > .jstree-ocl {
|
|
||||||
background-position: -64px 0px;
|
|
||||||
}
|
|
||||||
.jstree-default-large .jstree-themeicon {
|
|
||||||
background-position: -256px 0px;
|
|
||||||
}
|
|
||||||
.jstree-default-large > .jstree-no-dots .jstree-node,
|
|
||||||
.jstree-default-large > .jstree-no-dots .jstree-leaf > .jstree-ocl {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
.jstree-default-large > .jstree-no-dots .jstree-open > .jstree-ocl {
|
|
||||||
background-position: -32px 0px;
|
|
||||||
}
|
|
||||||
.jstree-default-large > .jstree-no-dots .jstree-closed > .jstree-ocl {
|
|
||||||
background-position: 0px 0px;
|
|
||||||
}
|
|
||||||
.jstree-default-large .jstree-disabled {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
.jstree-default-large .jstree-disabled.jstree-hovered {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
.jstree-default-large .jstree-disabled.jstree-clicked {
|
|
||||||
background: #efefef;
|
|
||||||
}
|
|
||||||
.jstree-default-large .jstree-checkbox {
|
|
||||||
background-position: -160px 0px;
|
|
||||||
}
|
|
||||||
.jstree-default-large .jstree-checkbox:hover {
|
|
||||||
background-position: -160px -32px;
|
|
||||||
}
|
|
||||||
.jstree-default-large .jstree-clicked > .jstree-checkbox {
|
|
||||||
background-position: -224px 0px;
|
|
||||||
}
|
|
||||||
.jstree-default-large .jstree-clicked > .jstree-checkbox:hover {
|
|
||||||
background-position: -224px -32px;
|
|
||||||
}
|
|
||||||
.jstree-default-large .jstree-anchor > .jstree-undetermined {
|
|
||||||
background-position: -192px 0px;
|
|
||||||
}
|
|
||||||
.jstree-default-large .jstree-anchor > .jstree-undetermined:hover {
|
|
||||||
background-position: -192px -32px;
|
|
||||||
}
|
|
||||||
.jstree-default-large > .jstree-striped {
|
|
||||||
background-size: auto 64px;
|
|
||||||
}
|
|
||||||
.jstree-default-large.jstree-rtl .jstree-node {
|
|
||||||
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");
|
|
||||||
background-position: 100% 1px;
|
|
||||||
background-repeat: repeat-y;
|
|
||||||
}
|
|
||||||
.jstree-default-large.jstree-rtl .jstree-last {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
.jstree-default-large.jstree-rtl .jstree-open > .jstree-ocl {
|
|
||||||
background-position: -128px -32px;
|
|
||||||
}
|
|
||||||
.jstree-default-large.jstree-rtl .jstree-closed > .jstree-ocl {
|
|
||||||
background-position: -96px -32px;
|
|
||||||
}
|
|
||||||
.jstree-default-large.jstree-rtl .jstree-leaf > .jstree-ocl {
|
|
||||||
background-position: -64px -32px;
|
|
||||||
}
|
|
||||||
.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-node,
|
|
||||||
.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl {
|
|
||||||
background-position: -32px -32px;
|
|
||||||
}
|
|
||||||
.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl {
|
|
||||||
background-position: 0px -32px;
|
|
||||||
}
|
|
||||||
.jstree-default-large .jstree-themeicon-custom {
|
|
||||||
background-color: transparent;
|
|
||||||
background-image: none;
|
|
||||||
background-position: 0 0;
|
|
||||||
}
|
|
||||||
.jstree-default-large > .jstree-container-ul .jstree-loading > .jstree-ocl {
|
|
||||||
background: url("throbber.gif") center center no-repeat;
|
|
||||||
}
|
|
||||||
.jstree-default-large .jstree-file {
|
|
||||||
background: url("32px.png") -96px -64px no-repeat;
|
|
||||||
}
|
|
||||||
.jstree-default-large .jstree-folder {
|
|
||||||
background: url("32px.png") -256px 0px no-repeat;
|
|
||||||
}
|
|
||||||
.jstree-default-large.jstree-rtl .jstree-node {
|
|
||||||
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg==");
|
|
||||||
}
|
|
||||||
.jstree-default-large.jstree-rtl .jstree-last {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.7 KiB |
|
@ -1,296 +0,0 @@
|
||||||
// keymaster.js
|
|
||||||
// (c) 2011-2013 Thomas Fuchs
|
|
||||||
// keymaster.js may be freely distributed under the MIT license.
|
|
||||||
|
|
||||||
;(function(global){
|
|
||||||
var k,
|
|
||||||
_handlers = {},
|
|
||||||
_mods = { 16: false, 18: false, 17: false, 91: false },
|
|
||||||
_scope = 'all',
|
|
||||||
// modifier keys
|
|
||||||
_MODIFIERS = {
|
|
||||||
'⇧': 16, shift: 16,
|
|
||||||
'⌥': 18, alt: 18, option: 18,
|
|
||||||
'⌃': 17, ctrl: 17, control: 17,
|
|
||||||
'⌘': 91, command: 91
|
|
||||||
},
|
|
||||||
// special keys
|
|
||||||
_MAP = {
|
|
||||||
backspace: 8, tab: 9, clear: 12,
|
|
||||||
enter: 13, 'return': 13,
|
|
||||||
esc: 27, escape: 27, space: 32,
|
|
||||||
left: 37, up: 38,
|
|
||||||
right: 39, down: 40,
|
|
||||||
del: 46, 'delete': 46,
|
|
||||||
home: 36, end: 35,
|
|
||||||
pageup: 33, pagedown: 34,
|
|
||||||
',': 188, '.': 190, '/': 191,
|
|
||||||
'`': 192, '-': 189, '=': 187,
|
|
||||||
';': 186, '\'': 222,
|
|
||||||
'[': 219, ']': 221, '\\': 220
|
|
||||||
},
|
|
||||||
code = function(x){
|
|
||||||
return _MAP[x] || x.toUpperCase().charCodeAt(0);
|
|
||||||
},
|
|
||||||
_downKeys = [];
|
|
||||||
|
|
||||||
for(k=1;k<20;k++) _MAP['f'+k] = 111+k;
|
|
||||||
|
|
||||||
// IE doesn't support Array#indexOf, so have a simple replacement
|
|
||||||
function index(array, item){
|
|
||||||
var i = array.length;
|
|
||||||
while(i--) if(array[i]===item) return i;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// for comparing mods before unassignment
|
|
||||||
function compareArray(a1, a2) {
|
|
||||||
if (a1.length != a2.length) return false;
|
|
||||||
for (var i = 0; i < a1.length; i++) {
|
|
||||||
if (a1[i] !== a2[i]) return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
var modifierMap = {
|
|
||||||
16:'shiftKey',
|
|
||||||
18:'altKey',
|
|
||||||
17:'ctrlKey',
|
|
||||||
91:'metaKey'
|
|
||||||
};
|
|
||||||
function updateModifierKey(event) {
|
|
||||||
for(k in _mods) _mods[k] = event[modifierMap[k]];
|
|
||||||
};
|
|
||||||
|
|
||||||
// handle keydown event
|
|
||||||
function dispatch(event) {
|
|
||||||
var key, handler, k, i, modifiersMatch, scope;
|
|
||||||
key = event.keyCode;
|
|
||||||
|
|
||||||
if (index(_downKeys, key) == -1) {
|
|
||||||
_downKeys.push(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
// if a modifier key, set the key.<modifierkeyname> property to true and return
|
|
||||||
if(key == 93 || key == 224) key = 91; // right command on webkit, command on Gecko
|
|
||||||
if(key in _mods) {
|
|
||||||
_mods[key] = true;
|
|
||||||
// 'assignKey' from inside this closure is exported to window.key
|
|
||||||
for(k in _MODIFIERS) if(_MODIFIERS[k] == key) assignKey[k] = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
updateModifierKey(event);
|
|
||||||
|
|
||||||
// see if we need to ignore the keypress (filter() can can be overridden)
|
|
||||||
// by default ignore key presses if a select, textarea, or input is focused
|
|
||||||
if(!assignKey.filter.call(this, event)) return;
|
|
||||||
|
|
||||||
// abort if no potentially matching shortcuts found
|
|
||||||
if (!(key in _handlers)) return;
|
|
||||||
|
|
||||||
scope = getScope();
|
|
||||||
|
|
||||||
// for each potential shortcut
|
|
||||||
for (i = 0; i < _handlers[key].length; i++) {
|
|
||||||
handler = _handlers[key][i];
|
|
||||||
|
|
||||||
// see if it's in the current scope
|
|
||||||
if(handler.scope == scope || handler.scope == 'all'){
|
|
||||||
// check if modifiers match if any
|
|
||||||
modifiersMatch = handler.mods.length > 0;
|
|
||||||
for(k in _mods)
|
|
||||||
if((!_mods[k] && index(handler.mods, +k) > -1) ||
|
|
||||||
(_mods[k] && index(handler.mods, +k) == -1)) modifiersMatch = false;
|
|
||||||
// call the handler and stop the event if neccessary
|
|
||||||
if((handler.mods.length == 0 && !_mods[16] && !_mods[18] && !_mods[17] && !_mods[91]) || modifiersMatch){
|
|
||||||
if(handler.method(event, handler)===false){
|
|
||||||
if(event.preventDefault) event.preventDefault();
|
|
||||||
else event.returnValue = false;
|
|
||||||
if(event.stopPropagation) event.stopPropagation();
|
|
||||||
if(event.cancelBubble) event.cancelBubble = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// unset modifier keys on keyup
|
|
||||||
function clearModifier(event){
|
|
||||||
var key = event.keyCode, k,
|
|
||||||
i = index(_downKeys, key);
|
|
||||||
|
|
||||||
// remove key from _downKeys
|
|
||||||
if (i >= 0) {
|
|
||||||
_downKeys.splice(i, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(key == 93 || key == 224) key = 91;
|
|
||||||
if(key in _mods) {
|
|
||||||
_mods[key] = false;
|
|
||||||
for(k in _MODIFIERS) if(_MODIFIERS[k] == key) assignKey[k] = false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
function resetModifiers() {
|
|
||||||
for(k in _mods) _mods[k] = false;
|
|
||||||
for(k in _MODIFIERS) assignKey[k] = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
// parse and assign shortcut
|
|
||||||
function assignKey(key, scope, method){
|
|
||||||
var keys, mods;
|
|
||||||
keys = getKeys(key);
|
|
||||||
if (method === undefined) {
|
|
||||||
method = scope;
|
|
||||||
scope = 'all';
|
|
||||||
}
|
|
||||||
|
|
||||||
// for each shortcut
|
|
||||||
for (var i = 0; i < keys.length; i++) {
|
|
||||||
// set modifier keys if any
|
|
||||||
mods = [];
|
|
||||||
key = keys[i].split('+');
|
|
||||||
if (key.length > 1){
|
|
||||||
mods = getMods(key);
|
|
||||||
key = [key[key.length-1]];
|
|
||||||
}
|
|
||||||
// convert to keycode and...
|
|
||||||
key = key[0]
|
|
||||||
key = code(key);
|
|
||||||
// ...store handler
|
|
||||||
if (!(key in _handlers)) _handlers[key] = [];
|
|
||||||
_handlers[key].push({ shortcut: keys[i], scope: scope, method: method, key: keys[i], mods: mods });
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// unbind all handlers for given key in current scope
|
|
||||||
function unbindKey(key, scope) {
|
|
||||||
var multipleKeys, keys,
|
|
||||||
mods = [],
|
|
||||||
i, j, obj;
|
|
||||||
|
|
||||||
multipleKeys = getKeys(key);
|
|
||||||
|
|
||||||
for (j = 0; j < multipleKeys.length; j++) {
|
|
||||||
keys = multipleKeys[j].split('+');
|
|
||||||
|
|
||||||
if (keys.length > 1) {
|
|
||||||
mods = getMods(keys);
|
|
||||||
key = keys[keys.length - 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
key = code(key);
|
|
||||||
|
|
||||||
if (scope === undefined) {
|
|
||||||
scope = getScope();
|
|
||||||
}
|
|
||||||
if (!_handlers[key]) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (i = 0; i < _handlers[key].length; i++) {
|
|
||||||
obj = _handlers[key][i];
|
|
||||||
// only clear handlers if correct scope and mods match
|
|
||||||
if (obj.scope === scope && compareArray(obj.mods, mods)) {
|
|
||||||
_handlers[key][i] = {};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Returns true if the key with code 'keyCode' is currently down
|
|
||||||
// Converts strings into key codes.
|
|
||||||
function isPressed(keyCode) {
|
|
||||||
if (typeof(keyCode)=='string') {
|
|
||||||
keyCode = code(keyCode);
|
|
||||||
}
|
|
||||||
return index(_downKeys, keyCode) != -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getPressedKeyCodes() {
|
|
||||||
return _downKeys.slice(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
function filter(event){
|
|
||||||
var tagName = (event.target || event.srcElement).tagName;
|
|
||||||
// ignore keypressed in any elements that support keyboard data input
|
|
||||||
return !(tagName == 'INPUT' || tagName == 'SELECT' || tagName == 'TEXTAREA');
|
|
||||||
}
|
|
||||||
|
|
||||||
// initialize key.<modifier> to false
|
|
||||||
for(k in _MODIFIERS) assignKey[k] = false;
|
|
||||||
|
|
||||||
// set current scope (default 'all')
|
|
||||||
function setScope(scope){ _scope = scope || 'all' };
|
|
||||||
function getScope(){ return _scope || 'all' };
|
|
||||||
|
|
||||||
// delete all handlers for a given scope
|
|
||||||
function deleteScope(scope){
|
|
||||||
var key, handlers, i;
|
|
||||||
|
|
||||||
for (key in _handlers) {
|
|
||||||
handlers = _handlers[key];
|
|
||||||
for (i = 0; i < handlers.length; ) {
|
|
||||||
if (handlers[i].scope === scope) handlers.splice(i, 1);
|
|
||||||
else i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// abstract key logic for assign and unassign
|
|
||||||
function getKeys(key) {
|
|
||||||
var keys;
|
|
||||||
key = key.replace(/\s/g, '');
|
|
||||||
keys = key.split(',');
|
|
||||||
if ((keys[keys.length - 1]) == '') {
|
|
||||||
keys[keys.length - 2] += ',';
|
|
||||||
}
|
|
||||||
return keys;
|
|
||||||
}
|
|
||||||
|
|
||||||
// abstract mods logic for assign and unassign
|
|
||||||
function getMods(key) {
|
|
||||||
var mods = key.slice(0, key.length - 1);
|
|
||||||
for (var mi = 0; mi < mods.length; mi++)
|
|
||||||
mods[mi] = _MODIFIERS[mods[mi]];
|
|
||||||
return mods;
|
|
||||||
}
|
|
||||||
|
|
||||||
// cross-browser events
|
|
||||||
function addEvent(object, event, method) {
|
|
||||||
if (object.addEventListener)
|
|
||||||
object.addEventListener(event, method, false);
|
|
||||||
else if(object.attachEvent)
|
|
||||||
object.attachEvent('on'+event, function(){ method(window.event) });
|
|
||||||
};
|
|
||||||
|
|
||||||
// set the handlers globally on document
|
|
||||||
addEvent(document, 'keydown', function(event) { dispatch(event) }); // Passing _scope to a callback to ensure it remains the same by execution. Fixes #48
|
|
||||||
addEvent(document, 'keyup', clearModifier);
|
|
||||||
|
|
||||||
// reset modifiers to false whenever the window is (re)focused.
|
|
||||||
addEvent(window, 'focus', resetModifiers);
|
|
||||||
|
|
||||||
// store previously defined key
|
|
||||||
var previousKey = global.key;
|
|
||||||
|
|
||||||
// restore previously defined key and return reference to our key object
|
|
||||||
function noConflict() {
|
|
||||||
var k = global.key;
|
|
||||||
global.key = previousKey;
|
|
||||||
return k;
|
|
||||||
}
|
|
||||||
|
|
||||||
// set window.key and window.key.set/get/deleteScope, and the default filter
|
|
||||||
global.key = assignKey;
|
|
||||||
global.key.setScope = setScope;
|
|
||||||
global.key.getScope = getScope;
|
|
||||||
global.key.deleteScope = deleteScope;
|
|
||||||
global.key.filter = filter;
|
|
||||||
global.key.isPressed = isPressed;
|
|
||||||
global.key.getPressedKeyCodes = getPressedKeyCodes;
|
|
||||||
global.key.noConflict = noConflict;
|
|
||||||
global.key.unbind = unbindKey;
|
|
||||||
|
|
||||||
if(typeof module !== 'undefined') module.exports = key;
|
|
||||||
|
|
||||||
})(this);
|
|
Before Width: | Height: | Size: 3 KiB After Width: | Height: | Size: 3 KiB |
5731
demo/js/lib/matter-tools/matter-tools-dev.js
Normal file
5731
demo/js/lib/matter-tools/matter-tools-dev.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,534 +0,0 @@
|
||||||
/**
|
|
||||||
* # ResurrectJS
|
|
||||||
* @version 1.0.2
|
|
||||||
* @license Public Domain
|
|
||||||
*
|
|
||||||
* ResurrectJS preserves object behavior (prototypes) and reference
|
|
||||||
* circularity with a special JSON encoding. Unlike regular JSON,
|
|
||||||
* Date, RegExp, DOM objects, and `undefined` are also properly
|
|
||||||
* preserved.
|
|
||||||
*
|
|
||||||
* ## Examples
|
|
||||||
*
|
|
||||||
* function Foo() {}
|
|
||||||
* Foo.prototype.greet = function() { return "hello"; };
|
|
||||||
*
|
|
||||||
* // Behavior is preserved:
|
|
||||||
* var necromancer = new Resurrect();
|
|
||||||
* var json = necromancer.stringify(new Foo());
|
|
||||||
* var foo = necromancer.resurrect(json);
|
|
||||||
* foo.greet(); // => "hello"
|
|
||||||
*
|
|
||||||
* // References to the same object are preserved:
|
|
||||||
* json = necromancer.stringify([foo, foo]);
|
|
||||||
* var array = necromancer.resurrect(json);
|
|
||||||
* array[0] === array[1]; // => true
|
|
||||||
* array[1].greet(); // => "hello"
|
|
||||||
*
|
|
||||||
* // Dates are restored properly
|
|
||||||
* json = necromancer.stringify(new Date());
|
|
||||||
* var date = necromancer.resurrect(json);
|
|
||||||
* Object.prototype.toString.call(date); // => "[object Date]"
|
|
||||||
*
|
|
||||||
* ## Options
|
|
||||||
*
|
|
||||||
* Options are provided to the constructor as an object with these
|
|
||||||
* properties:
|
|
||||||
*
|
|
||||||
* prefix ('#'): A prefix string used for temporary properties added
|
|
||||||
* to objects during serialization and deserialization. It is
|
|
||||||
* important that you don't use any properties beginning with this
|
|
||||||
* string. This option must be consistent between both
|
|
||||||
* serialization and deserialization.
|
|
||||||
*
|
|
||||||
* cleanup (false): Perform full property cleanup after both
|
|
||||||
* serialization and deserialization using the `delete`
|
|
||||||
* operator. This may cause performance penalties (breaking hidden
|
|
||||||
* classes in V8) on objects that ResurrectJS touches, so enable
|
|
||||||
* with care.
|
|
||||||
*
|
|
||||||
* revive (true): Restore behavior (__proto__) to objects that have
|
|
||||||
* been resurrected. If this is set to false during serialization,
|
|
||||||
* resurrection information will not be encoded. You still get
|
|
||||||
* circularity and Date support.
|
|
||||||
*
|
|
||||||
* resolver (Resurrect.NamespaceResolver(window)): Converts between
|
|
||||||
* a name and a prototype. Create a custom resolver if your
|
|
||||||
* constructors are not stored in global variables. The resolver
|
|
||||||
* has two methods: getName(object) and getPrototype(string).
|
|
||||||
*
|
|
||||||
* For example,
|
|
||||||
*
|
|
||||||
* var necromancer = new Resurrect({
|
|
||||||
* prefix: '__#',
|
|
||||||
* cleanup: true
|
|
||||||
* });
|
|
||||||
*
|
|
||||||
* ## Caveats
|
|
||||||
*
|
|
||||||
* * With the default resolver, all constructors must be named and
|
|
||||||
* stored in the global variable under that name. This is required
|
|
||||||
* so that the prototypes can be looked up and reconnected at
|
|
||||||
* resurrection time.
|
|
||||||
*
|
|
||||||
* * The wrapper objects Boolean, String, and Number will be
|
|
||||||
* unwrapped. This means extra properties added to these objects
|
|
||||||
* will not be preserved.
|
|
||||||
*
|
|
||||||
* * Functions cannot ever be serialized. Resurrect will throw an
|
|
||||||
* error if a function is found when traversing a data structure.
|
|
||||||
*
|
|
||||||
* @see http://nullprogram.com/blog/2013/03/28/
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {Object} [options] See options documentation.
|
|
||||||
* @namespace
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
function Resurrect(options) {
|
|
||||||
this.table = null;
|
|
||||||
this.prefix = '#';
|
|
||||||
this.cleanup = false;
|
|
||||||
this.revive = true;
|
|
||||||
for (var option in options) {
|
|
||||||
if (options.hasOwnProperty(option)) {
|
|
||||||
this[option] = options[option];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.refcode = this.prefix + 'id';
|
|
||||||
this.origcode = this.prefix + 'original';
|
|
||||||
this.buildcode = this.prefix + '.';
|
|
||||||
this.valuecode = this.prefix + 'v';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Portable access to the global object (window, global).
|
|
||||||
* Uses indirect eval.
|
|
||||||
* @constant
|
|
||||||
*/
|
|
||||||
Resurrect.GLOBAL = (0, eval)('this');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Escape special regular expression characters in a string.
|
|
||||||
* @param {string} string
|
|
||||||
* @returns {string} The string escaped for exact matches.
|
|
||||||
* @see http://stackoverflow.com/a/6969486
|
|
||||||
*/
|
|
||||||
Resurrect.escapeRegExp = function (string) {
|
|
||||||
return string.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Helper Objects */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} [message]
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
Resurrect.prototype.Error = function ResurrectError(message) {
|
|
||||||
this.message = message || '';
|
|
||||||
this.stack = new Error().stack;
|
|
||||||
};
|
|
||||||
Resurrect.prototype.Error.prototype = Object.create(Error.prototype);
|
|
||||||
Resurrect.prototype.Error.prototype.name = 'ResurrectError';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Resolves prototypes through the properties on an object and
|
|
||||||
* constructor names.
|
|
||||||
* @param {Object} scope
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
Resurrect.NamespaceResolver = function(scope) {
|
|
||||||
this.scope = scope;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the prototype of the given property name from an object. If
|
|
||||||
* not found, it throws an error.
|
|
||||||
* @param {string} name
|
|
||||||
* @returns {Object}
|
|
||||||
* @method
|
|
||||||
*/
|
|
||||||
Resurrect.NamespaceResolver.prototype.getPrototype = function(name) {
|
|
||||||
var constructor = this.scope[name];
|
|
||||||
if (constructor) {
|
|
||||||
return constructor.prototype;
|
|
||||||
} else {
|
|
||||||
throw new Resurrect.prototype.Error('Unknown constructor: ' + name);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the prototype name for an object, to be fetched later with getPrototype.
|
|
||||||
* @param {Object} object
|
|
||||||
* @returns {?string} Null if the constructor is Object.
|
|
||||||
* @method
|
|
||||||
*/
|
|
||||||
Resurrect.NamespaceResolver.prototype.getName = function(object) {
|
|
||||||
var constructor = object.constructor.name;
|
|
||||||
if (constructor == null) { // IE
|
|
||||||
var funcPattern = /^\s*function\s*([A-Za-z0-9_$]*)/;
|
|
||||||
constructor = funcPattern.exec(object.constructor)[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (constructor === '') {
|
|
||||||
var msg = "Can't serialize objects with anonymous constructors.";
|
|
||||||
throw new Resurrect.prototype.Error(msg);
|
|
||||||
} else if (constructor === 'Object' || constructor === 'Array') {
|
|
||||||
return null;
|
|
||||||
} else {
|
|
||||||
return constructor;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Set the default resolver searches the global object. */
|
|
||||||
Resurrect.prototype.resolver =
|
|
||||||
new Resurrect.NamespaceResolver(Resurrect.GLOBAL);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a DOM node from HTML source; behaves like a constructor.
|
|
||||||
* @param {string} html
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
Resurrect.Node = function(html) {
|
|
||||||
var div = document.createElement('div');
|
|
||||||
div.innerHTML = html;
|
|
||||||
return div.firstChild;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Type Tests */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} type
|
|
||||||
* @returns {Function} A function that tests for type.
|
|
||||||
*/
|
|
||||||
Resurrect.is = function(type) {
|
|
||||||
var string = '[object ' + type + ']';
|
|
||||||
return function(object) {
|
|
||||||
return Object.prototype.toString.call(object) === string;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
Resurrect.isArray = Resurrect.is('Array');
|
|
||||||
Resurrect.isString = Resurrect.is('String');
|
|
||||||
Resurrect.isBoolean = Resurrect.is('Boolean');
|
|
||||||
Resurrect.isNumber = Resurrect.is('Number');
|
|
||||||
Resurrect.isFunction = Resurrect.is('Function');
|
|
||||||
Resurrect.isDate = Resurrect.is('Date');
|
|
||||||
Resurrect.isRegExp = Resurrect.is('RegExp');
|
|
||||||
Resurrect.isObject = Resurrect.is('Object');
|
|
||||||
|
|
||||||
Resurrect.isAtom = function(object) {
|
|
||||||
return !Resurrect.isObject(object) && !Resurrect.isArray(object);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {*} object
|
|
||||||
* @returns {boolean} True if object is a primitive or a primitive wrapper.
|
|
||||||
*/
|
|
||||||
Resurrect.isPrimitive = function(object) {
|
|
||||||
return object == null ||
|
|
||||||
Resurrect.isNumber(object) ||
|
|
||||||
Resurrect.isString(object) ||
|
|
||||||
Resurrect.isBoolean(object);
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Methods */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a reference (encoding) to an object.
|
|
||||||
* @param {(Object|undefined)} object
|
|
||||||
* @returns {Object}
|
|
||||||
* @method
|
|
||||||
*/
|
|
||||||
Resurrect.prototype.ref = function(object) {
|
|
||||||
var ref = {};
|
|
||||||
if (object === undefined) {
|
|
||||||
ref[this.prefix] = -1;
|
|
||||||
} else {
|
|
||||||
ref[this.prefix] = object[this.refcode];
|
|
||||||
}
|
|
||||||
return ref;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Lookup an object in the table by reference object.
|
|
||||||
* @param {Object} ref
|
|
||||||
* @returns {(Object|undefined)}
|
|
||||||
* @method
|
|
||||||
*/
|
|
||||||
Resurrect.prototype.deref = function(ref) {
|
|
||||||
return this.table[ref[this.prefix]];
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Put a temporary identifier on an object and store it in the table.
|
|
||||||
* @param {Object} object
|
|
||||||
* @returns {number} The unique identifier number.
|
|
||||||
* @method
|
|
||||||
*/
|
|
||||||
Resurrect.prototype.tag = function(object) {
|
|
||||||
if (this.revive) {
|
|
||||||
var constructor = this.resolver.getName(object);
|
|
||||||
if (constructor) {
|
|
||||||
var proto = Object.getPrototypeOf(object);
|
|
||||||
if (this.resolver.getPrototype(constructor) !== proto) {
|
|
||||||
throw new this.Error('Constructor mismatch!');
|
|
||||||
} else {
|
|
||||||
object[this.prefix] = constructor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
object[this.refcode] = this.table.length;
|
|
||||||
this.table.push(object);
|
|
||||||
return object[this.refcode];
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a builder object (encoding) for serialization.
|
|
||||||
* @param {string} name The name of the constructor.
|
|
||||||
* @param value The value to pass to the constructor.
|
|
||||||
* @returns {Object}
|
|
||||||
* @method
|
|
||||||
*/
|
|
||||||
Resurrect.prototype.builder = function(name, value) {
|
|
||||||
var builder = {};
|
|
||||||
builder[this.buildcode] = name;
|
|
||||||
builder[this.valuecode] = value;
|
|
||||||
return builder;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Build a value from a deserialized builder.
|
|
||||||
* @param {Object} ref
|
|
||||||
* @returns {Object}
|
|
||||||
* @method
|
|
||||||
* @see http://stackoverflow.com/a/14378462
|
|
||||||
* @see http://nullprogram.com/blog/2013/03/24/
|
|
||||||
*/
|
|
||||||
Resurrect.prototype.build = function(ref) {
|
|
||||||
var type = ref[this.buildcode].split(/\./).reduce(function(object, name) {
|
|
||||||
return object[name];
|
|
||||||
}, Resurrect.GLOBAL);
|
|
||||||
/* Brilliant hack by kybernetikos: */
|
|
||||||
var args = [null].concat(ref[this.valuecode]);
|
|
||||||
var factory = type.bind.apply(type, args);
|
|
||||||
var result = new factory();
|
|
||||||
if (Resurrect.isPrimitive(result)) {
|
|
||||||
return result.valueOf(); // unwrap
|
|
||||||
} else {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Dereference or build an object or value from an encoding.
|
|
||||||
* @param {Object} ref
|
|
||||||
* @returns {(Object|undefined)}
|
|
||||||
* @method
|
|
||||||
*/
|
|
||||||
Resurrect.prototype.decode = function(ref) {
|
|
||||||
if (this.prefix in ref) {
|
|
||||||
return this.deref(ref);
|
|
||||||
} else if (this.buildcode in ref) {
|
|
||||||
return this.build(ref);
|
|
||||||
} else {
|
|
||||||
throw new this.Error('Unknown encoding.');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {Object} object
|
|
||||||
* @returns {boolean} True if the provided object is tagged for serialization.
|
|
||||||
* @method
|
|
||||||
*/
|
|
||||||
Resurrect.prototype.isTagged = function(object) {
|
|
||||||
return (this.refcode in object) && (object[this.refcode] != null);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Visit root and all its ancestors, visiting atoms with f.
|
|
||||||
* @param {*} root
|
|
||||||
* @param {Function} f
|
|
||||||
* @returns {*} A fresh copy of root to be serialized.
|
|
||||||
* @method
|
|
||||||
*/
|
|
||||||
Resurrect.prototype.visit = function(root, f) {
|
|
||||||
if (Resurrect.isAtom(root)) {
|
|
||||||
return f(root);
|
|
||||||
} else if (!this.isTagged(root)) {
|
|
||||||
var copy = null;
|
|
||||||
if (Resurrect.isArray(root)) {
|
|
||||||
copy = [];
|
|
||||||
root[this.refcode] = this.tag(copy);
|
|
||||||
for (var i = 0; i < root.length; i++) {
|
|
||||||
copy.push(this.visit(root[i], f));
|
|
||||||
}
|
|
||||||
} else { /* Object */
|
|
||||||
copy = Object.create(Object.getPrototypeOf(root));
|
|
||||||
root[this.refcode] = this.tag(copy);
|
|
||||||
for (var key in root) {
|
|
||||||
if (root.hasOwnProperty(key)) {
|
|
||||||
copy[key] = this.visit(root[key], f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
copy[this.origcode] = root;
|
|
||||||
return this.ref(copy);
|
|
||||||
} else {
|
|
||||||
return this.ref(root);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Manage special atom values, possibly returning an encoding.
|
|
||||||
* @param {*} atom
|
|
||||||
* @returns {*}
|
|
||||||
* @method
|
|
||||||
*/
|
|
||||||
Resurrect.prototype.handleAtom = function(atom) {
|
|
||||||
var Node = Resurrect.GLOBAL.Node || function() {};
|
|
||||||
if (Resurrect.isFunction(atom)) {
|
|
||||||
throw new this.Error("Can't serialize functions.");
|
|
||||||
} else if (atom instanceof Node) {
|
|
||||||
var xmls = new XMLSerializer();
|
|
||||||
return this.builder('Resurrect.Node', [xmls.serializeToString(atom)]);
|
|
||||||
} else if (Resurrect.isDate(atom)) {
|
|
||||||
return this.builder('Date', [atom.toISOString()]);
|
|
||||||
} else if (Resurrect.isRegExp(atom)) {
|
|
||||||
var args = atom.toString().match(/\/(.+)\/([gimy]*)/).slice(1);
|
|
||||||
return this.builder('RegExp', args);
|
|
||||||
} else if (atom === undefined) {
|
|
||||||
return this.ref(undefined);
|
|
||||||
} else if (Resurrect.isNumber(atom) && (isNaN(atom) || !isFinite(atom))) {
|
|
||||||
return this.builder('Number', [atom.toString()]);
|
|
||||||
} else {
|
|
||||||
return atom;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Hides intrusive keys from a user-supplied replacer.
|
|
||||||
* @param {Function} replacer function of two arguments (key, value)
|
|
||||||
* @returns {Function} A function that skips the replacer for intrusive keys.
|
|
||||||
* @method
|
|
||||||
*/
|
|
||||||
Resurrect.prototype.replacerWrapper = function(replacer) {
|
|
||||||
var skip = new RegExp('^' + Resurrect.escapeRegExp(this.prefix));
|
|
||||||
return function(k, v) {
|
|
||||||
if (skip.test(k)) {
|
|
||||||
return v;
|
|
||||||
} else {
|
|
||||||
return replacer(k, v);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Serialize an arbitrary JavaScript object, carefully preserving it.
|
|
||||||
* @param {*} object
|
|
||||||
* @param {(Function|Array)} replacer
|
|
||||||
* @param {string} space
|
|
||||||
* @method
|
|
||||||
*/
|
|
||||||
Resurrect.prototype.stringify = function(object, replacer, space) {
|
|
||||||
if (Resurrect.isFunction(replacer)) {
|
|
||||||
replacer = this.replacerWrapper(replacer);
|
|
||||||
} else if (Resurrect.isArray(replacer)) {
|
|
||||||
var codes = [
|
|
||||||
this.prefix,
|
|
||||||
this.refcode,
|
|
||||||
this.origcode,
|
|
||||||
this.buildcode,
|
|
||||||
this.valuecode
|
|
||||||
];
|
|
||||||
replacer = codes.concat(replacer);
|
|
||||||
}
|
|
||||||
if (Resurrect.isAtom(object)) {
|
|
||||||
return JSON.stringify(this.handleAtom(object), replacer, space);
|
|
||||||
} else {
|
|
||||||
this.table = [];
|
|
||||||
this.visit(object, this.handleAtom.bind(this));
|
|
||||||
for (var i = 0; i < this.table.length; i++) {
|
|
||||||
if (this.cleanup) {
|
|
||||||
delete this.table[i][this.origcode][this.refcode];
|
|
||||||
} else {
|
|
||||||
this.table[i][this.origcode][this.refcode] = null;
|
|
||||||
}
|
|
||||||
delete this.table[i][this.refcode];
|
|
||||||
delete this.table[i][this.origcode];
|
|
||||||
}
|
|
||||||
var table = this.table;
|
|
||||||
this.table = null;
|
|
||||||
return JSON.stringify(table, replacer, space);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Restore the __proto__ of the given object to the proper value.
|
|
||||||
* @param {Object} object
|
|
||||||
* @returns {Object} Its argument.
|
|
||||||
* @method
|
|
||||||
*/
|
|
||||||
Resurrect.prototype.fixPrototype = function(object) {
|
|
||||||
if (this.prefix in object) {
|
|
||||||
var name = object[this.prefix];
|
|
||||||
var prototype = this.resolver.getPrototype(name);
|
|
||||||
if ('__proto__' in object) {
|
|
||||||
object.__proto__ = prototype;
|
|
||||||
if (this.cleanup) {
|
|
||||||
delete object[this.prefix];
|
|
||||||
}
|
|
||||||
return object;
|
|
||||||
} else { // IE
|
|
||||||
var copy = Object.create(prototype);
|
|
||||||
for (var key in object) {
|
|
||||||
if (object.hasOwnProperty(key) && key !== this.prefix) {
|
|
||||||
copy[key] = object[key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return copy;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return object;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deserialize an encoded object, restoring circularity and behavior.
|
|
||||||
* @param {string} string
|
|
||||||
* @returns {*} The decoded object or value.
|
|
||||||
* @method
|
|
||||||
*/
|
|
||||||
Resurrect.prototype.resurrect = function(string) {
|
|
||||||
var result = null;
|
|
||||||
var data = JSON.parse(string);
|
|
||||||
if (Resurrect.isArray(data)) {
|
|
||||||
this.table = data;
|
|
||||||
/* Restore __proto__. */
|
|
||||||
if (this.revive) {
|
|
||||||
for (var i = 0; i < this.table.length; i++) {
|
|
||||||
this.table[i] = this.fixPrototype(this.table[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* Re-establish object references and construct atoms. */
|
|
||||||
for (i = 0; i < this.table.length; i++) {
|
|
||||||
var object = this.table[i];
|
|
||||||
for (var key in object) {
|
|
||||||
if (object.hasOwnProperty(key)) {
|
|
||||||
if (!(Resurrect.isAtom(object[key]))) {
|
|
||||||
object[key] = this.decode(object[key]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
result = this.table[0];
|
|
||||||
} else if (Resurrect.isObject(data)) {
|
|
||||||
this.table = [];
|
|
||||||
result = this.decode(data);
|
|
||||||
} else {
|
|
||||||
result = data;
|
|
||||||
}
|
|
||||||
this.table = null;
|
|
||||||
return result;
|
|
||||||
};
|
|
|
@ -32,12 +32,10 @@ Matter.Axes = Axes;
|
||||||
Matter.Bounds = Bounds;
|
Matter.Bounds = Bounds;
|
||||||
Matter.Vector = Vector;
|
Matter.Vector = Vector;
|
||||||
Matter.Vertices = Vertices;
|
Matter.Vertices = Vertices;
|
||||||
Matter.Gui = Gui;
|
|
||||||
Matter.Render = Render;
|
Matter.Render = Render;
|
||||||
Matter.RenderPixi = RenderPixi;
|
Matter.RenderPixi = RenderPixi;
|
||||||
Matter.Events = Events;
|
Matter.Events = Events;
|
||||||
Matter.Query = Query;
|
Matter.Query = Query;
|
||||||
Matter.Inspector = Inspector;
|
|
||||||
|
|
||||||
// CommonJS module
|
// CommonJS module
|
||||||
if (typeof exports !== 'undefined') {
|
if (typeof exports !== 'undefined') {
|
||||||
|
|
327
src/tools/Gui.js
327
src/tools/Gui.js
|
@ -1,327 +0,0 @@
|
||||||
/**
|
|
||||||
* See [Demo.js](https://github.com/liabru/matter-js/blob/master/demo/js/Demo.js)
|
|
||||||
* and [DemoMobile.js](https://github.com/liabru/matter-js/blob/master/demo/js/DemoMobile.js) for usage examples.
|
|
||||||
*
|
|
||||||
* @class Gui
|
|
||||||
*/
|
|
||||||
|
|
||||||
var Gui = {};
|
|
||||||
|
|
||||||
(function() {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Description
|
|
||||||
* @method create
|
|
||||||
* @param {engine} engine
|
|
||||||
* @param {object} options
|
|
||||||
* @return {gui} A container for a configured dat.gui
|
|
||||||
*/
|
|
||||||
Gui.create = function(engine, options) {
|
|
||||||
var _datGuiSupported = window.dat && window.localStorage;
|
|
||||||
|
|
||||||
if (!_datGuiSupported) {
|
|
||||||
console.log("Could not create GUI. Check dat.gui library is loaded first.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var datGui = new dat.GUI(options);
|
|
||||||
|
|
||||||
var gui = {
|
|
||||||
engine: engine,
|
|
||||||
datGui: datGui,
|
|
||||||
amount: 1,
|
|
||||||
size: 40,
|
|
||||||
sides: 4,
|
|
||||||
density: 0.001,
|
|
||||||
restitution: 0,
|
|
||||||
friction: 0.1,
|
|
||||||
frictionAir: 0.01,
|
|
||||||
offset: { x: 0, y: 0 },
|
|
||||||
renderer: 'canvas'
|
|
||||||
};
|
|
||||||
|
|
||||||
if (Resurrect) {
|
|
||||||
gui.serializer = new Resurrect({ prefix: '$', cleanup: true });
|
|
||||||
gui.serializer.parse = gui.serializer.resurrect;
|
|
||||||
}
|
|
||||||
|
|
||||||
_initDatGui(gui);
|
|
||||||
|
|
||||||
return gui;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Description
|
|
||||||
* @method update
|
|
||||||
* @param {gui} gui
|
|
||||||
* @param {datGui} datGui
|
|
||||||
*/
|
|
||||||
Gui.update = function(gui, datGui) {
|
|
||||||
var i;
|
|
||||||
datGui = datGui || gui.datGui;
|
|
||||||
|
|
||||||
for (i in datGui.__folders) {
|
|
||||||
Gui.update(gui, datGui.__folders[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i in datGui.__controllers) {
|
|
||||||
var controller = datGui.__controllers[i];
|
|
||||||
if (controller.updateDisplay)
|
|
||||||
controller.updateDisplay();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Description
|
|
||||||
* @method closeAll
|
|
||||||
* @param {gui} gui
|
|
||||||
*/
|
|
||||||
Gui.closeAll = function(gui) {
|
|
||||||
var datGui = gui.datGui;
|
|
||||||
|
|
||||||
for (var i in datGui.__folders) {
|
|
||||||
datGui.__folders[i].close();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Saves world state to local storage
|
|
||||||
* @method saveState
|
|
||||||
* @param {object} serializer
|
|
||||||
* @param {engine} engine
|
|
||||||
* @param {string} key
|
|
||||||
*/
|
|
||||||
Gui.saveState = function(serializer, engine, key) {
|
|
||||||
if (localStorage && serializer)
|
|
||||||
localStorage.setItem(key, Gui.serialise(serializer, engine.world));
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Loads world state from local storage
|
|
||||||
* @method loadState
|
|
||||||
* @param {object} serializer
|
|
||||||
* @param {engine} engine
|
|
||||||
* @param {string} key
|
|
||||||
*/
|
|
||||||
Gui.loadState = function(serializer, engine, key) {
|
|
||||||
var loadedWorld;
|
|
||||||
|
|
||||||
if (localStorage && serializer)
|
|
||||||
loadedWorld = serializer.parse(localStorage.getItem(key));
|
|
||||||
|
|
||||||
if (loadedWorld)
|
|
||||||
Engine.merge(engine, { world: loadedWorld });
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Serialises the object using the given serializer and a Matter-specific replacer
|
|
||||||
* @method serialise
|
|
||||||
* @param {object} serializer
|
|
||||||
* @param {object} object
|
|
||||||
* @param {number} indent
|
|
||||||
* @return {string} The serialised object
|
|
||||||
*/
|
|
||||||
Gui.serialise = function(serializer, object, indent) {
|
|
||||||
indent = indent || 0;
|
|
||||||
return serializer.stringify(object, function(key, value) {
|
|
||||||
// skip non-required values
|
|
||||||
if (key === 'path')
|
|
||||||
return undefined;
|
|
||||||
|
|
||||||
// limit precision of floats
|
|
||||||
if (!/^#/.exec(key) && typeof value === 'number') {
|
|
||||||
var fixed = parseFloat(value.toFixed(3));
|
|
||||||
|
|
||||||
// do not limit if limiting will cause value to zero
|
|
||||||
// TODO: this should ideally dynamically find the SF precision required
|
|
||||||
if (fixed === 0 && value !== 0)
|
|
||||||
return value;
|
|
||||||
|
|
||||||
return fixed;
|
|
||||||
}
|
|
||||||
|
|
||||||
return value;
|
|
||||||
}, indent);
|
|
||||||
};
|
|
||||||
|
|
||||||
var _initDatGui = function(gui) {
|
|
||||||
var engine = gui.engine,
|
|
||||||
datGui = gui.datGui;
|
|
||||||
|
|
||||||
var funcs = {
|
|
||||||
addBody: function() { _addBody(gui); },
|
|
||||||
clear: function() { _clear(gui); },
|
|
||||||
save: function() { Gui.saveState(gui.serializer, engine, 'guiState'); Events.trigger(gui, 'save'); },
|
|
||||||
load: function() { Gui.loadState(gui.serializer, engine, 'guiState'); Events.trigger(gui, 'load'); },
|
|
||||||
inspect: function() {
|
|
||||||
if (!Inspector.instance)
|
|
||||||
gui.inspector = Inspector.create(gui.engine);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var metrics = datGui.addFolder('Metrics');
|
|
||||||
metrics.add(engine.timing, 'fps').listen();
|
|
||||||
|
|
||||||
if (engine.metrics.extended) {
|
|
||||||
metrics.add(engine.timing, 'delta').listen();
|
|
||||||
metrics.add(engine.timing, 'correction').listen();
|
|
||||||
metrics.add(engine.metrics, 'bodies').listen();
|
|
||||||
metrics.add(engine.metrics, 'collisions').listen();
|
|
||||||
metrics.add(engine.metrics, 'pairs').listen();
|
|
||||||
metrics.add(engine.metrics, 'broadEff').listen();
|
|
||||||
metrics.add(engine.metrics, 'midEff').listen();
|
|
||||||
metrics.add(engine.metrics, 'narrowEff').listen();
|
|
||||||
metrics.add(engine.metrics, 'narrowReuse').listen();
|
|
||||||
metrics.close();
|
|
||||||
} else {
|
|
||||||
metrics.open();
|
|
||||||
}
|
|
||||||
|
|
||||||
var controls = datGui.addFolder('Add Body');
|
|
||||||
controls.add(gui, 'amount', 1, 5).step(1);
|
|
||||||
controls.add(gui, 'size', 5, 150).step(1);
|
|
||||||
controls.add(gui, 'sides', 1, 8).step(1);
|
|
||||||
controls.add(gui, 'density', 0.0001, 0.01).step(0.001);
|
|
||||||
controls.add(gui, 'friction', 0, 1).step(0.05);
|
|
||||||
controls.add(gui, 'frictionAir', 0, gui.frictionAir * 10).step(gui.frictionAir / 10);
|
|
||||||
controls.add(gui, 'restitution', 0, 1).step(0.1);
|
|
||||||
controls.add(funcs, 'addBody');
|
|
||||||
controls.open();
|
|
||||||
|
|
||||||
var worldGui = datGui.addFolder('World');
|
|
||||||
worldGui.add(funcs, 'inspect');
|
|
||||||
worldGui.add(funcs, 'load');
|
|
||||||
worldGui.add(funcs, 'save');
|
|
||||||
worldGui.add(funcs, 'clear');
|
|
||||||
worldGui.open();
|
|
||||||
|
|
||||||
var gravity = worldGui.addFolder('Gravity');
|
|
||||||
gravity.add(engine.world.gravity, 'x', -1, 1).step(0.01);
|
|
||||||
gravity.add(engine.world.gravity, 'y', -1, 1).step(0.01);
|
|
||||||
gravity.open();
|
|
||||||
|
|
||||||
var physics = datGui.addFolder('Engine');
|
|
||||||
physics.add(engine, 'enableSleeping');
|
|
||||||
|
|
||||||
physics.add(engine.broadphase, 'current', ['grid', 'bruteForce'])
|
|
||||||
.onFinishChange(function(value) {
|
|
||||||
Composite.setModified(engine.world, true, false, false);
|
|
||||||
});
|
|
||||||
|
|
||||||
physics.add(engine.timing, 'timeScale', 0, 1.2).step(0.05).listen();
|
|
||||||
physics.add(engine, 'velocityIterations', 1, 10).step(1);
|
|
||||||
physics.add(engine, 'positionIterations', 1, 10).step(1);
|
|
||||||
physics.add(engine, 'enabled');
|
|
||||||
physics.open();
|
|
||||||
|
|
||||||
var render = datGui.addFolder('Render');
|
|
||||||
|
|
||||||
render.add(gui, 'renderer', ['canvas', 'webgl'])
|
|
||||||
.onFinishChange(function(value) { _setRenderer(gui, value); });
|
|
||||||
|
|
||||||
render.add(engine.render.options, 'wireframes');
|
|
||||||
render.add(engine.render.options, 'showDebug');
|
|
||||||
render.add(engine.render.options, 'showPositions');
|
|
||||||
render.add(engine.render.options, 'showBroadphase');
|
|
||||||
render.add(engine.render.options, 'showBounds');
|
|
||||||
render.add(engine.render.options, 'showVelocity');
|
|
||||||
render.add(engine.render.options, 'showCollisions');
|
|
||||||
render.add(engine.render.options, 'showAxes');
|
|
||||||
render.add(engine.render.options, 'showAngleIndicator');
|
|
||||||
render.add(engine.render.options, 'showSleeping');
|
|
||||||
render.add(engine.render.options, 'showIds');
|
|
||||||
render.add(engine.render.options, 'showShadows');
|
|
||||||
render.add(engine.render.options, 'enabled');
|
|
||||||
render.open();
|
|
||||||
};
|
|
||||||
|
|
||||||
var _setRenderer = function(gui, rendererName) {
|
|
||||||
var engine = gui.engine,
|
|
||||||
controller;
|
|
||||||
|
|
||||||
if (rendererName === 'canvas')
|
|
||||||
controller = Render;
|
|
||||||
|
|
||||||
if (rendererName === 'webgl')
|
|
||||||
controller = RenderPixi;
|
|
||||||
|
|
||||||
// remove old canvas
|
|
||||||
engine.render.element.removeChild(engine.render.canvas);
|
|
||||||
|
|
||||||
// create new renderer using the same options object
|
|
||||||
var options = engine.render.options;
|
|
||||||
|
|
||||||
engine.render = controller.create({
|
|
||||||
element: engine.render.element,
|
|
||||||
options: options
|
|
||||||
});
|
|
||||||
|
|
||||||
engine.render.options = options;
|
|
||||||
|
|
||||||
// bind the mouse to the new canvas
|
|
||||||
Mouse.setElement(engine.input.mouse, engine.render.canvas);
|
|
||||||
};
|
|
||||||
|
|
||||||
var _addBody = function(gui) {
|
|
||||||
var engine = gui.engine;
|
|
||||||
|
|
||||||
var options = {
|
|
||||||
density: gui.density,
|
|
||||||
friction: gui.friction,
|
|
||||||
frictionAir: gui.frictionAir,
|
|
||||||
restitution: gui.restitution
|
|
||||||
};
|
|
||||||
|
|
||||||
for (var i = 0; i < gui.amount; i++) {
|
|
||||||
World.add(engine.world, Bodies.polygon(gui.offset.x + 120 + i * gui.size + i * 50, gui.offset.y + 200, gui.sides, gui.size, options));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var _clear = function(gui) {
|
|
||||||
var engine = gui.engine;
|
|
||||||
|
|
||||||
World.clear(engine.world, true);
|
|
||||||
Engine.clear(engine);
|
|
||||||
|
|
||||||
// clear scene graph (if defined in controller)
|
|
||||||
var renderController = engine.render.controller;
|
|
||||||
if (renderController.clear)
|
|
||||||
renderController.clear(engine.render);
|
|
||||||
|
|
||||||
Events.trigger(gui, 'clear');
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
* Events Documentation
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fired after the gui's clear button pressed
|
|
||||||
*
|
|
||||||
* @event clear
|
|
||||||
* @param {} event An event object
|
|
||||||
* @param {} event.source The source object of the event
|
|
||||||
* @param {} event.name The name of the event
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fired after the gui's save button pressed
|
|
||||||
*
|
|
||||||
* @event save
|
|
||||||
* @param {} event An event object
|
|
||||||
* @param {} event.source The source object of the event
|
|
||||||
* @param {} event.name The name of the event
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fired after the gui's load button pressed
|
|
||||||
*
|
|
||||||
* @event load
|
|
||||||
* @param {} event An event object
|
|
||||||
* @param {} event.source The source object of the event
|
|
||||||
* @param {} event.name The name of the event
|
|
||||||
*/
|
|
||||||
|
|
||||||
})();
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue