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

Class StringScrollObject

src/Objects/StringScrollObject.ts:6–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4const tS = "top"
5const bS = "bottom"
6export class StringScrollObject{
7 public el: HTMLElement
8 public top: number
9 public bottom: number
10 public height: number
11 public oTop: number
12 public oBottom: number
13 public key: string
14 public start: number
15 public end: number
16 public factor: number
17 public id: string
18 public enabled: boolean
19 public startPos: number
20 public endPos: number
21 public differencePos: number
22 public offsetTop: number
23 public progress: number = 0
24 public connects: Array<StringScrollObject> = new Array<StringScrollObject>()
25 public showObserver: IntersectionObserver | null = null
26 public progressObserver: IntersectionObserver | null = null
27
28 public sElPos: string
29 public sScrPos: string
30 public eElPos: string
31 public eScrPos: string
32
33 constructor(element: HTMLElement, key: string, factor: string, bufferProgressKey: string){
34 let r = gbcl(element)
35 let wH = window.innerHeight
36 let oA = attr(element, `data-string-offset`)
37
38 let o = oA == null ? [0, 0] : StringParse.getInstance().parseOffset(element, oA, wH)
39 let rH = r.height
40 this.el= element
41 this.key= attr(element, `data-string-key`, key)
42 this.factor= attr(element, factor, 1)
43 this.progress = Number.parseFloat(attr(this.el, bufferProgressKey, 0)),
44 this.top= StringParse.getInstance().parseCoords(element).top
45 this.bottom= StringParse.getInstance().parseCoords(element).top + rH
46 this.height= rH
47 this.oTop= o[0]
48 this.oBottom= o[1]
49 this.start= attr(element, `data-string-start`, 1)
50 this.end= attr(element, `data-string-end`, 1)
51 this.id = attr(element, `data-string-id`)
52
53 this.enabled= attr(element, `data-string-enabled`) == null ? true : false
54 this.startPos= 1
55 this.endPos= 1
56 this.differencePos= 1
57 let startPosition = attr(element, `data-string-start`) || "top bottom";
58 let endPosition = attr(element, `data-string-end`) || "bottom top";
59 let [sElPos, sScrPos] = startPosition.split(" ");
60 let [eElPos, eScrPos] = endPosition.split(" ");
61 this.sElPos = sElPos
62 this.sScrPos = sScrPos
63 this.eElPos = eElPos

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected