Giter Club home page Giter Club logo

colorslider's People

Contributors

andrewsb avatar gizmosachin avatar piemonte avatar ykws avatar ziewvater avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

colorslider's Issues

iOS 8.0 compatibility

is there any love for iOS 8?

I get the error

Specs satisfying the ColorSlider (= 2.5.1) dependency were found, but they required a higher minimum deployment target.

from Cocoapods

ColorSlider.hitTest() still gets called despite set to isHidden = true

As Titled. Adding a check inside hitTest() for whether the slider is hidden fixes the issue

/// MARK: - Increase Tappable Area
extension ColorSlider {
	/// Increase the tappable area of `ColorSlider` to a minimum of 44 points on either edge.
	override public func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
    if isHidden || alpha <= 0.01 { return super.hitTest(point, with: event) }
		// Determine the delta between the width / height and 44, the iOS HIG minimum tap target size.
		// If a side is already longer than 44, add 10 points of padding to either side of the slider along that axis.
		let minimumSideLength: CGFloat = 44
		let padding: CGFloat = -20
		let dx: CGFloat = min(bounds.width - minimumSideLength, padding)
		let dy: CGFloat = min(bounds.height - minimumSideLength, padding)
		
		// If an increased tappable area is needed, respond appropriately
		let increasedTapAreaNeeded = (dx < 0 || dy < 0)
		let expandedBounds = bounds.insetBy(dx: dx / 2, dy: dy / 2)
		
		if increasedTapAreaNeeded && expandedBounds.contains(point) {
			for subview in subviews.reversed() {
				let convertedPoint = subview.convert(point, from: self)
				if let hitTestView = subview.hitTest(convertedPoint, with: event) {
					return hitTestView
				}
			}
			return self
		} else {
			return super.hitTest(point, with: event)
		}
	}
}

How do I had some sort of marker ontop of the picker?

If i wanted to add a bar, so the user could visually see where they were pressing a bit more clearly, where in the code would I add this? i've tried adding it into the commoninit as well as the drawRect, however the UIView i attempt to place on top is never visible. Only if I add it in the VC where the colorSlider is instantiated, can I do this, but this feels like bad approach. I don't want it like the example, where a color preview circle appears outside of the bar.

Unable to remove old PreviewView icon from background to toggle btw two color palettes

Hello,
I wanted to duplicate the color slider with two different sets of color palette by entering the new color values under colorSliderGradient function and controlling it by using a switch to toggle. Colorslider background changes well as expected however previous slider PreviewView still appears at behind the slider in addition to new defaultPreviewView in front. Whenever toggle the slider color palette small PreviewView icons increases behind the slider. I call addColorSlider function in the view controller every time the toggle button pressed. Any idea how to remove the old PreviewView icons from background. Many thanks indeed
IMG_4FE5092E6B4A-1

Trigger an event only after sliding is completed(continuous = false)

Thanks for the great library. I would like to have some UISlider type features on this but I am not sure how to approach this.

Currently "valueChanged" event is triggered many times while user is moving the slider thumb. I would like to get an event triggered only when user has completed sliding. UISlider has a property named "continuous" which helps for this kind of situation. However I am not sure how to approach this with ColorSlider.

I would also like to separate the slider thumb from preview view. Right now the slider thumb is acting as preview too. I would like to set a thumb image similar to UISlider which doesn't change its color based on slider position. Instead I would like to connect a separate UIView as Preview View for slider and that UIView would be a fixed static view without any animation along with slider movement. I guess I can implement the thumb image part by implementing "ColorSliderPreviewing" protocol, but just wanted to confirm that. I will also listen to "valueChanged" event for updating preview view background color. Hope that is the right approach.

Manually setting randomly calculated color

If you manually set randomly calculated color, ColorSlider (though setting correct color) slider's position is not set appropriately (always at the 0 position on the left).
I understand why (because ColorsSlider does not "contain" every color possible), but it would be cool if control could approx. calculate the correct position.

Autolayout issues?

On iPad after rotations this happens (look at the image).
Is there an option to force re-layout ColorSlider?
I tried layoutIfNeeded, etc. But no success Preview UIView is not correctly repositioned upon device rotations.

The easiest way to reproduce it is like this:

  1. Make ColorSlider Autolayouted (so the width is different for specific device orientation)
  2. Rotate device (iPhone or iPad)
  3. Preview UIView is not correctly repositioned

TouchUpInside called twice

Is there any easy way to prevent TouchUpInside be called twice?

colorSlider.addTarget(self, action: #selector(changedColor(_:)), for: .touchUpInside)

Being able to set a value

It would be great to be able to force a color value at any time on the Color slider. We could imagine that we'd want to save the latest selected color in the user settings and set that color back when he comes back.

What do you think?

Horizontal Orientation

First off this is an excellent module, great work.

I have been playing around with the Sketchpad example and can't seem to get the horizontal orientation to function properly. I have tried editing the default orientation, as well as the drawLayer inside commonInit(), but the color slider always appears vertical.

simulator screen shot feb 26 2017 2 31 34 pm

Programmatic init crashes

Programmatic init per docs does not work:
colorSlider = ColorSlider()

Needs to be called with a frame, even if just zero:
colorSlider = ColorSlider(frame: CGRectZero)

use centerPreview

hey
I want to move the slider value to a new position programmatically , I found a method name is centerPreview(at:) , but it defines as an internal func , could you tell me how can I do ?

Carthage build failed

Hi and thanks for the great work!

When I'm trying to build the project with Carthage, I have the following error:

/Carthage/Checkouts/ColorSlider/Sources/GradientView.swift:241:23: error: use of undeclared type 'Gradient'
fileprivate extension Gradient {
^~~~~~~~

I'm using Xcode 9.2 / Swift 4

Cheers!

Can't use in Interface Builder

Thanks for all the work @gizmosachin! Great project.

I've been trying to integrate the component like you did in Sketchpad, but for some reason IB is refusing to recognize ColorSlider as a valid subclass for a UIView...

Have you had any experience with this/ know how to debug this?

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.