Skip to content

Commit 9e45842

Browse files
committed
refactor: replace fits word with within word
1 parent a75361c commit 9e45842

File tree

3 files changed

+27
-27
lines changed

3 files changed

+27
-27
lines changed

src/dimension-observer.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ function createDimensionObserver(callback, {
4646

4747
let pathHeight = finishPoint - startPoint;
4848

49-
let isSideInnerFitsViewport = dim$sideInner.height + topSpacing + bottomSpacing < dim$viewport.height;
50-
let isSideInnerFitsPath = dim$sideInner.height < pathHeight;
49+
let isSideInnerWithinViewport = dim$sideInner.height + topSpacing + bottomSpacing < dim$viewport.height;
50+
let isSideInnerWithinPath = dim$sideInner.height < pathHeight;
5151

5252
let sideOuterHeight = Math.max(dim$sideInner.height, pathHeight);
5353

@@ -57,8 +57,8 @@ function createDimensionObserver(callback, {
5757
topSpacing,
5858
bottomSpacing,
5959
scrollDirection,
60-
isSideInnerFitsPath,
61-
isSideInnerFitsViewport,
60+
isSideInnerWithinPath,
61+
isSideInnerWithinViewport,
6262

6363
sideOuterHeight: sideOuterHeight,
6464

src/fsm-transitions.js

+17-17
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,32 @@ export default {
55
{
66
to: states.FINISH,
77
when: (d) => [
8-
d.isSideInnerFitsPath === true,
9-
d.isSideInnerFitsViewport === false,
8+
d.isSideInnerWithinPath === true,
9+
d.isSideInnerWithinViewport === false,
1010
d.viewportBottom > d.finishPoint
1111
]
1212
},
1313
{
1414
to: states.FINISH,
1515
when: (d) => [
16-
d.isSideInnerFitsPath === true,
17-
d.isSideInnerFitsViewport === true,
16+
d.isSideInnerWithinPath === true,
17+
d.isSideInnerWithinViewport === true,
1818
d.viewportTop + d.sideInnerHeight + d.bottomSpacing > d.finishPoint
1919
]
2020
},
2121
{
2222
to: states.BOTTOM_FIXED,
2323
when: (d) => [
24-
d.isSideInnerFitsPath === true,
25-
d.isSideInnerFitsViewport === false,
24+
d.isSideInnerWithinPath === true,
25+
d.isSideInnerWithinViewport === false,
2626
d.viewportBottom > d.sideInnerBottom + d.bottomSpacing
2727
],
2828
},
2929
{
3030
to: states.TOP_FIXED,
3131
when: (d) => [
32-
d.isSideInnerFitsPath === true,
33-
d.isSideInnerFitsViewport === true,
32+
d.isSideInnerWithinPath === true,
33+
d.isSideInnerWithinViewport === true,
3434
d.viewportTop > d.startPoint - d.topSpacing
3535
]
3636
}
@@ -39,7 +39,7 @@ export default {
3939
[states.TOP_FIXED]: [
4040
{
4141
to: states.START,
42-
when: (d) => [d.isSideInnerFitsPath === false],
42+
when: (d) => [d.isSideInnerWithinPath === false],
4343
},
4444
{
4545
to: states.START,
@@ -53,15 +53,15 @@ export default {
5353
to: states.UNFIXED,
5454
when: (d) => [
5555
d.scrollDirection === 'down',
56-
d.isSideInnerFitsViewport === false
56+
d.isSideInnerWithinViewport === false
5757
]
5858
},
5959
],
6060

6161
[states.UNFIXED]: [
6262
{
6363
to: states.START,
64-
when: (d) => [d.isSideInnerFitsPath === false],
64+
when: (d) => [d.isSideInnerWithinPath === false],
6565
},
6666
{
6767
to: states.START,
@@ -81,14 +81,14 @@ export default {
8181
{
8282
to: states.TOP_FIXED,
8383
when: (d) => [
84-
d.isSideInnerFitsViewport === true,
84+
d.isSideInnerWithinViewport === true,
8585
d.viewportBottom >= d.sideInnerBottom + d.bottomSpacing
8686
]
8787
},
8888
{
8989
to: states.BOTTOM_FIXED,
9090
when: (d) => [
91-
d.isSideInnerFitsViewport === false,
91+
d.isSideInnerWithinViewport === false,
9292
d.viewportBottom > d.sideInnerBottom + d.bottomSpacing
9393
]
9494
}
@@ -97,12 +97,12 @@ export default {
9797
[states.BOTTOM_FIXED]: [
9898
{
9999
to: states.START,
100-
when: (d) => [d.isSideInnerFitsPath === false],
100+
when: (d) => [d.isSideInnerWithinPath === false],
101101
},
102102
{
103103
to: states.START,
104104
when: (d) => [
105-
d.isSideInnerFitsPath === true,
105+
d.isSideInnerWithinPath === true,
106106
d.sideInnerTop <= d.startPoint - d.topSpacing
107107
]
108108
},
@@ -112,7 +112,7 @@ export default {
112112
},
113113
{
114114
to: states.TOP_FIXED,
115-
when: (d) => [d.isSideInnerFitsViewport === true,]
115+
when: (d) => [d.isSideInnerWithinViewport === true,]
116116
},
117117
{
118118
to: states.FINISH,
@@ -123,7 +123,7 @@ export default {
123123
[states.FINISH]: [
124124
{
125125
to: states.START,
126-
when: (d) => [d.isSideInnerFitsPath === false],
126+
when: (d) => [d.isSideInnerWithinPath === false],
127127
},
128128
{
129129
to: states.START,

test/transitions.test.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@ describe('transitions', function() {
7373
});
7474
});
7575

76-
// isSideInnerFitsViewport === true
76+
// isSideInnerWithinViewport === true
7777
describe('when height(sidebarInner) < height(viewport)', () => {
7878
beforeEach(() => {
7979
setSidebarInnerHeight(VIEWPORT_HEIGHT / 2);
8080
});
8181

82-
// isSideInnerFitsPath === false
82+
// isSideInnerWithinPath === false
8383
describe('when height(content) < height(sidebarInner)', () => {
8484
beforeEach(async () => {
8585
setContentHeight(sidebarInnerHeight / 2);
@@ -95,7 +95,7 @@ describe('transitions', function() {
9595
});
9696
});
9797

98-
// isSideInnerFitsPath === true
98+
// isSideInnerWithinPath === true
9999
describe('when height(content) > height(sidebarInner)', () => {
100100
beforeEach(async () => {
101101
setContentHeight(sidebarInnerHeight * 2);
@@ -180,13 +180,13 @@ describe('transitions', function() {
180180
});
181181
});
182182

183-
// isSideInnerFitsViewport === false
183+
// isSideInnerWithinViewport === false
184184
describe('when height(sidebarInner) > height(viewport)', () => {
185185
beforeEach(() => {
186186
setSidebarInnerHeight(VIEWPORT_HEIGHT * 2);
187187
});
188188

189-
// isSideInnerFitsPath === false
189+
// isSideInnerWithinPath === false
190190
describe('when height(content) < height(sidebarInner)', () => {
191191
beforeEach(async () => {
192192
setContentHeight(sidebarInnerHeight / 2);
@@ -202,7 +202,7 @@ describe('transitions', function() {
202202
});
203203
});
204204

205-
// isSideInnerFitsPath === true
205+
// isSideInnerWithinPath === true
206206
describe('when height(content) > height(sidebarInner)', () => {
207207
beforeEach(async () => {
208208
setContentHeight(sidebarInnerHeight * 1.5);

0 commit comments

Comments
 (0)