Top | ![]() |
![]() |
![]() |
![]() |
Applet.PopupResizeHandlerApplet.PopupResizeHandler — Class that allows an applet to be resized using the mouse. |
Example usage:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
this.menu = new Applet.AppletPopupMenu(this, this.orientation); this.settings.bind("popup-width", "popup_width"); this.settings.bind("popup-height", "popup_height"); this._resizer = new Applet.PopupResizeHandler( this.menu.actor, () => this.orientation, (w,h) => this._onBoxResized(w,h), () => this.popup_width * global.ui_scale, () => this.popup_height * global.ui_scale); ... _onBoxResized(width, height) { this.popup_width = Math.max(width / global.ui_scale, 300); this.popup_height = Math.max(height / global.ui_scale, 400); this.menu.actor.set_width(this.popup_width * global.ui_scale); this.menu.actor.set_height(this.popup_height * global.ui_scale); } |
constructor (ClutterActor actor
,Function get_orientation
,Function resized_callback
,Function get_user_width
,Function get_user_height
);
actor |
The actor to be resized |
|
get_orientation |
Function that returns the current orientation of the applet. (St.Side) |
|
resized_callback |
Function that is called while resizing is in progress with the new width and height as parameters. This function should actually change the applet size. This is also called once when resizing has ended (resizingInProgress == false) so that the applet can store the final size instead of doing so continuously whilst resizing is in progress. |
|
get_user_width |
Function that returns the current applet width. This function is not called while resizing is in progress so it only has to return the correct width when resizing is not in progress. Note: This value does not necessarily have to be the applet width. It could be the width of a container inside the applet used for sizing the applet. |
|
get_user_height |
As get_user_width but for height |