MCPcopy
hub / github.com/visgl/deck.gl / evaluateViewLayout

Function evaluateViewLayout

modules/widgets/src/splitter-widget.tsx:87–144  ·  view source on GitHub ↗
(
    l: ManagedViewLayout,
    x: number,
    y: number,
    width: number,
    height: number
  )

Source from the content-addressed store, hash-verified

85function evaluateViews(root: ManagedViewLayout): View[] {
86 const views: View[] = [];
87 function evaluateViewLayout(
88 l: ManagedViewLayout,
89 x: number,
90 y: number,
91 width: number,
92 height: number
93 ) {
94 l.x = x;
95 l.y = y;
96 l.width = width;
97 l.height = height;
98
99 const child1X = x;
100 const child1Y = y;
101 let child1Width = width;
102 let child1Height = height;
103 let child2X = x;
104 let child2Y = y;
105 let child2Width = width;
106 let child2Height = height;
107
108 if (l.orientation === 'horizontal') {
109 child1Width = width * l.split;
110 child2X = x + child1Width;
111 child2Width = width - child1Width;
112 } else {
113 child1Height = height * l.split;
114 child2Y = y + child1Height;
115 child2Height = height - child1Height;
116 }
117
118 const [view1, view2] = l.views;
119 if ('views' in view1) {
120 evaluateViewLayout(view1, child1X, child1Y, child1Width, child1Height);
121 } else {
122 views.push(
123 view1.clone({
124 x: `${child1X}%`,
125 y: `${child1Y}%`,
126 width: `${child1Width}%`,
127 height: `${child1Height}%`
128 })
129 );
130 }
131
132 if ('views' in view2) {
133 evaluateViewLayout(view2, child2X, child2Y, child2Width, child2Height);
134 } else {
135 views.push(
136 view2.clone({
137 x: `${child2X}%`,
138 y: `${child2Y}%`,
139 width: `${child2Width}%`,
140 height: `${child2Height}%`
141 })
142 );
143 }
144 }

Callers 1

evaluateViewsFunction · 0.85

Calls 1

cloneMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…