viral-viewer-2 3.3.7 → 3.3.8
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.
|
@@ -10,9 +10,22 @@ class ViralContextMenu {
|
|
|
10
10
|
this.injectContextMenu();
|
|
11
11
|
}
|
|
12
12
|
injectContextMenu() {
|
|
13
|
+
const hoverEffect = `
|
|
14
|
+
.hover-element {
|
|
15
|
+
transition: background-color 0.3s ease;
|
|
16
|
+
}
|
|
17
|
+
.hover-element:hover {
|
|
18
|
+
background-color: rgba(134,149,125,0.3);
|
|
19
|
+
|
|
20
|
+
}`;
|
|
21
|
+
// Create a style element and append the keyframes animation
|
|
22
|
+
const style = document.createElement('style');
|
|
23
|
+
style.innerHTML = hoverEffect;
|
|
24
|
+
// Append the style element to the document head
|
|
25
|
+
document.head.appendChild(style);
|
|
13
26
|
if (this.viralViewerApi.targetElement) {
|
|
14
27
|
this.contextMenu = document.createElement('div');
|
|
15
|
-
this.contextMenu.setAttribute('style', "position: absolute;top:0px;left:0px;background-color: rgb(226, 230, 220,1);justify-content: center;
|
|
28
|
+
this.contextMenu.setAttribute('style', "position: absolute;top:0px;left:0px;background-color: rgb(226, 230, 220,1);justify-content: center;display:none; z-index: 100; flex-direction:column; padding: 10px 0; border-radius:10px");
|
|
16
29
|
this.viralViewerApi.targetElement.appendChild(this.contextMenu);
|
|
17
30
|
}
|
|
18
31
|
}
|
|
@@ -31,12 +44,15 @@ class ViralContextMenu {
|
|
|
31
44
|
}
|
|
32
45
|
initContent(itemKeys) {
|
|
33
46
|
var _a;
|
|
47
|
+
while (this.contextMenu && this.contextMenu.firstChild) {
|
|
48
|
+
this.contextMenu.removeChild(this.contextMenu.firstChild);
|
|
49
|
+
}
|
|
34
50
|
for (let index = 0; index < this.contextItems.length; index++) {
|
|
35
51
|
if (itemKeys.findIndex(x => x == this.contextItems[index][0]) < 0) {
|
|
36
52
|
continue;
|
|
37
53
|
}
|
|
38
54
|
const [itemKey, itemName, callbackResolve] = this.contextItems[index];
|
|
39
|
-
const item = (0, html_1.createElementFromHTML)(`<div>${itemName}</div>`);
|
|
55
|
+
const item = (0, html_1.createElementFromHTML)(`<div class="hover-element" style="padding: 5px 10px; cursor: pointer;">${itemName}</div>`);
|
|
40
56
|
item.addEventListener('click', (ev) => { callbackResolve(ev); });
|
|
41
57
|
(_a = this.contextMenu) === null || _a === void 0 ? void 0 : _a.appendChild(item);
|
|
42
58
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viral-context-menu.js","sourceRoot":"","sources":["../../../src/components/context-menu/viral-context-menu.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"viral-context-menu.js","sourceRoot":"","sources":["../../../src/components/context-menu/viral-context-menu.ts"],"names":[],"mappings":";;;AACA,2CAAyD;AAGzD,MAAa,gBAAgB;IAIzB,YAAmB,cAA8B;QAA9B,mBAAc,GAAd,cAAc,CAAgB;QAHzC,gBAAW,GAAuB,IAAI,CAAA;QACtC,iBAAY,GAA8C,EAAE,CAAC;QAGjE,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC7B,CAAC;IACO,iBAAiB;QACrB,MAAM,WAAW,GAAG;;;;;;;UAOlB,CAAC;QAEH,4DAA4D;QAC5D,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAC9C,KAAK,CAAC,SAAS,GAAG,WAAW,CAAC;QAE9B,gDAAgD;QAChD,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAEjC,IAAI,IAAI,CAAC,cAAc,CAAC,aAAa,EAAE;YACnC,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;YACjD,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,OAAO,EAAE,2LAA2L,CAAC,CAAA;YACnO,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,WAAW,CAAC,IAAI,CAAC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0EAA0E,QAAQ,QAAQ,CAAC,CAAC;YAC/H,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,EAAc,EAAE,EAAE,GAAG,eAAe,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;YAC5E,MAAA,IAAI,CAAC,WAAW,0CAAE,WAAW,CAAC,IAAI,CAAC,CAAA;SACtC;IACL,CAAC;IAED;;;;OAIG;IACI,cAAc,CAAC,OAAe,EAAE,QAAgB,EAAE,OAA8B;QACnF,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAA;IAExD,CAAC;CACJ;AArED,4CAqEC"}
|
|
@@ -56,7 +56,7 @@ class ViralMouse {
|
|
|
56
56
|
//#endregion
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
if (_event.button ==
|
|
59
|
+
if (_event.button == 2) {
|
|
60
60
|
if (this.mouseDownRightQueuedEvents.length > 0) {
|
|
61
61
|
this.mouseDownRightQueuedEvents.forEach(element => {
|
|
62
62
|
const [actionKey, callbackResolve] = element;
|