刘洋 7 bulan lalu
induk
melakukan
78377887c3
1 mengubah file dengan 8 tambahan dan 22 penghapusan
  1. 8 22
      src/modules/admin/ocr/OcrTest.vue

+ 8 - 22
src/modules/admin/ocr/OcrTest.vue

@@ -252,16 +252,6 @@ export default {
         // 计算元素的位置
         _this.dragData.left = event.pageX - _this.dragData.x - 40;
         _this.dragData.top = event.pageY - _this.dragData.y - 90;
-        console.log("_this.dragData.left:", _this.dragData.left);
-        console.log("_this.dragData.top:", _this.dragData.top);
-        console.log(
-          " _this.$refs.centerBox.offsetLeft:",
-          _this.$refs.centerBox.offsetLeft
-        );
-        console.log(
-          "_this.$refs.centerBox.offsetTop:",
-          _this.$refs.centerBox.offsetTop
-        );
         const isToRight =
           _this.dragData.left > _this.$refs.centerBox.offsetLeft;
         const isToLeft = _this.dragData.left < _this.$refs.centerBox.offsetLeft;
@@ -282,8 +272,7 @@ export default {
           if (
             !(
               (_this.$refs.centerBox.offsetWidth <= _this.maxWidth &&
-                _this.$refs.centerBox.offsetWidth +
-                  parseFloat(_this.$refs.centerBox.style.left) >=
+                _this.$refs.centerBox.offsetWidth + _this.dragData.left >=
                   _this.maxWidth) ||
               (_this.$refs.centerBox.offsetWidth > _this.maxWidth &&
                 _this.dragData.left >= 0)
@@ -294,11 +283,10 @@ export default {
         } else if (isToLeft) {
           if (
             !(
-              (parseFloat(_this.$refs.centerBox.style.left) <= 0 &&
+              (_this.dragData.left <= 0 &&
                 _this.$refs.centerBox.offsetWidth <= _this.maxWidth) ||
-              (parseFloat(_this.$refs.centerBox.style.left) <= 0 &&
-                _this.$refs.centerBox.offsetWidth +
-                  parseFloat(_this.$refs.centerBox.style.left) <=
+              (_this.dragData.left <= 0 &&
+                _this.$refs.centerBox.offsetWidth + _this.dragData.left <=
                   _this.maxWidth)
             )
           ) {
@@ -308,11 +296,10 @@ export default {
         if (isToTop) {
           if (
             !(
-              (parseFloat(_this.$refs.centerBox.style.top) <= 0 &&
+              (_this.dragData.top <= 0 &&
                 _this.$refs.centerBox.offsetHeight <= _this.maxHeight) ||
-              (parseFloat(_this.$refs.centerBox.style.top) <= 0 &&
-                _this.$refs.centerBox.offsetHeight +
-                  parseFloat(_this.$refs.centerBox.style.top) <=
+              (_this.dragData.top <= 0 &&
+                _this.$refs.centerBox.offsetHeight + _this.dragData.top <=
                   _this.maxHeight)
             )
           ) {
@@ -323,8 +310,7 @@ export default {
           if (
             !(
               (_this.$refs.centerBox.offsetHeight <= _this.maxHeight &&
-                _this.$refs.centerBox.offsetHeight +
-                  parseFloat(_this.$refs.centerBox.style.top) >=
+                _this.$refs.centerBox.offsetHeight + _this.dragData.top >=
                   _this.maxHeight) ||
               (_this.$refs.centerBox.offsetHeight > _this.maxHeight &&
                 _this.dragData.top >= 0)