Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

recalibrated the bezier path width and height compensation #1420

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions octoprint_mrbeam/static/js/design_store.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ $(function () {
if (
token !== "" &&
oldToken !== token &&
currentUserSettings?.mrbeam?.user_token
currentUserSettings?.mrbeam
) {
delete currentUserSettings["mrbeam"]["user_token"];
currentUserSettings["mrbeam"][
Expand All @@ -187,7 +187,7 @@ $(function () {
if (
lastUploaded !== "" &&
oldLastUploaded !== lastUploaded &&
currentUserSettings?.mrbeam?.design_store_last_uploaded
currentUserSettings?.mrbeam
) {
delete currentUserSettings["mrbeam"][
"design_store_last_uploaded"
Expand Down
55 changes: 32 additions & 23 deletions octoprint_mrbeam/static/js/helpers/quick_shape_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class QuickShapeHelper {
var step = (2 * Math.PI) / c;
var ri = (1 - sh) * r;
for (var i = 0; i < c; i++) {
var angle_outer = i * step;
var angle_outer = i * step - Math.PI / 2; // -Math.PI/2 rotates 90deg
var angle_inner = angle_outer + step / 2;
var pox = Math.cos(angle_outer) * r;
var poy = Math.sin(angle_outer) * r;
Expand All @@ -132,8 +132,8 @@ class QuickShapeHelper {
// \ /
// \ /
// a
var dx = (w / 5) * 0.78;
var dy = (h / 5) * 0.96;
var dx = (w / 5) * 0.89686;
var dy = (h / 5) * 1.0444;
var q = 0.552284749831; // circle approximation with cubic beziers: (4/3)*tan(pi/8) = 0.552284749831
var rx = dx;
var ry = dy;
Expand Down Expand Up @@ -162,7 +162,7 @@ class QuickShapeHelper {
var a1 = [f[0] + dx / 2, f[1] + dy / 2];
var a2 = [a[0] - dx + lr * dx, a[1] - dy];

var d =
var out =
"M" +
a.join(",") +
"C" +
Expand Down Expand Up @@ -201,26 +201,35 @@ class QuickShapeHelper {
a2.join(",") +
" " +
a.join(",") +
// // Debug bezier handles
// +'M' + a.join(',')
// + 'L' + b1.join(',')
// + 'M' + a.join(',')
// + 'L' + a2.join(',')
//
// + 'M' + c.join(',')
// + 'L' + d1.join(',')
// + 'M' + d.join(',')
// + 'L' + d2.join(',')
//
// + 'M' + e1.join(',')
// + 'L' + e.join(',')
// + 'L' + e2.join(',')
//
// + 'M' + f1.join(',')
// + 'L' + f.join(',')
// + 'L' + f2.join(',')
"z";
return d;

/** Debug bezier handles
out +=
'M' + a2.join(',') +
'L' + a.join(',') +
'L' + b1.join(',') +

'M' + b2.join(',') +
'L' + b.join(',') +
'L' + c1.join(',') +

'M' + c2.join(',') +
'L' + c.join(',') +
'L' + d1.join(',') +

'M' + d2.join(',') +
'L' + d.join(',') +
'L' + e1.join(',') +

'M' + e2.join(',') +
'L' + e.join(',') +
'L' + f1.join(',') +

'M' + f2.join(',') +
'L' + f.join(',') +
'L' + a1.join(',');
*/
return out;
}

static getTextPath(
Expand Down