Commit ff290175 authored by jose.ignacio.fagian's avatar jose.ignacio.fagian
Browse files

fix 3d chart dissapear bug, fix click outside directive

parent 4dc37e1e
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -3611,7 +3611,8 @@
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"aproba": {
"version": "1.2.0",
......@@ -3632,12 +3633,14 @@
"balanced-match": {
"version": "1.0.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
......@@ -3652,17 +3655,20 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"core-util-is": {
"version": "1.0.2",
......@@ -3779,7 +3785,8 @@
"inherits": {
"version": "2.0.3",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"ini": {
"version": "1.3.5",
......@@ -3791,6 +3798,7 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
......@@ -3805,6 +3813,7 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
......@@ -3812,12 +3821,14 @@
"minimist": {
"version": "0.0.8",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"minipass": {
"version": "2.2.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.1",
"yallist": "^3.0.0"
......@@ -3836,6 +3847,7 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
......@@ -3916,7 +3928,8 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"object-assign": {
"version": "4.1.1",
......@@ -3928,6 +3941,7 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"wrappy": "1"
}
......@@ -4013,7 +4027,8 @@
"safe-buffer": {
"version": "5.1.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"safer-buffer": {
"version": "2.1.2",
......@@ -4049,6 +4064,7 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
......@@ -4068,6 +4084,7 @@
"version": "3.0.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
......@@ -4111,12 +4128,14 @@
"wrappy": {
"version": "1.0.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"yallist": {
"version": "3.0.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
}
}
},
......@@ -4390,13 +4409,6 @@
"integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=",
"dev": true
},
"graph3D": {
"version": "git://github.com/ifagian/graph3D.git#79bb55dedbaf4e3b853f138acf4409b6bbcb4d07",
"from": "git://github.com/ifagian/graph3D.git#master",
"requires": {
"three": "^0.90.0"
}
},
"handle-thing": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-1.2.5.tgz",
......@@ -10297,11 +10309,6 @@
"execa": "^0.7.0"
}
},
"three": {
"version": "0.90.0",
"resolved": "https://registry.npmjs.org/three/-/three-0.90.0.tgz",
"integrity": "sha512-sCTgOp/0ITLy0bsUoNeUROq2Tt1G0+StfRBs9ljFTENRF5JkKlTjZ+RWSH6qyq6O3c5fDKRupfuqZE/+LbETiA=="
},
"through": {
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
......
{
"name": "sb-admin-angular4-bootstrap4",
"version": "1.0.0",
"name": "matefun",
"version": "2.0.1",
"license": "MIT",
"scripts": {
"ng": "ng",
......
......@@ -2,7 +2,7 @@
<div class="container-fluid" style=" padding-left: 0px; padding-right: 0px; margin-top: -13px; margin-left: -6px; margin-right: -6px;">
<div class="row">
<div class="col-md-6">
<ngb-tabset [destroyOnHide]=false>
<ngb-tabset [destroyOnHide]=false (tabChange)="onChangeTab($event)">
<ngb-tab id="ProgramBtn"title="Programa">
<ng-template ngbTabContent>
......@@ -129,5 +129,6 @@
</div>
</div>
<span class="version">v{{version}}</span>
</div>
......@@ -3,3 +3,8 @@
height: 100% !important;
}
.version {
position: absolute;
font-size: 11px;
right: 0;
}
\ No newline at end of file
......@@ -43,6 +43,8 @@ import 'codemirror/addon/edit/matchbrackets';
import './codemirror/matefun-mode-ES.js'
import './codemirror/matefun-mode-EN.js'
import * as npm from './../../../../package.json'
var codeMirrorRef:any;
var componentRef : any;
var focus: any;
......@@ -89,7 +91,7 @@ export class MateFunComponent {
fontSize: 12
};
themes = ['3024-day', '3024-night', 'abcdef', 'ambiance-mobile', 'ambiance', 'base16-dark', 'base16-light', 'bespin', 'blackboard', 'cobalt', 'colorforth', 'dracula', 'duotone-dark', 'duotone-light', 'eclipse', 'elegant', 'erlang-dark', 'hopscotch', 'icecoder', 'isotope', 'lesser-dark', 'liquibyte', 'material', 'mbo', 'mdn-like', 'midnight', 'monokai', 'neat', 'neo', 'night', 'panda-syntax', 'paraiso-dark', 'paraiso-light', 'pastel-on-dark', 'railscasts', 'rubyblue', 'seti', 'solarized', 'the-matrix', 'tomorrow-night-bright', 'tomorrow-night-eighties', 'ttcn', 'twilight', 'vibrant-ink', 'xq-dark', 'xq-light', 'yeti', 'zenburn']
version: string = npm.version;
constructor(
private haskellService: HaskellService,
......@@ -605,6 +607,11 @@ export class MateFunComponent {
});
}
onChangeTab(event) {
if (event.nextId == 'FigurasBtn3D') {
this.graph3DComp.onActivate();
}
}
}
......@@ -12,8 +12,6 @@ import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { NotificacionModule } from '../../notificacion/notificacion.module';
import { Graph2DModule } from '../plotter/graph2D/graph2D.module';
import { Graph3DModule } from '../plotter/graph3D/graph3D.module';
import { ClosePopoverOnOutsideClickDirective } from '../../shared/utils/closePopoverDirective';
@NgModule({
imports: [
......@@ -35,8 +33,7 @@ import { ClosePopoverOnOutsideClickDirective } from '../../shared/utils/closePop
declarations: [
MateFunComponent,
ConfirmComponent,
SeleccionarDirectorioComp,
ClosePopoverOnOutsideClickDirective
SeleccionarDirectorioComp
],
exports: [MateFunComponent]
})
......
......@@ -38,7 +38,7 @@
<button id="settings"
class="btn btn-sm btn-secondary btn-setting"
placement="bottom"
closePopoverOnOutsideClick
closePopoverDirective
[ngbPopover]=popoverCanvas
popoverTitle="Configuración"
#popover="ngbPopover"
......
......@@ -4,9 +4,10 @@ import { RouterModule } from '@angular/router';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { FormsModule } from '@angular/forms';
import { Graph2DComponent } from './graph2D.component';
import { DirectivesModule } from '../../../shared/directives/directives.module';
@NgModule({
imports: [FormsModule, RouterModule, CommonModule, NgbModule],
imports: [FormsModule, RouterModule, CommonModule, NgbModule, DirectivesModule],
declarations: [Graph2DComponent],
exports: [Graph2DComponent],
})
......
......@@ -55,7 +55,7 @@
</button>
<button
closePopoverOnOutsideClick
closePopoverDirective
class="btn btn-sm btn-secondary"
placement="bottom"
[ngbPopover]=popoverAxesSize
......@@ -150,10 +150,9 @@
</button>
<button
[ngbPopover]=popoverConfig
closePopoverOnOutsideClick
[ngbPopover]=popoverConfig
closePopoverDirective
placement="bottom"
tiggers="click"
class="btn btn-sm btn-secondary"
popoverTitle="Configuración"
......
......@@ -28,21 +28,24 @@ export class Graph3DComponent implements AfterViewInit {
};
constructor(ghciService: GHCIService, private zone: NgZone) {
const self = this;
this.ghciServiceSub = ghciService.messages.subscribe(
message => {
if (message.tipo == "canvas3D") {
const figures = JSON.parse(formatJSON(message.resultado));
self.clear();
graph3DLib.drawFigures(figures);
}
else if (message.tipo == "animacion3D") {
const frames = message.resultado.map((frame) => JSON.parse(formatJSON(frame)));
self.clear();
this.animationProps.visible = true;
this.animationProps.playing = true;
this.animationProps.value = 0;
graph3DLib.clear();
graph3DLib.initializeAnimation(frames,
(value) => this.animationProps.value = value
);
......@@ -54,14 +57,8 @@ export class Graph3DComponent implements AfterViewInit {
}
ngAfterViewInit() {
// this.zone.runOutsideAngular(() => {
graph3DLib.initialize(this.graph3DRef.nativeElement, true);
(function render() {
console.info("ngAfterViewInit: ####### FIRED");
//requestAnimationFrame(render);
graph3DLib.forceUpdateRenderer();
}());
//this.zone.runOutsideAngular(() => {
graph3DLib.initialize(this.graph3DRef.nativeElement);
//})
}
......@@ -71,10 +68,17 @@ export class Graph3DComponent implements AfterViewInit {
}
}
onResize(event){
const {width, height} = this.graph3DRef.nativeElement.getBoundingClientRect();
onActivate() {
setTimeout(() => {
this.onResize(null);
})
}
graph3DLib.changeSize({width, height});
onResize(event){
const {width, height} = this.graph3DRef.nativeElement.getBoundingClientRect();
if (width > 0 && height > 0)
graph3DLib.changeSize({width, height});
}
onAnimationChangeSpeed = (value) => {
......
......@@ -5,10 +5,11 @@ import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { FormsModule } from '@angular/forms';
import { Graph3DComponent } from './graph3D.component';
import { AnimationControlComponent } from '../animation-control/animation-control.component';
import { DirectivesModule } from '../../../shared/directives/directives.module';
@NgModule({
imports: [FormsModule, RouterModule, CommonModule, NgbModule],
imports: [FormsModule, RouterModule, CommonModule, NgbModule, DirectivesModule],
declarations: [
AnimationControlComponent,
Graph3DComponent
......
......@@ -3,9 +3,9 @@ import { NgbPopover } from '@ng-bootstrap/ng-bootstrap';
import { NgbPopoverWindow } from '@ng-bootstrap/ng-bootstrap/popover/popover';
@Directive({
selector: '[closePopoverOnOutsideClick][ngbPopover]'
selector: '[closePopoverDirective][ngbPopover]'
})
export class ClosePopoverOnOutsideClickDirective {
export class ClosePopoverDirective {
constructor(private elementRef: ElementRef,
private ngbPopover: NgbPopover) {
......
import { NgModule } from '@angular/core';
import { ClosePopoverDirective } from './closePopover.directive';
@NgModule({
imports: [],
declarations: [ClosePopoverDirective],
exports: [ClosePopoverDirective]
})
export class DirectivesModule { }
......@@ -3,3 +3,5 @@ declare var module: NodeModule;
interface NodeModule {
id: string;
}
declare module '*.json';
\ No newline at end of file
......@@ -10,7 +10,8 @@
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
"node_modules/@types",
"./src/typings.d.ts"
],
"lib": [
"es2016",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment