enable pluggable infill module development
This commit is contained in:
parent
73271daf0a
commit
73fc4dee3d
4 changed files with 20 additions and 1 deletions
|
|
@ -20,6 +20,11 @@ var gs_kiri_fill = exports;
|
|||
gyroid: fillGyroid,
|
||||
triangle: fillTriangle,
|
||||
linear: fillLinear
|
||||
},
|
||||
CACHE = self.kiri.fill_fixed = {
|
||||
hex: fillHexFull,
|
||||
grid: fillGrid,
|
||||
triangle: fillTriangle
|
||||
};
|
||||
|
||||
function fillHexFull(target) {
|
||||
|
|
|
|||
|
|
@ -1053,6 +1053,8 @@ var gs_kiri_init = exports;
|
|||
// MAIN INITIALIZATION FUNCTION
|
||||
|
||||
function init_one() {
|
||||
API.event.emit('init.one');
|
||||
|
||||
// ensure we have settings from last session
|
||||
API.conf.restore();
|
||||
|
||||
|
|
@ -1716,6 +1718,8 @@ var gs_kiri_init = exports;
|
|||
// SECOND STAGE INIT AFTER UI RESTORED
|
||||
|
||||
function init_two() {
|
||||
API.event.emit('init.two');
|
||||
|
||||
let current = settings(),
|
||||
control = current.controller;
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ let gs_kiri_slice = exports;
|
|||
|
||||
let KIRI = self.kiri,
|
||||
FILL = KIRI.fill,
|
||||
FILLFIXED = KIRI.fill_fixed,
|
||||
BASE = self.base,
|
||||
UTIL = BASE.util,
|
||||
POLY = BASE.polygons,
|
||||
|
|
@ -675,6 +676,8 @@ let gs_kiri_slice = exports;
|
|||
line = [],
|
||||
// callback passed to pluggable infill algorithm
|
||||
target = {
|
||||
slice: function() { return scope },
|
||||
options: function() { return options },
|
||||
lineWidth: function() { return options.lineWidth },
|
||||
bounds: function() { return bounds },
|
||||
zIndex: function() { return scope.index },
|
||||
|
|
@ -709,7 +712,7 @@ let gs_kiri_slice = exports;
|
|||
|
||||
scope._fill_finger = POLY.fingerprint(polys);
|
||||
|
||||
let skippable = type !== 'gyroid' && type !== 'linear';
|
||||
let skippable = FILLFIXED[type] ? true : false;
|
||||
let miss = false;
|
||||
// if the layer below has the same fingerprint, we may be able to clone its infill
|
||||
if (skippable && scope.fingerprintSame(down)) {
|
||||
|
|
|
|||
|
|
@ -464,9 +464,16 @@ function addCorsHeaders(req, res) {
|
|||
*/
|
||||
function handleDebug(req, res, next) {
|
||||
if (debug) {
|
||||
let ext = req.url.split('.').pop();
|
||||
let type = {
|
||||
'html': 'text/html',
|
||||
'js': 'application/javascript'
|
||||
}[ext] || 'application/unknown';
|
||||
if (lastmod(req.url)) {
|
||||
res.setHeader('Content-Type',type);
|
||||
return res.end(fs.readFileSync(req.url));
|
||||
} else if (lastmod(req.url.substring(1))) {
|
||||
res.setHeader('Content-Type','application/javascript');
|
||||
return res.end(fs.readFileSync(req.url.substring(1)));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue