# MouseTracker 移至渲染

> MouseTracker 和相关符号移到了rendering package。




:::important
These breaking change docs are accurate, as of the release
under which they are published. Over time, the
workarounds described here might become inaccurate.
We don't, in general, keep these breaking change docs up
to date as of each release.

这些破坏性改动文档的准确性仅限于其发布时对应的版本。
随着时间的推移，文档中描述的方案可能会逐渐失效。
通常情况下，我们不会在每次发布新版本时都对这些文档进行同步更新。

The [breaking change index file](/release/breaking-changes)
lists the docs created for each release.

[破坏性改动列表](/release/breaking-changes) 
列出了每个版本的文档。

:::


## Summary

[`MouseTracker`][] and related symbols are moved from the
`gestures` package, resulting in error messages such as
undefined classes or methods. Import them from `rendering`
package instead.

## Context

Prior to this change [`MouseTracker`][] was part of the
`gestures` package. This brought troubles when we found out
that code related to [`MouseTracker`][] often wanted to
import from the `rendering` package.

Since [`MouseTracker`][] turned out to be more connected to
`rendering` than `gestures`, we have moved it and its
related code to `rendering`.

## Description of change

The file `mouse_tracking.dart` has been moved from the
`gestures` package to `rendering`. All symbols in the said
file have been moved without keeping backward compatibility.

## Migration guide

If you see error of "Undefined class" or "Undefined name" of
the following symbols:

* [`MouseDetectorAnnotationFinder`][]
* [`MouseTracker`][]
* [`MouseTrackerAnnotation`][]
* [`PointerEnterEventListener`][]
* [`PointerExitEventListener`][]
* [`PointerHoverEventListener`][]

You should add the following import:

```dart
import 'package:flutter/rendering.dart';
```

## Timeline

Landed in version: 1.16.3<br>
In stable release: 1.17

## References

API documentation:

* [`MouseDetectorAnnotationFinder`][]
* [`MouseTracker`][]
* [`MouseTrackerAnnotation`][]
* [`PointerEnterEventListener`][]
* [`PointerExitEventListener`][]
* [`PointerHoverEventListener`][]

Relevant issues:

* [Transform mouse events to the local coordinate system][]
* [Move annotations to a separate tree][]

Relevant PR:

* [Move mouse_tracking.dart to rendering][]

[Move annotations to a separate tree]: https://github.com/flutter/flutter/issues/49568
[Move mouse_tracking.dart to rendering]: https://github.com/flutter/flutter/pull/52781
[Transform mouse events to the local coordinate system]: https://github.com/flutter/flutter/issues/33675
[`MouseDetectorAnnotationFinder`]: https://api.flutter-io.cn/flutter/gestures/MouseDetectorAnnotationFinder.html
[`MouseTracker`]: https://api.flutter-io.cn/flutter/gestures/MouseTracker-class.html
[`MouseTrackerAnnotation`]: https://api.flutter-io.cn/flutter/gestures/MouseTrackerAnnotation-class.html
[`PointerEnterEventListener`]: https://api.flutter-io.cn/flutter/gestures/PointerEnterEventListener.html
[`PointerExitEventListener`]: https://api.flutter-io.cn/flutter/gestures/PointerExitEventListener.html
[`PointerHoverEventListener`]: https://api.flutter-io.cn/flutter/gestures/PointerHoverEventListener.html

