mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-13 07:46:17 -08:00
add layer
This commit is contained in:
1 parent
e4518d21ce
commit
4327787895
15 files changed
+256
-134
No files matched your search
@@ -1,5 +1,62 @@
|
||||
export default class Contextmenu {
|
||||
constructor(art) {
|
||||
this.art = art;
|
||||
this.state = false;
|
||||
this.init();
|
||||
}
|
||||
|
||||
init() {
|
||||
this.art.layers.add({
|
||||
name: 'test1',
|
||||
html: 'test2',
|
||||
index: 10
|
||||
});
|
||||
this.art.layers.add({
|
||||
name: 'test3',
|
||||
html: 'test4',
|
||||
index: 11
|
||||
});
|
||||
const { option, i18n, refs, events: { proxy } } = this.art;
|
||||
option.contextmenu.push({
|
||||
text: i18n.get('Video info'),
|
||||
click: art => {
|
||||
console.log(art);
|
||||
}
|
||||
}, {
|
||||
text: i18n.get('About author'),
|
||||
link: 'https://github.com/zhw2590582'
|
||||
});
|
||||
|
||||
proxy(refs.$container, 'contextmenu', event => {
|
||||
event.preventDefault();
|
||||
if (!this.state) {
|
||||
this.creatMenu();
|
||||
this.state = true;
|
||||
}
|
||||
this.setPos(event);
|
||||
this.show();
|
||||
});
|
||||
|
||||
proxy(document, 'contextmenu', event => {
|
||||
if (!event.path.includes(refs.$container)) {
|
||||
this.hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
creatMenu() {
|
||||
console.log('creatMenu');
|
||||
}
|
||||
|
||||
setPos() {
|
||||
console.log('setPos');
|
||||
}
|
||||
|
||||
hide() {
|
||||
console.log('hide');
|
||||
}
|
||||
|
||||
show() {
|
||||
console.log('show');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user