Skip to content

Commit a16917e

Browse files
author
Adam Argyle
committed
restores distance elements on box model visuals
1 parent 46cc8bf commit a16917e

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

app/components/selection/box-model.element.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ export class BoxModel extends HTMLElement {
9292
if (mode === 'margin') {
9393
if (sides.top) {
9494
this.createMeasurement({
95-
x: bounds.left + (bounds.width / 2) - offset,
96-
y: bounds.top - sides.top - (sides.top < pill_height ? pill_height - sides.top : 0),
95+
x: (bounds.width / 2) - offset,
96+
y: (window.scrollY * -1) - sides.top,
9797
d: sides.top,
9898
q: 'top',
9999
v: true,
@@ -102,8 +102,8 @@ export class BoxModel extends HTMLElement {
102102
}
103103
if (sides.bottom) {
104104
this.createMeasurement({
105-
x: bounds.left + (bounds.width / 2) - offset,
106-
y: bounds.bottom,
105+
x: (bounds.width / 2) - offset,
106+
y: (window.scrollY * -1) + bounds.height,
107107
d: sides.bottom,
108108
q: 'bottom',
109109
v: true,
@@ -112,8 +112,8 @@ export class BoxModel extends HTMLElement {
112112
}
113113
if (sides.right) {
114114
this.createMeasurement({
115-
x: bounds.right,
116-
y: bounds.top + (bounds.height / 2) - offset,
115+
x: bounds.width,
116+
y: (window.scrollY * -1) + (bounds.height / 2) - offset,
117117
d: sides.right,
118118
q: 'right',
119119
v: false,
@@ -122,8 +122,8 @@ export class BoxModel extends HTMLElement {
122122
}
123123
if (sides.left) {
124124
this.createMeasurement({
125-
x: win_width - bounds.left,
126-
y: bounds.top + (bounds.height / 2) - offset,
125+
x: bounds.width,
126+
y: (window.scrollY * -1) + (bounds.height / 2) - offset,
127127
d: sides.left,
128128
q: 'left',
129129
v: false,
@@ -134,8 +134,8 @@ export class BoxModel extends HTMLElement {
134134
else if (mode === 'padding') {
135135
if (sides.top) {
136136
this.createMeasurement({
137-
x: bounds.left + (bounds.width / 2) - offset,
138-
y: bounds.top - (sides.top < pill_height ? pill_height - sides.top : 0),
137+
x: (bounds.width / 2) - offset,
138+
y: (window.scrollY * -1),
139139
d: sides.top,
140140
q: 'top',
141141
v: true,
@@ -144,8 +144,8 @@ export class BoxModel extends HTMLElement {
144144
}
145145
if (sides.bottom) {
146146
this.createMeasurement({
147-
x: bounds.left + (bounds.width / 2) - offset,
148-
y: bounds.bottom - sides.bottom,
147+
x: (bounds.width / 2) - offset,
148+
y: (window.scrollY * -1) + (bounds.height - sides.bottom),
149149
d: sides.bottom,
150150
q: 'bottom',
151151
v: true,
@@ -154,8 +154,8 @@ export class BoxModel extends HTMLElement {
154154
}
155155
if (sides.right) {
156156
this.createMeasurement({
157-
x: bounds.right - sides.right,
158-
y: bounds.top + (bounds.height / 2) - offset,
157+
x: bounds.width - sides.right,
158+
y: (window.scrollY * -1) + (bounds.height / 2) - offset,
159159
d: sides.right,
160160
q: 'right',
161161
v: false,
@@ -164,8 +164,8 @@ export class BoxModel extends HTMLElement {
164164
}
165165
if (sides.left) {
166166
this.createMeasurement({
167-
x: win_width - bounds.left - sides.left,
168-
y: bounds.top + (bounds.height / 2) - offset,
167+
x: bounds.width - sides.left,
168+
y: (window.scrollY * -1) + (bounds.height / 2) - offset,
169169
d: sides.left,
170170
q: 'left',
171171
v: false,

0 commit comments

Comments
 (0)