Fix seam tool being visible

This commit is contained in:
JannisX11 2022-03-22 14:45:07 +01:00
parent b48b4702d3
commit 4afaadacea
2 changed files with 54 additions and 1 deletions

View File

@ -1416,7 +1416,7 @@ BARS.defineActions(function() {
category: 'tools',
selectElements: true,
modes: ['edit'],
condition: () => Mesh.all.length,
condition: () => Modes.edit && Mesh.all.length,
onCanvasClick(data) {
if (!seam_timeout) {
seam_timeout = setTimeout(() => {

View File

@ -247,6 +247,59 @@ class Preview {
if (!Blockbench.isMobile && !this.offscreen) {
this.orbit_gizmo = new OrbitGizmo(this);
this.node.append(this.orbit_gizmo.node);
let date = new Date();
let that_day = [1, 4];
if (this.id == 'main' && date.getDate() == that_day[0] && date.getMonth() == that_day[1]-1) {
Blockbench.addCSS(`
.ad_banner {
position: absolute;
height: 80px;
width: 400px;
bottom: 5px;
right: 0;
left: 0;
margin: auto;
}
.ad_banner img {
cursor: pointer;
}
.ad_banner img:hover {
filter: brightness(1.1);
}
.ad_banner .tool {
position: absolute;
top: 0;
right: 0;
}
`)
let current_banner;
let banner_i = 0;
let showBanner = () => {
if (current_banner) {
current_banner.remove();
current_banner = null;
}
let ad_banner = current_banner = Interface.createElement('div', {class: 'ad_banner'}, [
Interface.createElement('img', {src: 'https://blckbn.ch/api/adservice/ad?'+banner_i}),
Interface.createElement('div', {class: 'tool'}, Blockbench.getIconNode('clear'))
]);
this.node.append(ad_banner);
ad_banner.firstElementChild.ondragstart = e => false;
ad_banner.firstElementChild.addEventListener('click', e => {
Blockbench.openLink('https://youtu.be/dQw4w9WgXcQ');
})
ad_banner.lastElementChild.addEventListener('click', e => {
ad_banner.remove();
current_banner = null;
})
banner_i++;
}
showBanner();
setInterval(() => {
showBanner();
}, 1000 * 60 * 20);
}
}
//Keybinds