Skip to content

Commit

Permalink
Merge branch 'master' into 61-stylize-ui-2
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanR712 authored Oct 17, 2023
2 parents 8f4244f + 8ba4265 commit a5bbd44
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions src/AtomMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,7 @@ export function atomMouseDown(event: MouseEvent) {
wasOut = false;
const currentAtom = new AtomNode(
identifier,
new Point(
event.clientX - offset.x,
event.clientY - atomMetrics.fontBoundingBoxDescent - offset.y
),
new Point(event.clientX - offset.x, event.clientY - offset.y),
atomMetrics.width,
atomMetrics.fontBoundingBoxDescent + atomMetrics.actualBoundingBoxAscent
);
Expand All @@ -75,10 +72,7 @@ export function atomMouseDown(event: MouseEvent) {
export function atomMouseMove(event: MouseEvent) {
const currentAtom = new AtomNode(
identifier,
new Point(
event.clientX - offset.x,
event.clientY - atomMetrics.fontBoundingBoxDescent - offset.y
),
new Point(event.clientX - offset.x, event.clientY - offset.y),
atomMetrics.width,
atomMetrics.fontBoundingBoxDescent + atomMetrics.actualBoundingBoxAscent
);
Expand All @@ -101,10 +95,7 @@ export function atomMouseMove(event: MouseEvent) {
export function atomMouseUp(event: MouseEvent) {
const currentAtom = new AtomNode(
identifier,
new Point(
event.clientX - offset.x,
event.clientY - atomMetrics.fontBoundingBoxDescent - offset.y
),
new Point(event.clientX - offset.x, event.clientY - offset.y),
atomMetrics.width,
atomMetrics.fontBoundingBoxDescent + atomMetrics.actualBoundingBoxAscent
);
Expand All @@ -130,7 +121,8 @@ export function atomMouseOut() {
* @param color the color of the atom.
*/
export function drawAtom(thisAtom: AtomNode, color: string) {
atomMetrics = ctx.measureText(identifier);
ctx.textBaseline = "bottom";
atomMetrics = ctx.measureText(thisAtom.identifier);
ctx.fillStyle = color;
ctx.strokeStyle = color;
ctx.beginPath();
Expand Down

0 comments on commit a5bbd44

Please sign in to comment.