Giter Site home page Giter Site logo

Comments (4)

shipinev avatar shipinev commented on May 20, 2024

Hey @perbrondum. Sorry for the late response. Could you please provide more details or code related to your issue. Thanks!

from fan-menu.

perbrondum avatar perbrondum commented on May 20, 2024

In the below I create a 3 item fan menu. The radius sets the span of the menu, but the original Button to activate the menu is too big on SE. How do I set the size of that item?

Thanks,

private func createFanMenu() {
fanMenu.button = FanMenuButton(
id: "main",
image: UIImage(systemName: "plus"), //"plus",
color: Color(val: 0x007AFF)
)
// position the view
// Create the leading and trailing margin constraints as always using the layoutMarginsGuide of the root view
// Use code as IB does not support connecting this declaratively
fanMenu.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
fanMenu.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: 70),
// fanMenu.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor, constant: 100.0),
fanMenu.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: 80),
fanMenu.widthAnchor.constraint(equalToConstant: 240),
fanMenu.heightAnchor.constraint(equalToConstant: 240)
])
// Set menu items
if !GLOBAL.server {
fanMenu.items = [
FanMenuButton(
id: buttonMenu.NewEvent.rawValue,
image: UIImage(named: "eventSymbol.png"),
color: Color.clear,
title: "",
titleColor : Color.black,
titlePosition: FanMenuButtonTitlePosition.bottom
),
FanMenuButton(
id: buttonMenu.AccPlan.rawValue,
image: UIImage(named: "accSymbol.png"),
color: Color.clear
),
FanMenuButton(
id: buttonMenu.OppPlan.rawValue,
image: UIImage(named: "oppSymbol.png"),
color: Color.clear
)
]
} else {
fanMenu.items = [
FanMenuButton(
id: buttonMenu.NewEvent.rawValue,
image: UIImage(named: "eventSymbol.png"),
color: Color.clear,
title: "",
titleColor : Color.black,
titlePosition: FanMenuButtonTitlePosition.bottom
)
]
}
// Add an event handler
// call before animation
fanMenu.onItemDidClick = { button in
switch button.id {
case buttonMenu.NewEvent.rawValue:
if let vc = UIStoryboard(name: "createEvent", bundle: nil).instantiateViewController(withIdentifier: "addEvent") as? addEventViewController {
vc.completionBlock = {[weak self] dataReturned in
//Data is returned **Do anything with it **
print(dataReturned)
print("SFDC refresh was run from addEvent")
self!.eventSFDataAutoRefresh()
}
self.navigationController?.pushViewController(vc, animated:true)
}
case buttonMenu.AccPlan.rawValue:
if let vc = UIStoryboard(name: "AccPlan", bundle: nil).instantiateViewController(withIdentifier: "AccPlanViewController") as? AccPlanViewController {
self.navigationController?.pushViewController(vc, animated:true)
}
break
case buttonMenu.OppPlan.rawValue:
if let vc = UIStoryboard(name: "OppPlan", bundle: nil).instantiateViewController(withIdentifier: "OppPlanViewController") as? OppPlanViewController {
self.navigationController?.pushViewController(vc, animated:true)
}
break
default:
break
}
}
// optionally call after animation
// fanMenu.onItemWillClick = { button in
// print("ItemWillClick: (button.id)")
// }
//Configure optional parameters
// distance between button and items
fanMenu.menuRadius = 90.0
// animation duration
fanMenu.duration = 0.35
// menu opening delay
fanMenu.delay = 0.02
// Start at -90 (-Dpi/2), go to 180 (-Dpi)
fanMenu.interval = (-Double.pi/2, -Double.pi)
fanMenu.menuBackground = Color.clear
fanMenu.backgroundColor = nil
fanMenu.needsUpdateConstraints()
}

from fan-menu.

shipinev avatar shipinev commented on May 20, 2024

You can set button size by changing radius value:

fanMenu.radius = 50

But this value affects all menu items. If you want to change only the main button size, you need to subclass FanMenuScene or create a custom scene. You can take a look at CustomViewController in our example project.

from fan-menu.

perbrondum avatar perbrondum commented on May 20, 2024

from fan-menu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.