pIvan / ngx-color-picker

Pure Angular color picker library.
MIT License
96 stars 16 forks source link

Support start and end events? #25

Closed StringKe closed 3 years ago

StringKe commented 3 years ago

Now there is only the colorChange event. I need to save a history record. I need to use the start and end events. Can these two events be supported?

pIvan commented 3 years ago

Hi @StringKe, can you give me an example of how these start and end events should work? They should be updated on each slider change, for each pixel?

StringKe commented 3 years ago

Use the pan related events in hammer js in angular.

<div
        (panstart)="onPanStart($event, button)" // like mouseDown
        (panmove)="onPanMove($event)" // like mouseMove
        (panend)="onPanEnd($event)" // like mouseUp
      >
      </div>
pIvan commented 3 years ago

Thanks @StringKe, I'll see what can I do this weekend

StringKe commented 3 years ago

maybe you need to modify the mousedown and mouseup of all components in projects/iplab/ngx-color-picker/src/lib/components/parts?

pIvan commented 3 years ago

Hi @StringKe I have already started with this, but I'm trying to test it in detail

StringKe commented 3 years ago

Maybe you can add OnStart and OnEnd events to projects/iplab/ngx-color-picker/src/lib/helpers/color.class.ts add corresponding listeners during component init?

pIvan commented 3 years ago

Hi @StringKe,

problem is next, chrome picker, same as any other is composed of several different components, on each different component then we should track start value and end value. How to define which is the start value of chrome picker if you start to slide opacity, and then you start to slide hue or saturation?

When to emit start value, and when to emit end value?

How I see it is to add those events on each child component, then you can combine them to build your component?

Kind regards, Ivan