✨ GCodeViewer: in-memory compression (#4435)

Individual commits:

* Add last position cache
* Must be lower than percentage of next level.
* Fully working version with jsonc compression
* Switch to pako.js for both speed and efficiency
* compressed code is now an instance of Uint8Array
* Temporary fix for rebuildLayerPercentageLookup and purgeEmptyLayers
* Fix merge issues
* Fix prettier
* Fix prettier
* Calculate empty layers and percentage of layer in doAnalyse
* Delete all state when doing clear()
* Delete all state when doing clear()
* Add options to control compression. Allow to enable compression from the warning page.
* Do not always turn on compression by default.
* Correctly calculate the rendererEmptyLayers array.
* Only show "force compression" if compression is not already enabled.
* pre-commit fixes
* Use correct index and fix merge issues.
* Add some comments.
* Update src/octoprint/plugins/gcodeviewer/templates/gcodeviewer_settings.jinja2 (Co-authored-by: Gina Häußge <gina@octoprint.org>)
* Move "Skip to this" up and make the threshold dependent on alwaysCompress setting.
* Remove redundant "Skip to this" (Co-authored-by: Gina Häußge <gina@octoprint.org>)
This commit is contained in:
JoveToo authored and GitHub committed 2022-06-27 16:57:16 +02:00
1 parent bfe40f0c74
commit 306e513ee3
9 files changed
+8338 -54

No files matched your search

@@ -17,6 +17,7 @@ class GcodeviewerPlugin(
"js/viewer/ui.js",
"js/viewer/reader.js",
"js/viewer/renderer.js",
"js/viewer/pako.js",
]
return {
@@ -47,6 +48,8 @@ class GcodeviewerPlugin(
"mobileSizeThreshold": 2 * 1024 * 1024, # 2MB
"sizeThreshold": 20 * 1024 * 1024, # 20MB
"skipUntilThis": None,
"alwaysCompress": False,
"compressionSizeThreshold": 200 * 1024 * 1024,
}
def get_settings_version(self):