|
|
@@ -552,11 +552,10 @@ var Clip = {
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
getRulerBound(){//坐标尺边界 米
|
|
|
let camera = viewer.mainViewport.camera
|
|
|
if(!camera.isOrthographicCamera)return
|
|
|
- let w = camera.right / camera.zoom //half
|
|
|
+ let w = camera.right / camera.zoom //half 视图宽度的一半
|
|
|
let h = camera.top / camera.zoom
|
|
|
|
|
|
|
|
|
@@ -568,7 +567,7 @@ var Clip = {
|
|
|
let p1 = p.clone().applyMatrix4(camera.matrixWorldInverse);
|
|
|
boundAtCamera.expandByPoint(p1)
|
|
|
})
|
|
|
- //需要找出clipbox的bound的左上角,它在标尺中是原点
|
|
|
+ /* //需要找出clipbox的bound的左下角,它在标尺中是原点
|
|
|
let ClipBoxLeftTop = new THREE.Vector2(boundAtCamera.min.x, boundAtCamera.max.y) //相对于相机的位置
|
|
|
let camPos = new THREE.Vector2(-ClipBoxLeftTop.x, ClipBoxLeftTop.y)//由于ClipBoxLeftTop要变换到原点,所以相机位置就成了ClipBoxLeftTop的相反数, 但因是从上到下所以y再乘-1
|
|
|
|
|
|
@@ -579,7 +578,18 @@ var Clip = {
|
|
|
right: camPos.x + w,
|
|
|
bottom: camPos.y + h, //注意从上到下增大
|
|
|
top: camPos.y - h,
|
|
|
- }
|
|
|
+ } */
|
|
|
+
|
|
|
+
|
|
|
+ let ClipBoxLeftBtm = new THREE.Vector2(boundAtCamera.min.x, boundAtCamera.min.y) //相对于相机的位置
|
|
|
+ let bound_ = {
|
|
|
+ left: -ClipBoxLeftBtm.x - w,
|
|
|
+ right: -ClipBoxLeftBtm.x + w,
|
|
|
+ bottom: -ClipBoxLeftBtm.y - h,
|
|
|
+ top: -ClipBoxLeftBtm.y + h,
|
|
|
+ }
|
|
|
+ //假想标尺中心在画面中心,那么标尺范围就是 -w到w, 现在降中心偏移到box的左边,即范围平移-x, 范围变成 -x-w到-x+w
|
|
|
+
|
|
|
//console.log(bound)
|
|
|
//标尺里又改为左下角原点了
|
|
|
return bound_
|
|
|
@@ -766,8 +776,8 @@ var Clip = {
|
|
|
|
|
|
rulerBound.left -= marginSelf.left * meterPerPixel //标尺范围内的宽度(米)
|
|
|
rulerBound.right += marginSelf.right * meterPerPixel
|
|
|
- rulerBound.top -= marginSelf.top * meterPerPixel
|
|
|
- rulerBound.bottom += marginSelf.bottom * meterPerPixel
|
|
|
+ rulerBound.top += marginSelf.top * meterPerPixel
|
|
|
+ rulerBound.bottom -= marginSelf.bottom * meterPerPixel
|
|
|
|
|
|
let width = img.width + marginSelf.left + marginSelf.right //标尺范围内的像素宽度
|
|
|
let height = img.height + marginSelf.top + marginSelf.bottom
|
|
|
@@ -777,7 +787,8 @@ var Clip = {
|
|
|
|
|
|
let result = await rulerToolFactory(//绘制标尺
|
|
|
[rulerBound.left, rulerBound.right], //xRang.value,
|
|
|
- [rulerBound.top, rulerBound.bottom], //yRang.value,
|
|
|
+ //[rulerBound.top, rulerBound.bottom], //yRang.value,
|
|
|
+ [rulerBound.bottom, rulerBound.top],
|
|
|
xNumTicks, yNumTicks, width, height, '#000000'
|
|
|
);
|
|
|
|