xzw 2 tahun lalu
induk
melakukan
d17abdc1cb
3 mengubah file dengan 168 tambahan dan 18 penghapusan
  1. 89 10
      css/lzb.css
  2. 12 8
      js/TransformControls.js
  3. 67 0
      js/edit.js

+ 89 - 10
css/lzb.css

@@ -207,7 +207,7 @@ ul li {
     /* overflow-x: hidden; */
 }
 
-.toolRight div.content>ul>li {
+.toolRight div.content>ul>li:not(.group-widget) {
     border-top: 1px solid #5d5d5d;
     border-bottom: 1px solid #000000;
     padding: 10px;
@@ -221,9 +221,7 @@ ul li {
     border-top: none;
 }
 
-.toolRight div.content>ul>li>*:first-child {
-    margin: 3px 0 5px 0 !important;
-}
+ 
 
 .itemMargin {
     margin: 10px auto !important;
@@ -354,7 +352,7 @@ ul.MenuOptions li.chosen {
     left: 100%;
 }
 
-.toolRight div.content>ul>li {
+.toolRight div.content>ul>li:not(.group-widget) {
     border-top: 1px solid #636363;
     border-bottom: 1px solid #000000;
     padding: 15px 10px;
@@ -364,7 +362,7 @@ ul.MenuOptions li.chosen {
     border-top: none;
 }
 
-.toolRight div.content ul>li>* {
+.toolRight div.content ul>li:not(.group-widget)>*,   .group-widget .inner>.widget-wrapper>*{
     margin: 7px 0 12px 0;
     line-height: 32px;
     height: 100%;
@@ -757,7 +755,7 @@ ul.MenuOptions li.chosen {
 }
 
 .toolRight .mediaUpload .itemTitle {
-    height: 32px;
+    height: 32px !important; 
 }
 
 .toolRight .itemTitle::before {
@@ -777,7 +775,7 @@ ul.MenuOptions li.chosen {
 }
 
 .toolRight .itemTitle:not(:first-child) {
-    margin: 25px 0 2px 0 !important;
+    margin: 13px 0 2px 0 !important;
 }
 
 
@@ -789,7 +787,7 @@ ul.MenuOptions li.chosen {
     font-size: 13px;
     line-height: 12px;
 }
-.toolRight li[name="content"]>ul>li {
+.toolRight li[name="content"] .widget-wrapper>ul>li {
     background: #212121;
     padding: 8px 5px 8px 10px;
     margin: 18px 0;
@@ -2102,4 +2100,85 @@ ul.MenuOptions li.chosen {
     /* background: #4c4c4c; */
     margin: 17px 0px;
     border-bottom: 1px dotted #404040;
-}
+}
+
+
+
+/* from 4dmodel: */
+ .layout-widget{
+	display:-webkit-box;
+	display:-webkit-flex;
+	display:-ms-flexbox;
+	display:flex;
+	-webkit-box-orient:vertical;
+	-webkit-box-direction:normal;
+	-webkit-flex-direction:column;
+	-ms-flex-direction:column;
+	flex-direction:column;
+	height:inherit;
+}
+.widget-wrapper>.header{
+	background: #616161;
+	position:relative;
+	height:32px;
+	border-top: 1px solid #18232e;
+	border-bottom: 1px solid #18232e;
+	padding-left: 10px;
+	font-size:12px;
+	line-height:29px;
+	color: #ffffff;
+	opacity:1;
+	cursor:pointer;
+	transition: color 0.1s;
+	text-align:left;
+}
+
+.widget-wrapper>.header:before{
+	content: "\f0d7";
+	display: block;
+    position: absolute;
+    left: 0;
+    right: 0;
+    width: 20px;
+    height: 29px;
+    font-family: FontAwesome;
+    text-align: center;
+    line-height: 29px;
+}
+.widget-wrapper>.header.closed:before{
+	content: "\f0da";
+}
+
+
+.inner>.widget-wrapper{
+	position:relative;
+	margin: 13px 0 19px 0;
+}
+
+
+ .group-widget > .widget-wrapper > .header .pic{
+	position:absolute;
+	top:6px;
+}
+ .group-widget > .widget-wrapper > .header a{
+    margin-left: 12px;
+    font-size: 14px;
+    letter-spacing: 3px;
+    /* font-weight: 700; */
+     
+}
+.group-widget > .widget-wrapper > .inner {
+    padding: 0px 13px;
+    overflow: visible;
+    max-height: 1000px;
+    transition:all 0.2s;	/* 透明度和高度 */
+}
+
+[name="content"] .group-widget > .widget-wrapper > .inner {
+    max-height: 2800px;
+}
+
+.group-widget > .widget-wrapper > .inner.closed{
+	max-height:0;
+	overflow: hidden;
+}

+ 12 - 8
js/TransformControls.js

@@ -387,9 +387,14 @@ var TransformControls = function ( camera, domElement, options ) {
 			if ( axis.indexOf( 'Z' ) === - 1 ) offset.z = 0;
 
 			if ( space === 'local' && axis !== 'XYZ' ) {
-
+                //xzw 加,否则会反向---------------
+                object.scale.x < 0 && (offset.x *= -1)
+                object.scale.y < 0 && (offset.y *= -1)
+                object.scale.z < 0 && (offset.z *= -1)
+                //---------------------------------
 				offset.applyQuaternion( quaternionStart ).divide( parentScale );
-
+                
+                 
 			} else {
 
 				offset.applyQuaternion( parentQuaternionInv ).divide( parentScale );
@@ -589,14 +594,12 @@ var TransformControls = function ( camera, domElement, options ) {
 
 				_tempVector.copy( _unit[ axis ] );
 
-				if ( space === 'local' ) {
-
-					_tempVector.applyQuaternion( worldQuaternion );
-
+				if ( space === 'local' ) { 
+					_tempVector.applyQuaternion( worldQuaternion ); 
 				}
 
 				rotationAngle = offset.dot( _tempVector.cross( eye ).normalize() ) * ROTATION_SPEED;
-
+                 
 			}
 
 			// Apply rotation snap
@@ -607,7 +610,8 @@ var TransformControls = function ( camera, domElement, options ) {
 
 			// Apply rotate
 			if ( space === 'local' && axis !== 'E' && axis !== 'XYZE' ) {
-
+                object.scale[axis.toLowerCase()] < 0 && (rotationAngle *= -1) //xzw 加,否则会反向 
+                 
 				object.quaternion.copy( quaternionStart );
 				object.quaternion.multiply( _tempQuaternion.setFromAxisAngle( rotationAxis, rotationAngle ) ).normalize();
 

+ 67 - 0
js/edit.js

@@ -6728,6 +6728,73 @@ function setDraggable(o={}){
 }
 
 
+
+
+
+
+
+
+function rebuildWidget(widget){//改写替换部分UI成可折叠的
+    widget = $(widget)
+    widget.addClass('group-widget')
+    let title = widget.find('.itemTitle span')[0].innerText; 
+    
+    let group = $(`<div class='group-widget'> <div class='widget-wrapper'><div class='header'> <a>${title}</a> </div><div class='inner'><div class='widget-wrapper'></div></div></div></div>`)
+    widget.find('.itemTitle').eq(0).remove()
+    let children = Array.from(widget.children())
+    children.forEach(child=>{
+        group.find('.inner>div').append(child)
+    })
+    
+    widget.append(group)
+}
+
+ 
+
+function setToggle(widget){//效果展开
+    let header = $(widget).find('.header')
+    let inner = $(widget).find('.inner')
+	header.on("click", function(e){ 
+        header.toggleClass('closed')
+        inner.toggleClass('closed') 
+    })  
+}
+
+
+
+ 
+
+function setWidgeOpen(widget, open){
+    let header = widget.find('.header')
+    let inner = widget.find('.inner')
+    if(open){
+        header.removeClass('closed')
+        inner.removeClass('closed')
+    }else{
+        header.addClass('closed')
+        inner.addClass('closed')
+    }
+}
+  
+function closeWidgets(classes){
+    classes.forEach((cla)=>{
+         let widge = $(`#hotpointDetail .content>ul>li[name=${cla}]`) 
+         setWidgeOpen(widge, false)
+    })
+}
+
+
+Array.from($("#hotpointDetail .content>ul>li")).forEach((group)=>{
+    rebuildWidget(group)
+    setToggle(group)
+})
+closeWidgets(['setPos',  'model'])
+
+
+
+
+
+
 /* class OnOffSwitch extends CheckBox{
     constructor(o={}){
         super(o)