# What's new in Scheduler Pro v5.2.0

## Segmented events support

In this release Scheduler Pro adds support for _segmented events_.
Each event can be split into segments which then can be adjusted separately, moved or merged back.

On the data level splitting an event can be done with event model
[splitToSegments](#SchedulerPro/model/EventModel#function-splitToSegments) method call:

```js
// split event1 into segments at 2022-07-27 with split duration of 1 day
await event1.splitToSegments(new Date(2022, 6, 27), 1, "day")

/* here rescheduling is done */
```

Event model has got a new [segments](#SchedulerPro/model/EventModel#field-segments) field (plus
properties to access the [first](#SchedulerPro/model/EventModel#property-lastSegment)
and [last](#SchedulerPro/model/EventModel#property-lastSegment) segment) which returns
an array of [EventSegmentModel](#SchedulerPro/model/EventSegmentModel)
class instances.

Each segment can be changed individually:

```js
// change last segment end date
event1.lastSegment.endDate = new Date(2022, 7, 4)

// wait till rescheduling is done
await event1.commitAsync()

/* here rescheduling is done */
```
Or with [setEndDate](#SchedulerPro/model/EventSegmentModel#function-setEndDate) method call:
```js
await event1.lastSegment.setEndDate(new Date(2022, 7, 4))

/* here rescheduling is done */
```

Bringing two segments close to each other causes them to merge.

On the UI level segments support is done with the following new features:

- [EventSegments](#SchedulerPro/feature/EventSegments) - implements rendering and adds new "Split event" entry to the event context menu.
- [EventSegmentResize](#SchedulerPro/feature/EventSegmentResize) - implement individual segments resizing with drag'n'drop.
- [EventSegmentDrag](#SchedulerPro/feature/EventSegmentDrag) - implement individual segments moving with drag'n'drop.

<div class="external-example" data-file="SchedulerPro/feature/EventSegments.js"></div>

## New widget for switching views

The [ViewPresetCombo](#Scheduler/widget/ViewPresetCombo) is an easy-to-setup preset picker which can be added to the
SchedulerPro's toolbar and provides a simple UI for switching between different "views". It's based on
[ViewPreset](#Scheduler/preset/ViewPreset) which is built-in to the SchedulerPro.

Try it out in the live demo here:

<div class="external-example" data-file="./data/Scheduler/examples/widget/ViewPresetCombo.js"></div>

## EventNonWorkingTime feature

Prior to this release Scheduler Pro had two features to visualize non-working time:

* `NonWorkingTime` - visualizes the project level calendar using time ranges
* `ResourceNonWorkingTime` - visualizes the resource level calendar using resource time ranges

With this release a new `EventNonWorkingTime` feature was added, which visualizes the event level calendar (project or
resource calendar combined with any event calendar) by shading parts of the event bars.

<div class="external-example" data-file="SchedulerPro/feature/EventNonWorkingTime.js"></div>

## Ignoring resource calendars

An event normally performs work when both its [own calendar](#SchedulerPro/model/EventModel#field-calendar) and some
of the assigned resource calendars (if any resource is assigned to the event) allow that.

With this release event model has got a new
[ignoreResourceCalendar](#SchedulerPro/model/EventModel#field-ignoreResourceCalendar) boolean field allowing to toggle
that logic.
When the field is set to `true` the event will not take its assigned resource calendars into account and will perform
according to its own calendar only.

On the UI level the field is represented as "Ignore resource calendar" checkbox on the "Advanced" tab of
the [task editor](#SchedulerPro/feature/TaskEdit).

## Improved PDF Export feature

Pdf Export feature now renders exported content directly and does not scroll the view anymore. This significantly
improves performance (by an order of magnitude) and robustness of the export process. You can enable old behavior by
setting `enableDirectRendering` config on the export feature to `false`. Old behavior is deprecated and will be removed
in the next major release. Please report issues that make you disable direct rendering.


<p class="last-modified">Last modified on 2023-10-26 8:19:27</p>