MCPcopy Create free account
hub / github.com/doldecomp/mkdd / place

Method place

libs/JSystem/J2DGraph/J2DPane.cpp:334–383  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

332}
333
334void J2DPane::place(const JGeometry::TBox2f& box)
335{
336 JGeometry::TBox2f tmpBox;
337
338 if (mBounds.i.x == 0.0f) {
339 tmpBox.i.x = 0.0f;
340 tmpBox.f.x = box.getWidth();
341 mOffset.x = box.i.x;
342 } else if (mBounds.f.x == 0.0f) {
343 tmpBox.i.x = -box.getWidth();
344 tmpBox.f.x = 0.0f;
345 mOffset.x = box.f.x;
346 } else {
347 tmpBox.i.x = -(box.getWidth() / 2);
348 tmpBox.f.x = box.getWidth() / 2;
349 mOffset.x = (box.i.x + box.f.x) / 2;
350 }
351
352 if (mBounds.i.y == 0.0f) {
353 tmpBox.i.y = 0.0f;
354 tmpBox.f.y = box.getHeight();
355 mOffset.y = box.i.y;
356 } else if (mBounds.f.y == 0.0f) {
357 tmpBox.i.y = -box.getHeight();
358 tmpBox.f.y = 0.0f;
359 mOffset.y = box.f.y;
360 } else {
361 tmpBox.i.y = -(box.getHeight() / 2);
362 tmpBox.f.y = box.getHeight() / 2;
363 mOffset.y = (box.i.y + box.f.y) / 2;
364 }
365
366 f32 xOff = tmpBox.i.x - mBounds.i.x;
367 f32 yOff = tmpBox.i.y - mBounds.i.y;
368 for (J2DPane* child = getFirstChildPane(); child; child = child->getNextChildPane()) {
369 child->mOffset.x += xOff;
370 child->mOffset.y += yOff;
371 if (xOff != 0.0f || yOff != 0.0f) {
372 child->calcMtx();
373 }
374 }
375 mBounds = tmpBox;
376
377 J2DPane* parent = getParentPane();
378 if (parent) {
379 mOffset.x += parent->mBounds.i.x;
380 mOffset.y += parent->mBounds.i.y;
381 }
382 calcMtx();
383}
384
385void J2DPane::move(f32 x, f32 y)
386{

Callers 11

drawPreInMethod · 0.45
drawPreInMethod · 0.45
drawMainMethod · 0.45
calcMainMethod · 0.45
drawMainMethod · 0.45
drawPreInMethod · 0.45
drawMainMethod · 0.45
calcMainMethod · 0.45
calcMainMethod · 0.45
calcMainMethod · 0.45
drawMethod · 0.45

Calls 4

getNextChildPaneMethod · 0.80
getWidthMethod · 0.45
getHeightMethod · 0.45
calcMtxMethod · 0.45

Tested by

no test coverage detected