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() {
|
||||
|
||||
class Stack {
|
||||
constructor(view) {
|
||||
constructor(view, freeMem) {
|
||||
this._view = view;
|
||||
this.view = view.newGroup();
|
||||
this.slices = [];
|
||||
this.meshes = [];
|
||||
this.freeMem = true;
|
||||
this.freeMem = freeMem;
|
||||
}
|
||||
|
||||
size() {
|
||||
|
|
@ -36,6 +36,10 @@
|
|||
this.view = this.slices = this.meshes = null;
|
||||
}
|
||||
|
||||
setFreeMem(bool) {
|
||||
this.freeMem = bool;
|
||||
}
|
||||
|
||||
setVisible(newMin, newMax) {
|
||||
this.show();
|
||||
for (let i=0, s=this.slices, len=s.length; i<len; i++) {
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
(function() {
|
||||
|
||||
let KIRI = self.kiri,
|
||||
stacks = {},
|
||||
freeMem = true,
|
||||
stacks = {},
|
||||
tallest = 0,
|
||||
min = 0,
|
||||
max = 0,
|
||||
|
|
@ -20,6 +20,7 @@
|
|||
}
|
||||
|
||||
function setFreeMem(bool) {
|
||||
Object.values(stacks).forEach(stack => stack.obj.setFreeMem(bool));
|
||||
freeMem = bool;
|
||||
return this;
|
||||
}
|
||||
|
|
@ -57,7 +58,7 @@
|
|||
}
|
||||
const stack = stacks[name] = {
|
||||
layers: [ ],
|
||||
obj: new KIRI.Stack(view),
|
||||
obj: new KIRI.Stack(view, freeMem),
|
||||
add: function(layers) {
|
||||
let map = stack.obj.addLayers(layers);
|
||||
for (const [label, mats] of Object.entries(map)) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue