draggable

버전 1.4.1.0 (13.3 KB) 작성자: Francois Bouffard
Allows graphical objects to be dragged in a figure.
다운로드 수: 8.3K
업데이트 날짜: 2023/3/27

라이선스 보기

편집자 메모: This file was selected as MATLAB Central Pick of the Week

This function enables a graphical object (be it a line, plot, patch, rectangle, text box, etc.) to be dragged inside an axis, with a very simple syntax ("draggable(h)"), following or not horizontal, vertical or diagonal constraints. Limits can be imposed on the object's movement.
Some figure properties are changed by the function, but previous properties are restored as soon as the drag is stopped. The behavior of the object can be reverted to its original, non-draggable state, by issuing "draggable(h,'off')".
Typical uses of this function would include non-standard GUI elements, such as markers that are moved on a figure or image. A function which is called when the object is moved can be provided as an optional argument, so that the movement triggers further actions.
See the provided file dragdemo.m for usage examples.

인용 양식

Francois Bouffard (2024). draggable (https://www.mathworks.com/matlabcentral/fileexchange/4179-draggable), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2020a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Graphics Object Programming에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보
1.4.1.0

Includes Gunnar Geissler's 'data' constraint, allowing a marker or other object to snap to data series.

1.4.0.0

Probable fix to draggable not working well with App Designer apps. Thanks to William E. Warriner for working on the fix with me and testing it.

1.3.0.0

This update fixes a bug found by Esmerald Aliai in which draggable would not work for axes embedded in Panels. In fact this should also fix Shaun's bug mentioned in March 2012.

1.2.0.0

Major update. Now supports text objects. Diagonal constraints with arbitrary slopes added. Single call for applying draggable on multiple objects sharing the same parameters supported. Added the 'sliders' demo in dragdemo. General cleanup.

1.1.0.0

implemented a feature and fixed a bug (both user-suggested)

1.0.0.0

Bugfix for Matlab 7+: axes no longer disappear. Renderer option removed.