fix freemem bug from stacks refactor
This commit is contained in:
parent
7cfd26747c
commit
505fda6b2a
2 changed files with 9 additions and 4 deletions
|
|
@ -5,12 +5,12 @@
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
class Stack {
|
class Stack {
|
||||||
constructor(view) {
|
constructor(view, freeMem) {
|
||||||
this._view = view;
|
this._view = view;
|
||||||
this.view = view.newGroup();
|
this.view = view.newGroup();
|
||||||
this.slices = [];
|
this.slices = [];
|
||||||
this.meshes = [];
|
this.meshes = [];
|
||||||
this.freeMem = true;
|
this.freeMem = freeMem;
|
||||||
}
|
}
|
||||||
|
|
||||||
size() {
|
size() {
|
||||||
|
|
@ -36,6 +36,10 @@
|
||||||
this.view = this.slices = this.meshes = null;
|
this.view = this.slices = this.meshes = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setFreeMem(bool) {
|
||||||
|
this.freeMem = bool;
|
||||||
|
}
|
||||||
|
|
||||||
setVisible(newMin, newMax) {
|
setVisible(newMin, newMax) {
|
||||||
this.show();
|
this.show();
|
||||||
for (let i=0, s=this.slices, len=s.length; i<len; i++) {
|
for (let i=0, s=this.slices, len=s.length; i<len; i++) {
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
let KIRI = self.kiri,
|
let KIRI = self.kiri,
|
||||||
stacks = {},
|
|
||||||
freeMem = true,
|
freeMem = true,
|
||||||
|
stacks = {},
|
||||||
tallest = 0,
|
tallest = 0,
|
||||||
min = 0,
|
min = 0,
|
||||||
max = 0,
|
max = 0,
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function setFreeMem(bool) {
|
function setFreeMem(bool) {
|
||||||
|
Object.values(stacks).forEach(stack => stack.obj.setFreeMem(bool));
|
||||||
freeMem = bool;
|
freeMem = bool;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
@ -57,7 +58,7 @@
|
||||||
}
|
}
|
||||||
const stack = stacks[name] = {
|
const stack = stacks[name] = {
|
||||||
layers: [ ],
|
layers: [ ],
|
||||||
obj: new KIRI.Stack(view),
|
obj: new KIRI.Stack(view, freeMem),
|
||||||
add: function(layers) {
|
add: function(layers) {
|
||||||
let map = stack.obj.addLayers(layers);
|
let map = stack.obj.addLayers(layers);
|
||||||
for (const [label, mats] of Object.entries(map)) {
|
for (const [label, mats] of Object.entries(map)) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue