Hey there, firstly thanks for providing this utility, I hope to use it to support kle layouts in an app that I am making.
I have had success so far with standard keymaps (planck, 60, 104) however once I use rotation and specifically rx and ry in a layout I get very different positioning.. wondering if you can shed some light on this for me, or if it is indeed a bug in kle-serial?
heres the simple map I am starting with:
[""],
[{r:30,x:1,rx:1},"",""]
Here it is on your site:
And here in my react app:
As you can see the positioning is off..
here is my code that is converting the key options into styles:
import React, { useMemo } from "react";
import "./Key.css";
const U = 54;
function Key({ opts }) {
const {
x,
y,
width,
height,
rotation_angle: ra,
rotation_x: rx,
rotation_y: ry,
} = opts;
const keyStyle = useMemo(() => {
const s = {};
if (ra) {
s.transform = `rotate(${ra}deg)`;
s.transformOrigin = `${rx * U}px ${ry * U}px`;
}
return s;
}, [ra, rx, ry]);
const outerStyle = useMemo(() => {
const s = {
width: U * width,
height: U * height,
left: U * x,
top: U * y,
};
return s;
}, [width, height, x, y]);
return (
<div style={keyStyle} className="key">
<div style={outerStyle} className="outer">
<div className="inner"></div>
</div>
</div>
);
}
export default Key;
Hey there, firstly thanks for providing this utility, I hope to use it to support kle layouts in an app that I am making.
I have had success so far with standard keymaps (planck, 60, 104) however once I use rotation and specifically rx and ry in a layout I get very different positioning.. wondering if you can shed some light on this for me, or if it is indeed a bug in kle-serial?
heres the simple map I am starting with:
Here it is on your site:
And here in my react app:
As you can see the positioning is off..
here is my code that is converting the key options into styles:
This results in the following markup (for key 2):
whereas the markup on the site looks like this:
I looked in the source for how this positioning is achieved and believe my example at least should have the same values
I'm not sure how I should get those left (2 unit) and top (0 unit) values, any help would be greatly appreciated!