perfect-gui 4.2.3 → 4.3.0
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/package.json +1 -1
- package/src/index.js +17 -1
- package/src/styles.js +13 -0
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -286,6 +286,9 @@ export default class GUI {
|
|
|
286
286
|
} else {
|
|
287
287
|
name = typeof params.name == 'string' ? params.name || ' ' : ' ';
|
|
288
288
|
}
|
|
289
|
+
|
|
290
|
+
const selected = params.selected === true;
|
|
291
|
+
const selectionBorder = params.selectionBorder !== false;
|
|
289
292
|
|
|
290
293
|
if (!this.imageContainer) {
|
|
291
294
|
this.imageContainer = this._createElement({
|
|
@@ -299,6 +302,10 @@ export default class GUI {
|
|
|
299
302
|
inline: `background-image: url(${path})`,
|
|
300
303
|
parent: this.imageContainer
|
|
301
304
|
})
|
|
305
|
+
|
|
306
|
+
if (selected && selectionBorder) {
|
|
307
|
+
image.classList.add('p-gui__image--selected');
|
|
308
|
+
}
|
|
302
309
|
|
|
303
310
|
// Text inside image
|
|
304
311
|
this._createElement({
|
|
@@ -308,7 +315,16 @@ export default class GUI {
|
|
|
308
315
|
})
|
|
309
316
|
|
|
310
317
|
if (typeof callback == 'function') {
|
|
311
|
-
image.onclick = () =>
|
|
318
|
+
image.onclick = () => {
|
|
319
|
+
let selected = this.imageContainer.querySelectorAll('.p-gui__image--selected');
|
|
320
|
+
for (let i = 0; i < selected.length; i++) {
|
|
321
|
+
selected[i].classList.remove('p-gui__image--selected');
|
|
322
|
+
}
|
|
323
|
+
if (selectionBorder) {
|
|
324
|
+
image.classList.add('p-gui__image--selected');
|
|
325
|
+
}
|
|
326
|
+
callback({ path, text: name });
|
|
327
|
+
};
|
|
312
328
|
}
|
|
313
329
|
}
|
|
314
330
|
|
package/src/styles.js
CHANGED
|
@@ -113,6 +113,19 @@ export default function( position_type ) {
|
|
|
113
113
|
position: relative;
|
|
114
114
|
margin-top: 1px;
|
|
115
115
|
margin-bottom: 19px;
|
|
116
|
+
border-radius: var(--main-border-radius);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.p-gui__image--selected::after {
|
|
120
|
+
position: absolute;
|
|
121
|
+
top: 0;
|
|
122
|
+
left: 0;
|
|
123
|
+
width: 100%;
|
|
124
|
+
height: 100%;
|
|
125
|
+
content: '';
|
|
126
|
+
border: 1px solid #06FF89;
|
|
127
|
+
box-sizing: border-box;
|
|
128
|
+
border-radius: var(--main-border-radius);
|
|
116
129
|
}
|
|
117
130
|
|
|
118
131
|
.p-gui__image-text {
|