Skip to content

Commit

Permalink
mac os
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSillyDoggo committed Feb 27, 2024
1 parent 9a3d291 commit 135de4a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/CCLabelBMFontExt.h
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,17 @@ class CCLabelBMFontExt : public CCMenu
updateLabel();
}

float clampf(float v, float min, float max)
{
if (v < min)
v = min;

if (v > max)
v = max;

return v;
}

void limitLabelWidth(float width, float defaultScale, float minScale)
{
this->setScale(clampf(width / this->getContentSize().width, minScale, defaultScale));
Expand Down
15 changes: 15 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,19 @@ class $modify (ShareCommentLayerExt, ShareCommentLayer)
auto menu = m_fields->commentMenu;
menu->stopAllActions();

#ifdef GEODE_IS_MACOS

if (m_fields->visible)
{
menu->runAction((CCMoveTo::create(0.75f, ccp(CCDirector::get()->getWinSize().width, 0))));
}
else
{
menu->runAction((CCMoveTo::create(0.75f, ccp(CCDirector::get()->getWinSize().width + menu->getContentSize().width, 0))));
}

#else

if (m_fields->visible)
{
menu->runAction(CCEaseInOut::create(CCMoveTo::create(0.75f, ccp(CCDirector::get()->getWinSize().width, 0)), 2));
Expand All @@ -82,6 +95,8 @@ class $modify (ShareCommentLayerExt, ShareCommentLayer)
{
menu->runAction(CCEaseInOut::create(CCMoveTo::create(0.75f, ccp(CCDirector::get()->getWinSize().width + menu->getContentSize().width, 0)), 2));
}

#endif
}

void onSelectEmoji(CCObject* sender)
Expand Down

0 comments on commit 135de4a

Please sign in to comment.