scrubber

作者: wlqsmiling | 来源:发表于2017-08-21 18:40 被阅读5次

    - (void) updateMarker1ToPoint:(CGPoint) touchPoint

    {

    CGFloatpreMarker1Location =self.marker1Location;

    CGFloatpreMarker2Location =self.marker2Location;

    self.marker1Location= touchPoint.x-self.touch1Location;

    if(self.marker1Location<0)

    {

    self.marker1Location=0;

    }

    if(self.marker1Location+_sliderImage.size.width>self.marker2Location)

    {

    self.marker1Location=self.marker2Location-_sliderImage.size.width;

    }

    _videoOffset1= [selfoffsetForMarker1Location];

    _videoOffset2= [selfoffsetForMarker2Location];

    if(_videoOffset2-_videoOffset1<=kMinimumVideoLength)

    {

    self.marker1Location= preMarker1Location;

    self.marker2Location= preMarker2Location;

    _videoOffset1= [selfoffsetForMarker1Location];

    _videoOffset2= [selfoffsetForMarker2Location];

    }

    //if(_videoOffset2 - _videoOffset1 <= kMinimumVideoLength && self.marker1Location > preMarker1Location)//达到最小值

    //{

    //self.marker2Location = self.marker2Location + (self.marker1Location - preMarker1Location);

    //

    //if(self.marker2Location >= kMarker2Start || self.marker2Location >= stripWidth)

    //{

    //self.marker1Location = preMarker1Location;

    //self.marker2Location = preMarker2Location;

    //

    //}

    //

    //_videoOffset1 = [self offsetForMarker1Location];

    //_videoOffset2 = _videoOffset1 + 5;

    //}

    //else if(_videoOffset2 - _videoOffset1 >= kMaximumVideoLength && self.marker1Location < preMarker1Location)//达到最大值

    //{

    //self.marker2Location = self.marker2Location - (preMarker1Location - self.marker1Location);

    //

    //if(self.marker1Location <= kMarker1Start)

    //{

    //self.marker1Location = preMarker1Location;

    //self.marker2Location = preMarker2Location;

    //

    //}

    //

    //_videoOffset1 = [self offsetForMarker1Location];

    //_videoOffset2 = _videoOffset1 + kMaximumVideoLength;

    //}

    [self.delegateleftScrubberPositionChanged];

    [self.delegaterightScrubberPositionChanged];

    [selfsetNeedsDisplay];

    }

    - (void) updateMarker2ToPoint:(CGPoint) touchPoint

    {

    CGFloatpreMarker1Location =self.marker1Location;

    CGFloatpreMarker2Location =self.marker2Location;

    self.marker2Location= touchPoint.x-self.touch2Location;

    if(self.marker2Location+self.sliderImage.size.width>self.width)

    {

    self.marker2Location=self.width-self.sliderImage.size.width;

    }

    if(self.marker2Location>stripWidth+self.sliderImage.size.width)

    {

    self.marker2Location=self.width+self.sliderImage.size.width;

    }

    if(self.marker2Location

    {

    self.marker2Location=self.marker1Location+_sliderImage.size.width;

    }

    _videoOffset1= [selfoffsetForMarker1Location];

    _videoOffset2= [selfoffsetForMarker2Location];

    if(_videoOffset2-_videoOffset1<=kMinimumVideoLength)

    {

    self.marker1Location= preMarker1Location;

    self.marker2Location= preMarker2Location;

    _videoOffset1= [selfoffsetForMarker1Location];

    _videoOffset2= [selfoffsetForMarker2Location];

    }

    //if(_videoOffset2 - _videoOffset1 <= kMinimumVideoLength && self.marker2Location < preMarker2Location)//达到最小值

    //{

    //self.marker1Location = self.marker1Location - (preMarker2Location - self.marker2Location );

    //

    //if(self.marker1Location <= kMarker1Start)

    //{

    //self.marker1Location = preMarker1Location;

    //self.marker2Location = preMarker2Location;

    //

    //}

    //

    //_videoOffset2 = [self offsetForMarker2Location];

    //_videoOffset1 = _videoOffset2 - 5;

    //}

    //else if(_videoOffset2 - _videoOffset1 >= kMaximumVideoLength && self.marker2Location > preMarker2Location)//达到最大值

    //{

    //self.marker1Location = self.marker1Location + (self.marker2Location - preMarker2Location );

    //

    //if(self.marker2Location >= kMarker2Start)

    //{

    //self.marker1Location = preMarker1Location;

    //self.marker2Location = preMarker2Location;

    //}

    //

    //_videoOffset2 = [self offsetForMarker2Location];

    ////_videoOffset1 = _videoOffset2 - kMaximumVideoLength;

    //_videoOffset1 = [self offsetForMarker1Location];

    //}

    [self.delegateleftScrubberPositionChanged];

    [self.delegaterightScrubberPositionChanged];

    [selfsetNeedsDisplay];

    }

    相关文章

      网友评论

          本文标题:scrubber

          本文链接:https://www.haomeiwen.com/subject/ihshdxtx.html