fix sending snap twice
This commit is contained in:
parent
844cbc22a0
commit
d148fe6ae7
1 changed files with 14 additions and 5 deletions
|
|
@ -31,6 +31,14 @@ function send(fn, data, onreply, async, zerocopy) {
|
||||||
}
|
}
|
||||||
|
|
||||||
KIRI.work = {
|
KIRI.work = {
|
||||||
|
newWorker: function() {
|
||||||
|
if (self.createWorker) {
|
||||||
|
return self.createWorker();
|
||||||
|
} else {
|
||||||
|
return new Worker(`/code/worker.js?${self.kiri.version}`);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
isSlicing : function() {
|
isSlicing : function() {
|
||||||
let current = 0;
|
let current = 0;
|
||||||
for (let key in slicing) {
|
for (let key in slicing) {
|
||||||
|
|
@ -50,14 +58,15 @@ KIRI.work = {
|
||||||
|
|
||||||
slicing = {};
|
slicing = {};
|
||||||
running = {};
|
running = {};
|
||||||
worker = new Worker(`/code/worker.js?${self.kiri.version}`);
|
worker = KIRI.work.newWorker();
|
||||||
|
|
||||||
worker.onmessage = function(e) {
|
worker.onmessage = function(e) {
|
||||||
let now = time(),
|
let now = time(),
|
||||||
reply = e.data,
|
reply = e.data,
|
||||||
record = running[reply.seq],
|
record = running[reply.seq],
|
||||||
onreply = record.fn;
|
onreply = record.fn;
|
||||||
// console.log('recv', reply.data)
|
|
||||||
|
// console.log('recv', reply.data)
|
||||||
if (reply.done) {
|
if (reply.done) {
|
||||||
delete running[reply.seq];
|
delete running[reply.seq];
|
||||||
}
|
}
|
||||||
|
|
@ -100,8 +109,8 @@ KIRI.work = {
|
||||||
centerz = (bbox2.max.z - bbox2.min.z)/2;
|
centerz = (bbox2.max.z - bbox2.min.z)/2;
|
||||||
movez = centerz - (bbox1.max.z - bbox1.min.z)/2;
|
movez = centerz - (bbox1.max.z - bbox1.min.z)/2;
|
||||||
}
|
}
|
||||||
let vertices = widget.getGeoVertices().buffer.slice(0),
|
let vertices = widget.getGeoVertices().buffer.slice(0);
|
||||||
snapshot = KIRI.api.view.snapshot;
|
// snapshot = KIRI.api.view.snapshot;
|
||||||
if (rotation) {
|
if (rotation) {
|
||||||
widget._rotate(0,-rotation,0,true);
|
widget._rotate(0,-rotation,0,true);
|
||||||
widget.center();
|
widget.center();
|
||||||
|
|
@ -113,7 +122,7 @@ KIRI.work = {
|
||||||
vertices: vertices,
|
vertices: vertices,
|
||||||
position: widget.mesh.position,
|
position: widget.mesh.position,
|
||||||
tracking: widget.track,
|
tracking: widget.track,
|
||||||
snapshot: snapshot,
|
// snapshot: snapshot,
|
||||||
// for rotation / unrotation
|
// for rotation / unrotation
|
||||||
state: {
|
state: {
|
||||||
rotation: rotation,
|
rotation: rotation,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue