MCPcopy Create free account
hub / github.com/Fiddle-Digital/string-scroll / resize

Method resize

src/Objects/StringScrollObject.ts:93–124  ·  view source on GitHub ↗
(windowHeight: number)

Source from the content-addressed store, hash-verified

91
92 }
93 resize(windowHeight: number) {
94 let element = this.el
95 let r = gbcl(element)
96 let rH = r.height
97 this.el= element
98 this.top= StringParse.getInstance().parseCoords(element).top
99 this.bottom= StringParse.getInstance().parseCoords(element).top + rH
100 this.height= rH
101 this.start= attr(element, `data-string-start`, 1)
102 this.end= attr(element, `data-string-end`, 1)
103 if (this.sElPos == tS && this.sScrPos == tS) {
104 this.startPos = this.top - this.oTop
105 } else if (this.sElPos == tS && this.sScrPos == bS) {
106 this.startPos = this.top - windowHeight - this.oTop
107 } else if (this.sElPos == bS && this.sScrPos == tS) {
108 this.startPos = this.top + this.height - this.oTop
109 } else if (this.sElPos == bS && this.sScrPos == bS) {
110 this.startPos = this.top - windowHeight - this.oTop
111 }
112 if (this.eElPos == tS && this.eScrPos == tS) {
113 this.endPos = this.top + this.oBottom
114 } else if (this.eElPos == tS && this.eScrPos == bS) {
115 this.endPos = this.top - windowHeight + this.oBottom
116 } else if (this.eElPos == bS && this.eScrPos == tS) {
117 this.endPos = this.top + this.height + this.oBottom
118 } else if (this.eElPos == bS && this.eScrPos == bS) {
119 this.endPos = this.top - windowHeight + this.height + this.oBottom
120 }
121 this.differencePos = this.endPos - this.startPos
122 this.offsetTop = this.top - this.progress
123
124 }
125}

Callers

nothing calls this directly

Calls 4

gbclFunction · 0.90
attrFunction · 0.90
parseCoordsMethod · 0.80
getInstanceMethod · 0.45

Tested by

no test coverage detected