<legend id='vLVyS'><style id='vLVyS'><dir id='vLVyS'><q id='vLVyS'></q></dir></style></legend>
<tfoot id='vLVyS'></tfoot>
    <bdo id='vLVyS'></bdo><ul id='vLVyS'></ul>

      1. <small id='vLVyS'></small><noframes id='vLVyS'>

      2. <i id='vLVyS'><tr id='vLVyS'><dt id='vLVyS'><q id='vLVyS'><span id='vLVyS'><b id='vLVyS'><form id='vLVyS'><ins id='vLVyS'></ins><ul id='vLVyS'></ul><sub id='vLVyS'></sub></form><legend id='vLVyS'></legend><bdo id='vLVyS'><pre id='vLVyS'><center id='vLVyS'></center></pre></bdo></b><th id='vLVyS'></th></span></q></dt></tr></i><div id='vLVyS'><tfoot id='vLVyS'></tfoot><dl id='vLVyS'><fieldset id='vLVyS'></fieldset></dl></div>
      3. 旋转后调整大小时如何计算平移x和y值..?

        时间:2023-10-13
          <tbody id='UBtyo'></tbody>

        <small id='UBtyo'></small><noframes id='UBtyo'>

        <legend id='UBtyo'><style id='UBtyo'><dir id='UBtyo'><q id='UBtyo'></q></dir></style></legend>

        <tfoot id='UBtyo'></tfoot>

        <i id='UBtyo'><tr id='UBtyo'><dt id='UBtyo'><q id='UBtyo'><span id='UBtyo'><b id='UBtyo'><form id='UBtyo'><ins id='UBtyo'></ins><ul id='UBtyo'></ul><sub id='UBtyo'></sub></form><legend id='UBtyo'></legend><bdo id='UBtyo'><pre id='UBtyo'><center id='UBtyo'></center></pre></bdo></b><th id='UBtyo'></th></span></q></dt></tr></i><div id='UBtyo'><tfoot id='UBtyo'></tfoot><dl id='UBtyo'><fieldset id='UBtyo'></fieldset></dl></div>
            <bdo id='UBtyo'></bdo><ul id='UBtyo'></ul>

                • 本文介绍了旋转后调整大小时如何计算平移x和y值..?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在使用 HTML div 元素 javascript 中基于角的调整大小.

                  I am working with HTML div element corner based resize in javascript.

                  基于角的调整大小在选择框 div 未旋转(即 rotate(0 deg))时完美运行.

                  Corner based resize working perfect when selection box div is unrotated (i.e. rotate(0 deg)).

                  旋转后,当左上角需要保持在同一位置时,我使用右下角作为手柄来调整选择框div的大小.p>

                  就像有四个手柄一样,调整大小时对角需要保持在同一位置.

                  After rotate, i am using bottom-right corner as handle to resize the selection box div, when top-left corner needs to remain in same position.

                  但问题是,选择框左上角角不保持在同一位置.

                  As like having four handles, with opposite corner needs to remain in same position when resize.

                  我需要为旋转后基于角的调整大小计算平移 x 和 y 值.

                  But the problem is, the selection box top-left corner not remains in same position.

                  scale, center_x, center_y, previous_x, previous_y, width, height, previous_width, previous_height, diff_width, diff_height, radian_angle, rotated_degree.

                  I need to calculate translate x and y value for corner based resize after rotate.

                  scale, center_x, center_y, previous_x, previous_y, width, height, previous_width, previous_height, diff_width, diff_height, radian_angle, rotated_degree.

                  用于旋转后调整大小的示例代码:

                  switch (handle) {
                    case 'bottom-right':
                      x = previous_x - ? ;        //logic behind after rotated some angles..?
                      y = previous_y + ? ;
                      break;
                    case 'bottom-left':
                      x = ? ;
                      y = ? ;
                      break;
                    case 'top-left':
                      x = ? ;
                      y = ? ;
                      break;
                    case 'top-right':
                      x = ? ;
                      y = ? ;
                      break;
                    default:
                  }
                  

                  当使用未旋转的 div (rotate(0 deg)) 调整大小时,基于角的调整大小代码可以完美运行:

                  Below corner based resize code works perfect when resize with unrotated div (rotate(0 deg)):

                  case 'bottom-right':
                    x = previous_x;
                    y = previous_y;
                    break;
                  case 'bottom-left':
                    x = previous_x - diff_width;
                    y = previous_y;
                    break;
                  

                  如何计算 translate x &调整大小时旋转后的y值以获得固定角.?

                  How to calculate translate x & y value after rotate to get fixed corner when resize.?

                  推荐答案

                  不知道你是否还需要帮助.但我认为你可以用三角函数(余弦、正弦和你的旋转角度)来达到它,因为你的旋转画了一个圆.

                  I don't know if you still need help. But I think you can reach it with Trigonometry (cosinus, sinus and your rotation angle) because your rotation draw a circle.

                  这篇关于旋转后调整大小时如何计算平移x和y值..?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何旋转 HTML5 画布的现有内容? 下一篇:html5 - 以相对坐标获取设备方向旋转

                  相关文章

                  最新文章

                  <i id='EkYOF'><tr id='EkYOF'><dt id='EkYOF'><q id='EkYOF'><span id='EkYOF'><b id='EkYOF'><form id='EkYOF'><ins id='EkYOF'></ins><ul id='EkYOF'></ul><sub id='EkYOF'></sub></form><legend id='EkYOF'></legend><bdo id='EkYOF'><pre id='EkYOF'><center id='EkYOF'></center></pre></bdo></b><th id='EkYOF'></th></span></q></dt></tr></i><div id='EkYOF'><tfoot id='EkYOF'></tfoot><dl id='EkYOF'><fieldset id='EkYOF'></fieldset></dl></div>

                  <small id='EkYOF'></small><noframes id='EkYOF'>

                  1. <tfoot id='EkYOF'></tfoot>
                    1. <legend id='EkYOF'><style id='EkYOF'><dir id='EkYOF'><q id='EkYOF'></q></dir></style></legend>
                      • <bdo id='EkYOF'></bdo><ul id='EkYOF'></ul>