lexgui 0.7.4 → 0.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/extensions/codeeditor.js +51 -14
- package/build/extensions/videoeditor.js +12 -1
- package/build/lexgui.css +20 -11
- package/build/lexgui.js +14 -7
- package/build/lexgui.min.css +1 -1
- package/build/lexgui.min.js +1 -1
- package/build/lexgui.module.js +14 -7
- package/build/lexgui.module.min.js +1 -1
- package/changelog.md +15 -1
- package/examples/code-editor.html +4 -0
- package/package.json +1 -1
package/build/lexgui.module.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
const LX = {
|
|
10
|
-
version: "0.7.
|
|
10
|
+
version: "0.7.5",
|
|
11
11
|
ready: false,
|
|
12
12
|
extensions: [], // Store extensions used
|
|
13
13
|
signals: {}, // Events and triggers
|
|
@@ -1092,6 +1092,7 @@ class DropdownMenu {
|
|
|
1092
1092
|
this.alignOffset = options.alignOffset ?? 0;
|
|
1093
1093
|
this.avoidCollisions = options.avoidCollisions ?? true;
|
|
1094
1094
|
this.onBlur = options.onBlur;
|
|
1095
|
+
this.event = options.event;
|
|
1095
1096
|
this.inPlace = false;
|
|
1096
1097
|
|
|
1097
1098
|
this.root = document.createElement( "div" );
|
|
@@ -1382,11 +1383,11 @@ class DropdownMenu {
|
|
|
1382
1383
|
_adjustPosition() {
|
|
1383
1384
|
|
|
1384
1385
|
const position = [ 0, 0 ];
|
|
1386
|
+
const rect = this._trigger.getBoundingClientRect();
|
|
1385
1387
|
|
|
1386
1388
|
// Place menu using trigger position and user options
|
|
1389
|
+
if( !this.event )
|
|
1387
1390
|
{
|
|
1388
|
-
const rect = this._trigger.getBoundingClientRect();
|
|
1389
|
-
|
|
1390
1391
|
let alignWidth = true;
|
|
1391
1392
|
|
|
1392
1393
|
switch( this.side )
|
|
@@ -1428,11 +1429,11 @@ class DropdownMenu {
|
|
|
1428
1429
|
if( alignWidth ) { position[ 0 ] += this.alignOffset; }
|
|
1429
1430
|
else { position[ 1 ] += this.alignOffset; }
|
|
1430
1431
|
}
|
|
1431
|
-
|
|
1432
|
-
|
|
1432
|
+
// Offset position based on event
|
|
1433
|
+
else
|
|
1433
1434
|
{
|
|
1434
|
-
position[ 0 ] =
|
|
1435
|
-
position[ 1 ] =
|
|
1435
|
+
position[ 0 ] = this.event.x;
|
|
1436
|
+
position[ 1 ] = this.event.y;
|
|
1436
1437
|
}
|
|
1437
1438
|
|
|
1438
1439
|
if( this._parent instanceof HTMLDialogElement )
|
|
@@ -1442,6 +1443,12 @@ class DropdownMenu {
|
|
|
1442
1443
|
position[ 1 ] -= parentRect.y;
|
|
1443
1444
|
}
|
|
1444
1445
|
|
|
1446
|
+
if( this.avoidCollisions )
|
|
1447
|
+
{
|
|
1448
|
+
position[ 0 ] = LX.clamp( position[ 0 ], 0, window.innerWidth - this.root.offsetWidth - this._windowPadding );
|
|
1449
|
+
position[ 1 ] = LX.clamp( position[ 1 ], 0, window.innerHeight - this.root.offsetHeight - this._windowPadding );
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1445
1452
|
this.root.style.left = `${ position[ 0 ] }px`;
|
|
1446
1453
|
this.root.style.top = `${ position[ 1 ] }px`;
|
|
1447
1454
|
this.inPlace = true;
|