Skip to content

Commit

Permalink
Update webapp
Browse files Browse the repository at this point in the history
  • Loading branch information
tyt2y3 committed May 29, 2024
1 parent f35df1f commit 148328d
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 70 deletions.
12 changes: 6 additions & 6 deletions docs/0.bootstrap.js

Large diffs are not rendered by default.

Binary file added docs/1ea3f1b97c566154f2b2.module.wasm
Binary file not shown.
Binary file removed docs/589cb57662b50620abca.module.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/COPYRIGHT

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

116 changes: 58 additions & 58 deletions docs/bootstrap.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion webapp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ console_log = { version = "0.2", features = ["color"] }
wasm-bindgen = { version = "0.2", features = ["serde-serialize"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
visioncortex = "0.6.0"
visioncortex = "0.8.1"

# The `console_error_panic_hook` crate provides better debugging of panics by
# logging them with `console.error`. This is great for development, but requires
Expand Down
8 changes: 6 additions & 2 deletions webapp/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ document.addEventListener('paste', function (e) {

// Download as SVG
document.getElementById('export').addEventListener('click', function (e) {
const blob = new Blob([new XMLSerializer().serializeToString(svg)], {type: 'octet/stream'}),
const blob = new Blob([
`<?xml version="1.0" encoding="UTF-8"?>\n`,
`<!-- Generator: visioncortex VTracer -->\n`,
new XMLSerializer().serializeToString(svg)
], {type: 'octet/stream'}),
url = window.URL.createObjectURL(blob);

this.href = url;
Expand Down Expand Up @@ -444,7 +448,7 @@ class ConverterRunner {
this.converter.init();
this.stopped = false;
if (clustering_mode == 'binary') {
svg.style.background = '#000';
svg.style.background = '#fff';
canvas.style.display = 'none';
} else {
svg.style.background = '';
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/conversion/binary_image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl BinaryImageConverter {
self.params.max_iterations,
self.params.splice_threshold
);
let color = Color::color(&ColorName::White);
let color = Color::color(&ColorName::Black);
self.svg.prepend_path(
&paths,
&color,
Expand Down
6 changes: 5 additions & 1 deletion webapp/src/conversion/color_image.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use wasm_bindgen::prelude::*;
use visioncortex::PathSimplifyMode;
use visioncortex::color_clusters::{IncrementalBuilder, Clusters, Runner, RunnerConfig, HIERARCHICAL_MAX};
use visioncortex::color_clusters::{Clusters, Runner, RunnerConfig, HIERARCHICAL_MAX, IncrementalBuilder, KeyingAction};

use crate::canvas::*;
use crate::svg::*;
Expand Down Expand Up @@ -78,6 +78,8 @@ impl ColorImageConverter {
is_same_color_b: 1,
deepen_diff: self.params.layer_difference,
hollow_neighbours: 1,
key_color: Default::default(),
keying_action: KeyingAction::Discard,
}, image);
self.stage = Stage::Clustering(runner.start());
}
Expand Down Expand Up @@ -108,6 +110,8 @@ impl ColorImageConverter {
is_same_color_b: 1,
deepen_diff: 0,
hollow_neighbours: 0,
key_color: Default::default(),
keying_action: KeyingAction::Discard,
}, image);
self.stage = Stage::Reclustering(runner.start());
},
Expand Down

0 comments on commit 148328d

Please sign in to comment.