dragrect
用鼠标拖动矩形
Syntax
[finalRect] = dragrect(initial retrect)
[finalRect] = dragrect(初始rect,stepsize)
Description
[finalRect] = dragrect(initial retrect)
tracks one or more rectangles anywhere on the screen. The n-by-4 matrixinitialrect
定义矩形。每一行initialrect
must contain the initial rectangle position as [left bottom width height]
values.dragrect
returns the final position of the rectangles in最终优势
。
[finalRect] = dragrect(初始rect,stepsize)
以增量的增量移动矩形步长
。th的左下角e first rectangle is constrained to a grid of size equal to步长
从图的左下角开始,所有其他矩形都从第一个矩形保持原始偏移。
[finalRect] = dragrect(...)
returns the final positions of the rectangles when the mouse button is released. The default step size is1
。
Examples
More About
提示
dragrect
returns immediately if a mouse button is not currently pressed. Usedragrect
in aButtonDownFcn
, or from the command line in conjunction withwaitforbuttonpress
, to ensure that the mouse button is down whendragrect
is called.dragrect
returns when you release the mouse button.
If the drag ends over a figure window, the positions of the rectangles are returned in that figure's coordinate system. If the drag ends over a part of the screen not contained within a figure window, the rectangles are returned in the coordinate system of the figure over which the drag began.
Note
You cannot use normalized figure units withdragrect
。