class AplicativoOa3d extends Aplicativo {
antesCriar() {
super.antesCriar();
this.atualZ = this.dados.pe.zElemento;
this.objAtomo = undefined;
this.mostrar = true;
this.parado = true;
if (this.dados.pe.espichar === "1") {
this.camera.position.set(this.dados.pe.cpx,this.dados.pe.cpy,this.dados.pe.cpz);
this.camera.lookAt(0,0,0);
}
}
duranteCriar() {
super.duranteCriar();
this.cenario = new CenarioAtomicoBasicoPontos({
cpx: this.dados.pe.cpx,
cpy: this.dados.pe.cpy,
cpz: this.dados.pe.cpz,
zElemento: this.atualZ,
criar: true});
this.filme = new Filme({
cenario: this.cenario,
idContainer: "id-modelo-orbital-3d",
ativarEstatistica: false,
criar: true});
this.criarAtomo(this.dados.pe.zElemento);
}
depoisCriar() {
super.depoisCriar();
if (window.janela) window.janela.criarBotaoFechar("fechar.32x32.01a.png",32,32);
}
criarAtomo(novoZ) {
this.atualZ = novoZ;
this.objAtomo = new Atomo({
filme : this.filme,
cenario : this.cenario,
elementos : elementos,
numElemento : novoZ,
raios_atomicos_calculados_rac : raios_atomicos_calculados_rac,
cabec_rac : cabec_rac,
possuidor : this.cenario.cena,
usarAxis : true,
espichar : this.dados.espichar,
carregar : false,
tempoEspera : 100,
criar: true});
}
animar() {
this.autoRotacionar = false;
this.filme.iniciarEstatistica();
if (this.autoRotacionar && this.objAtomo.orbitaisCarregados) {
this.objAtomo.atomo3d.rotation.x += 0.05;
this.objAtomo.atomo3d.rotation.y += 0.05;
this.objAtomo.atomo3d.rotation.z += 0.05;
}
if (this.objAtomo.continuarCarregando) {
this.objAtomo.verificarCarregamentoOrbital();
} else {
this.objAtomo.movimentarEletrons();
}
this.filme.renderizar();
this.filme.finalizarEstatistica();
}
onWindowResize() {
this.filme.camera.aspect = window.innerWidth / window.innerHeight;
this.app.filme.camera.updateProjectionMatrix();
this.app.filme.renderer.setSize(window.innerWidth,window.innerHeight);
}
onWindowUnload() {
}
carregarDadosElemento(){
var indice = this.atualZ-1;
var elemento = dadosElementos[simbolosElementos[indice]];
for (var dado in elemento) {
var htmlDado = document.getElementById('dado_el_'+dado+'_id_val');
if (htmlDado) {
htmlDado.innerHTML = elemento[dado];
}
}
}
dadosElementoTransparente() {
this.parado = false;
$("#dados_el_id_todos").fadeOut(2000,"swing",function(a,b,c,d){
this.parado = true;
this.mostrar = true;
$("#id-botao-ver-dados-elemento").fadeIn(2000,"swing",function(){
$("#dados_el_id_modal").on("click",function(){
if (this.parado) if (this.mostrar) this.dadosElementoOpaco(); else this.dadosElementoTransparente();
});
$("#id-botao-ver-dados-elemento").on("click",function(){
if (this.parado) if (this.mostrar) this.dadosElementoOpaco();
});
$(".elemento").on("click",function(evento){
this.objAtomo.destruir();
this.objAtomo = undefined;
this.criarAtomo(evento.currentTarget.attributes.z.nodeValue)
});
});
});
}
tabelaPeriodicaOpaco(){
this.parado = false;
$("#id-botao-ver-tabela-periodica").fadeOut(2000,"swing",function(){
$("#id-tabela-periodica").fadeIn(2000,"swing",function(){
this.parado = true; this.mostrar = false
});
});
}
tabelaPeriodicaTransparente() {
this.parado = false;
$("#id-tabela-periodica").fadeOut(2000,"swing",function(){
this.parado = true;
this.mostrar = true;
$("#id-botao-ver-tabela-periodica").fadeIn(2000,"swing",function(){
$("#id-tabela-periodica").on("click",function(){
if (this.parado) if (this.mostrar) this.tabelaPeriodicaOpaco(); else this.tabelaPeriodicaTransparente();
});
$("#id-botao-ver-tabela-periodica").on("click",function(){
if (this.parado) if (this.mostrar) this.tabelaPeriodicaOpaco();
});
});
});
}
dadosElementoOpaco() {
this.parado = false;
$("#id-botao-ver-dados-elemento").fadeOut(2000,"swing",function(){
$("#dados_el_id_todos").fadeIn(2000,"swing",function(){
this.parado = true; this.mostrar = false
});
});
}
aumentar() {
this.parado = false;
$("#dados_el_id_modal").animate({right: "10px"},2000,"swing",function(){
this.parado = true;
this.mostrar = false
});
}
diminuir() {
this.parado = false;
$("#dados_el_id_modal").animate({right: "-370px"},2000,"swing",function(){
this.parado = true;
this.mostrar = true;
$("#dados_el_id_modal").on("click",function(){
if (this.parado)
if (this.mostrar)
this.aumentar();
else
this.diminuir();
});
});
}
}