Commit 2546622d authored by JC Brand's avatar JC Brand

Trigger events when resizing starts

parent 45e19acf
...@@ -251,7 +251,7 @@ converse.plugins.add('converse-dragresize', { ...@@ -251,7 +251,7 @@ converse.plugins.add('converse-dragresize', {
} }
}, },
onStartVerticalResize (ev) { onStartVerticalResize (ev, trigger=true) {
if (!_converse.allow_dragresize) { return true; } if (!_converse.allow_dragresize) { return true; }
// Record element attributes for mouseMove(). // Record element attributes for mouseMove().
const flyout = this.el.querySelector('.box-flyout'), const flyout = this.el.querySelector('.box-flyout'),
...@@ -262,9 +262,17 @@ converse.plugins.add('converse-dragresize', { ...@@ -262,9 +262,17 @@ converse.plugins.add('converse-dragresize', {
'direction': 'top' 'direction': 'top'
}; };
this.prev_pageY = ev.pageY; this.prev_pageY = ev.pageY;
if (trigger) {
/**
* Triggered once the user starts to vertically resize a {@link _converse.ChatBoxView}
* @event _converse#startVerticalResize
* @example _converse.api.listen.on('startVerticalResize', (view) => { ... });
*/
_converse.api.trigger('startVerticalResize', this);
}
}, },
onStartHorizontalResize (ev) { onStartHorizontalResize (ev, trigger=true) {
if (!_converse.allow_dragresize) { return true; } if (!_converse.allow_dragresize) { return true; }
const flyout = this.el.querySelector('.box-flyout'), const flyout = this.el.querySelector('.box-flyout'),
style = window.getComputedStyle(flyout); style = window.getComputedStyle(flyout);
...@@ -274,12 +282,27 @@ converse.plugins.add('converse-dragresize', { ...@@ -274,12 +282,27 @@ converse.plugins.add('converse-dragresize', {
'direction': 'left' 'direction': 'left'
}; };
this.prev_pageX = ev.pageX; this.prev_pageX = ev.pageX;
if (trigger) {
/**
* Triggered once the user starts to horizontally resize a {@link _converse.ChatBoxView}
* @event _converse#startHorizontalResize
* @example _converse.api.listen.on('startHorizontalResize', (view) => { ... });
*/
_converse.api.trigger('startHorizontalResize', this);
}
}, },
onStartDiagonalResize (ev) { onStartDiagonalResize (ev) {
this.onStartHorizontalResize(ev); this.onStartHorizontalResize(ev, false);
this.onStartVerticalResize(ev); this.onStartVerticalResize(ev, false);
_converse.resizing.direction = 'topleft'; _converse.resizing.direction = 'topleft';
/**
* Triggered once the user starts to diagonally resize a {@link _converse.ChatBoxView}
* @event _converse#startDiagonalResize
* @example _converse.api.listen.on('startDiagonalResize', (view) => { ... });
*/
_converse.api.trigger('startDiagonalResize', this);
}, },
}; };
Object.assign(_converse.ChatBoxView.prototype, dragResizable); Object.assign(_converse.ChatBoxView.prototype, dragResizable);
......
...@@ -315,7 +315,7 @@ converse.plugins.add('converse-minimize', { ...@@ -315,7 +315,7 @@ converse.plugins.add('converse-minimize', {
* to create space. * to create space.
* @private * @private
* @method _converse.ChatBoxViews#trimChats * @method _converse.ChatBoxViews#trimChats
* @param { [ChatBoxView|ChatRoomView|ControlBoxView|HeadlinesBoxView] } newchat * @param { _converse.ChatBoxView|_converse.ChatRoomView|_converse.ControlBoxView|_converse.HeadlinesBoxView } [newchat]
*/ */
async trimChats (newchat) { async trimChats (newchat) {
if (_converse.no_trimming || !_converse.connection.connected || _converse.view_mode !== 'overlayed') { if (_converse.no_trimming || !_converse.connection.connected || _converse.view_mode !== 'overlayed') {
......
...@@ -94,9 +94,11 @@ const CORE_PLUGINS = [ ...@@ -94,9 +94,11 @@ const CORE_PLUGINS = [
/** /**
* A private, closured object containing the private api (via {@link _converse.api}) * A private, closured object containing the private api (via {@link _converse.api})
* as well as private methods and internal data-structures. * as well as private methods and internal data-structures.
* * @global
* @namespace _converse * @namespace _converse
*/ */
// XXX: Strictly speaking _converse is not a global, but we need to set it as
// such to get JSDoc to create the correct document site strucure.
const _converse = { const _converse = {
'templates': {}, 'templates': {},
'promises': {} 'promises': {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment