Revert "Merge branch 'develop' into release-0.2"
This reverts commitmain5ac095938b, reversing changes made tofdf63cf00b.
parent
5ac095938b
commit
ca7704374b
@ -1,147 +1,4 @@
|
|||||||
# Contributing to this project
|
# How to contribute to Computer Vision Annotation Tool (CVAT)
|
||||||
|
|
||||||
Please take a moment to review this document in order to make the contribution
|
When contributing to this repository, please first discuss the change you wish to make via issue,
|
||||||
process easy and effective for everyone involved.
|
email, or any other method with the owners of this repository before making a change.
|
||||||
|
|
||||||
Following these guidelines helps to communicate that you respect the time of
|
|
||||||
the developers managing and developing this open source project. In return,
|
|
||||||
they should reciprocate that respect in addressing your issue or assessing
|
|
||||||
patches and features.
|
|
||||||
|
|
||||||
## Branching model
|
|
||||||
|
|
||||||
The project uses [a successful Git branching model](https://nvie.com/posts/a-successful-git-branching-model).
|
|
||||||
Thus it has a couple of branches. Some of them are described below:
|
|
||||||
|
|
||||||
- `origin/master` to be the main branch where the source code of
|
|
||||||
HEAD always reflects a production-ready state.
|
|
||||||
- `origin/develop` to be the main branch where the source code of
|
|
||||||
HEAD always reflects a state with the latest delivered development
|
|
||||||
changes for the next release. Some would call this the “integration branch”.
|
|
||||||
|
|
||||||
## Using the issue tracker
|
|
||||||
|
|
||||||
The issue tracker is the preferred channel for [bug reports](#bugs),
|
|
||||||
[features requests](#features) and [submitting pull
|
|
||||||
requests](#pull-requests), but please respect the following restrictions:
|
|
||||||
|
|
||||||
* Please **do not** use the issue tracker for personal support requests (use
|
|
||||||
[Stack Overflow](http://stackoverflow.com)).
|
|
||||||
|
|
||||||
* Please **do not** derail or troll issues. Keep the discussion on topic and
|
|
||||||
respect the opinions of others.
|
|
||||||
|
|
||||||
<a name="bugs"></a>
|
|
||||||
## Bug reports
|
|
||||||
|
|
||||||
A bug is a _demonstrable problem_ that is caused by the code in the repository.
|
|
||||||
Good bug reports are extremely helpful - thank you!
|
|
||||||
|
|
||||||
Guidelines for bug reports:
|
|
||||||
|
|
||||||
1. **Use the GitHub issue search** — check if the issue has already been
|
|
||||||
reported.
|
|
||||||
|
|
||||||
2. **Check if the issue has been fixed** — try to reproduce it using the
|
|
||||||
latest `develop` branch in the repository.
|
|
||||||
|
|
||||||
3. **Isolate the problem** — ideally create a reduced test case.
|
|
||||||
|
|
||||||
A good bug report shouldn't leave others needing to chase you up for more
|
|
||||||
information. Please try to be as detailed as possible in your report. What is
|
|
||||||
your environment? What steps will reproduce the issue? What browser(s) and OS
|
|
||||||
experience the problem? What would you expect to be the outcome? All these
|
|
||||||
details will help people to fix any potential bugs.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
> Short and descriptive example bug report title
|
|
||||||
>
|
|
||||||
> A summary of the issue and the browser/OS environment in which it occurs. If
|
|
||||||
> suitable, include the steps required to reproduce the bug.
|
|
||||||
>
|
|
||||||
> 1. This is the first step
|
|
||||||
> 2. This is the second step
|
|
||||||
> 3. Further steps, etc.
|
|
||||||
>
|
|
||||||
>
|
|
||||||
> Any other information you want to share that is relevant to the issue being
|
|
||||||
> reported. This might include the lines of code that you have identified as
|
|
||||||
> causing the bug, and potential solutions (and your opinions on their
|
|
||||||
> merits).
|
|
||||||
|
|
||||||
<a name="features"></a>
|
|
||||||
## Feature requests
|
|
||||||
|
|
||||||
Feature requests are welcome. But take a moment to find out whether your idea
|
|
||||||
fits with the scope and aims of the project. It's up to *you* to make a strong
|
|
||||||
case to convince the project's developers of the merits of this feature. Please
|
|
||||||
provide as much detail and context as possible.
|
|
||||||
|
|
||||||
<a name="pull-requests"></a>
|
|
||||||
## Pull requests
|
|
||||||
|
|
||||||
Good pull requests - patches, improvements, new features - are a fantastic
|
|
||||||
help. They should remain focused in scope and avoid containing unrelated
|
|
||||||
commits.
|
|
||||||
|
|
||||||
**Please ask first** before embarking on any significant pull request (e.g.
|
|
||||||
implementing features, refactoring code, porting to a different language),
|
|
||||||
otherwise you risk spending a lot of time working on something that the
|
|
||||||
project's developers might not want to merge into the project.
|
|
||||||
|
|
||||||
Please adhere to the coding conventions used throughout a project (indentation,
|
|
||||||
accurate comments, etc.) and any other requirements (such as test coverage).
|
|
||||||
|
|
||||||
Follow this process if you'd like your work considered for inclusion in the
|
|
||||||
project:
|
|
||||||
|
|
||||||
1. [Fork](http://help.github.com/fork-a-repo/) the project, clone your fork,
|
|
||||||
and configure the remotes:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Clone your fork of the repo into the current directory
|
|
||||||
git clone https://github.com/<your-username>/<repo-name>
|
|
||||||
# Navigate to the newly cloned directory
|
|
||||||
cd <repo-name>
|
|
||||||
# Assign the original repo to a remote called "upstream"
|
|
||||||
git remote add upstream https://github.com/<upstream-owner>/<repo-name>
|
|
||||||
```
|
|
||||||
|
|
||||||
2. If you cloned a while ago, get the latest changes from upstream:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git checkout <dev-branch>
|
|
||||||
git pull upstream <dev-branch>
|
|
||||||
```
|
|
||||||
|
|
||||||
3. Create a new topic branch (off the main project development branch) to
|
|
||||||
contain your feature, change, or fix:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git checkout -b <topic-branch-name>
|
|
||||||
```
|
|
||||||
|
|
||||||
4. Commit your changes in logical chunks. Please adhere to these [git commit
|
|
||||||
message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
|
|
||||||
or your code is unlikely be merged into the main project. Use Git's
|
|
||||||
[interactive rebase](https://help.github.com/articles/interactive-rebase)
|
|
||||||
feature to tidy up your commits before making them public.
|
|
||||||
|
|
||||||
5. Locally merge (or rebase) the upstream development branch into your topic branch:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git pull [--rebase] upstream <dev-branch>
|
|
||||||
```
|
|
||||||
|
|
||||||
6. Push your topic branch up to your fork:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git push origin <topic-branch-name>
|
|
||||||
```
|
|
||||||
|
|
||||||
7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
|
|
||||||
with a clear title and description.
|
|
||||||
|
|
||||||
**IMPORTANT**: By submitting a patch, you agree to allow the project owner to
|
|
||||||
license your work under the same license as that used by the project.
|
|
||||||
|
|||||||
@ -1,9 +0,0 @@
|
|||||||
### AWS-Deployment Guide
|
|
||||||
|
|
||||||
There are two ways of deploying the CVAT.
|
|
||||||
1. **On Nvidia GPU Machine:** Tensorflow annotation feature is dependent on GPU hardware. One of the easy ways to launch CVAT with the tf-annotation app is to use AWS P3 instances, which provides the NVIDIA GPU. Read more about [P3 instances here.](https://aws.amazon.com/about-aws/whats-new/2017/10/introducing-amazon-ec2-p3-instances/)
|
|
||||||
Overall setup instruction is explained in [main readme file](https://github.com/opencv/cvat/), except Installing Nvidia drivers. So we need to download the drivers and install it. For Amazon P3 instances, download the Nvidia Drivers from Nvidia website. For more check [Installing the NVIDIA Driver on Linux Instances](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-nvidia-driver.html) link.
|
|
||||||
|
|
||||||
2. **On Any other AWS Machine:** We can follow the same instruction guide mentioned in the [Readme file](https://github.com/opencv/cvat/). The additional step is to add a [security group and rule to allow incoming connections](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-network-security.html).
|
|
||||||
|
|
||||||
For any of above, don't forget to add exposed AWS public IP address to `docker-compose.override.com`.
|
|
||||||
@ -1,398 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2018 Intel Corporation
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* exported PolyshapeEditorModel PolyshapeEditorController PolyshapeEditorView */
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
class PolyshapeEditorModel extends Listener {
|
|
||||||
constructor() {
|
|
||||||
super("onPolyshapeEditorUpdate", () => this);
|
|
||||||
|
|
||||||
this._modeName = 'poly_editing';
|
|
||||||
this._active = false;
|
|
||||||
this._data = {
|
|
||||||
points: null,
|
|
||||||
color: null,
|
|
||||||
start: null,
|
|
||||||
oncomplete: null,
|
|
||||||
type: null,
|
|
||||||
event: null,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
edit(type, points, color, start, event, oncomplete) {
|
|
||||||
if (!this._active && !window.cvat.mode) {
|
|
||||||
window.cvat.mode = this._modeName;
|
|
||||||
this._active = true;
|
|
||||||
this._data.points = points;
|
|
||||||
this._data.color = color;
|
|
||||||
this._data.start = start;
|
|
||||||
this._data.oncomplete = oncomplete;
|
|
||||||
this._data.type = type;
|
|
||||||
this._data.event = event;
|
|
||||||
this.notify();
|
|
||||||
}
|
|
||||||
else if (this._active) {
|
|
||||||
throw Error('Polyshape has been being edited already');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
finish(points) {
|
|
||||||
if (this._active && this._data.oncomplete) {
|
|
||||||
this._data.oncomplete(points);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.cancel();
|
|
||||||
}
|
|
||||||
|
|
||||||
cancel() {
|
|
||||||
if (this._active) {
|
|
||||||
this._active = false;
|
|
||||||
if (window.cvat.mode != this._modeName) {
|
|
||||||
throw Error(`Inconsistent behaviour has been detected. Edit mode is activated, but mode variable is '${window.cvat.mode}'`);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
window.cvat.mode = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
this._data.points = null;
|
|
||||||
this._data.color = null;
|
|
||||||
this._data.start = null;
|
|
||||||
this._data.oncomplete = null;
|
|
||||||
this._data.type = null;
|
|
||||||
this._data.event = null;
|
|
||||||
this.notify();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
get active() {
|
|
||||||
return this._active;
|
|
||||||
}
|
|
||||||
|
|
||||||
get data() {
|
|
||||||
return this._data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class PolyshapeEditorController {
|
|
||||||
constructor(model) {
|
|
||||||
this._model = model;
|
|
||||||
}
|
|
||||||
|
|
||||||
finish(points) {
|
|
||||||
this._model.finish(points);
|
|
||||||
}
|
|
||||||
|
|
||||||
cancel() {
|
|
||||||
this._model.cancel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class PolyshapeEditorView {
|
|
||||||
constructor(model, controller) {
|
|
||||||
this._controller = controller;
|
|
||||||
this._data = null;
|
|
||||||
|
|
||||||
this._frameContent = SVG.adopt($('#frameContent')[0]);
|
|
||||||
this._originalShapePointsGroup = null;
|
|
||||||
this._originalShapePoints = [];
|
|
||||||
this._originalShape = null;
|
|
||||||
this._correctLine = null;
|
|
||||||
|
|
||||||
this._scale = window.cvat.player.geometry.scale;
|
|
||||||
this._frame = window.cvat.player.frames.current;
|
|
||||||
|
|
||||||
model.subscribe(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
_rescaleDrawPoints() {
|
|
||||||
let scale = this._scale;
|
|
||||||
$('.svg_draw_point').each(function() {
|
|
||||||
this.instance.radius(POINT_RADIUS / (2 * scale)).attr('stroke-width', STROKE_WIDTH / (2 * scale));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// After this method start element will be in begin of the array.
|
|
||||||
// Array will consist only range elements from start to stop
|
|
||||||
_resortPoints(points, start, stop) {
|
|
||||||
let sorted = [];
|
|
||||||
|
|
||||||
if (points.indexOf(start) === -1 || points.indexOf(stop) === -1) {
|
|
||||||
throw Error('Point array must consist both start and stop elements');
|
|
||||||
}
|
|
||||||
|
|
||||||
let idx = points.indexOf(start) + 1;
|
|
||||||
let condition = true; // constant condition is eslint error
|
|
||||||
while (condition) {
|
|
||||||
if (idx >= points.length) idx = 0;
|
|
||||||
if (points[idx] === stop) condition = false;
|
|
||||||
else sorted.push(points[idx++]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return sorted;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Method represents array like circle list and find shortest way from source to target
|
|
||||||
// It returns integer number - distance from source to target.
|
|
||||||
// It can be negative if shortest way is anti clockwise
|
|
||||||
_findMinCircleDistance(array, source, target) {
|
|
||||||
let clockwise_distance = 0;
|
|
||||||
let anti_clockwise_distance = 0;
|
|
||||||
|
|
||||||
let source_idx = array.indexOf(source);
|
|
||||||
let target_idx = array.indexOf(target);
|
|
||||||
|
|
||||||
if (source_idx === -1 || target_idx == -1) {
|
|
||||||
throw Error('Array should consist both elements');
|
|
||||||
}
|
|
||||||
|
|
||||||
let idx = source_idx;
|
|
||||||
while (array[idx++] != target) {
|
|
||||||
clockwise_distance ++;
|
|
||||||
if (idx >= array.length) idx = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
idx = source_idx;
|
|
||||||
while (array[idx--] != target) {
|
|
||||||
anti_clockwise_distance ++;
|
|
||||||
if (idx < 0) idx = array.length - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
let offset = Math.min(clockwise_distance, anti_clockwise_distance);
|
|
||||||
if (anti_clockwise_distance < clockwise_distance) {
|
|
||||||
offset = -offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
return offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
_startEdit() {
|
|
||||||
this._frame = window.cvat.player.frames.current;
|
|
||||||
let strokeWidth = this._data.type === 'points' ? 0 : STROKE_WIDTH / this._scale;
|
|
||||||
|
|
||||||
// Draw copy of original shape
|
|
||||||
if (this._data.type === 'polygon') {
|
|
||||||
this._originalShape = this._frameContent.polygon(this._data.points);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this._originalShape = this._frameContent.polyline(this._data.points);
|
|
||||||
}
|
|
||||||
|
|
||||||
this._originalShape.attr({
|
|
||||||
'stroke-width': strokeWidth,
|
|
||||||
'stroke': 'white',
|
|
||||||
'fill': 'none',
|
|
||||||
});
|
|
||||||
|
|
||||||
// Create the correct line
|
|
||||||
this._correctLine = this._frameContent.polyline().draw({snapToGrid: 0.1}).attr({
|
|
||||||
'stroke-width': strokeWidth / 2,
|
|
||||||
'fill': 'none',
|
|
||||||
'stroke': 'red',
|
|
||||||
}).on('mouseover', () => false);
|
|
||||||
|
|
||||||
|
|
||||||
// Add points to original shape
|
|
||||||
let pointRadius = POINT_RADIUS / this._scale;
|
|
||||||
this._originalShapePointsGroup = this._frameContent.group();
|
|
||||||
for (let point of PolyShapeModel.convertStringToNumberArray(this._data.points)) {
|
|
||||||
let uiPoint = this._originalShapePointsGroup.circle(pointRadius * 2)
|
|
||||||
.move(point.x - pointRadius, point.y - pointRadius)
|
|
||||||
.attr({
|
|
||||||
'stroke-width': strokeWidth,
|
|
||||||
'stroke': 'black',
|
|
||||||
'fill': 'white',
|
|
||||||
'z_order': Number.MAX_SAFE_INTEGER,
|
|
||||||
});
|
|
||||||
this._originalShapePoints.push(uiPoint);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let prevPoint = {
|
|
||||||
x: this._data.event.clientX,
|
|
||||||
y: this._data.event.clientY
|
|
||||||
};
|
|
||||||
|
|
||||||
this._correctLine.draw('point', this._data.event);
|
|
||||||
this._rescaleDrawPoints();
|
|
||||||
this._frameContent.on('mousemove.polyshapeEditor', (e) => {
|
|
||||||
if (e.shiftKey && this._data.type != 'points') {
|
|
||||||
let delta = Math.sqrt(Math.pow(e.clientX - prevPoint.x, 2) + Math.pow(e.clientY - prevPoint.y, 2));
|
|
||||||
let deltaTreshold = 15;
|
|
||||||
if (delta > deltaTreshold) {
|
|
||||||
this._correctLine.draw('point', e);
|
|
||||||
prevPoint = {
|
|
||||||
x: e.clientX,
|
|
||||||
y: e.clientY
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this._frameContent.on('contextmenu.polyshapeEditor', (e) => {
|
|
||||||
if (PolyShapeModel.convertStringToNumberArray(this._correctLine.attr('points')).length > 2) {
|
|
||||||
this._correctLine.draw('undo');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Finish without points argument is just cancel
|
|
||||||
this._controller.finish();
|
|
||||||
}
|
|
||||||
e.preventDefault();
|
|
||||||
e.stopPropagation();
|
|
||||||
});
|
|
||||||
|
|
||||||
this._correctLine.on('drawpoint', (e) => {
|
|
||||||
prevPoint = {
|
|
||||||
x: e.detail.event.clientX,
|
|
||||||
y: e.detail.event.clientY
|
|
||||||
};
|
|
||||||
this._rescaleDrawPoints();
|
|
||||||
});
|
|
||||||
|
|
||||||
this._correctLine.on('drawstart', () => this._rescaleDrawPoints());
|
|
||||||
|
|
||||||
|
|
||||||
for (let instance of this._originalShapePoints) {
|
|
||||||
instance.on('mouseover', () => {
|
|
||||||
instance.attr('stroke-width', STROKE_WIDTH * 2 / this._scale);
|
|
||||||
}).on('mouseout', () => {
|
|
||||||
instance.attr('stroke-width', STROKE_WIDTH / this._scale);
|
|
||||||
}).on('mousedown', (e) => {
|
|
||||||
if (e.which != 1) return;
|
|
||||||
let currentPoints = PolyShapeModel.convertStringToNumberArray(this._data.points);
|
|
||||||
let correctPoints = PolyShapeModel.convertStringToNumberArray(this._correctLine.attr('points'));
|
|
||||||
let resultPoints = [];
|
|
||||||
|
|
||||||
if (this._data.type === 'polygon') {
|
|
||||||
let startPtIdx = this._data.start;
|
|
||||||
let stopPtIdx = $(instance.node).index();
|
|
||||||
let offset = this._findMinCircleDistance(currentPoints, currentPoints[startPtIdx], currentPoints[stopPtIdx]);
|
|
||||||
|
|
||||||
if (!offset) {
|
|
||||||
currentPoints = this._resortPoints(currentPoints, currentPoints[startPtIdx], currentPoints[stopPtIdx]);
|
|
||||||
resultPoints.push(...correctPoints.slice(0, -2));
|
|
||||||
resultPoints.push(...currentPoints);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
resultPoints.push(...correctPoints);
|
|
||||||
if (offset < 0) {
|
|
||||||
resultPoints = resultPoints.reverse();
|
|
||||||
currentPoints = this._resortPoints(currentPoints, currentPoints[startPtIdx], currentPoints[stopPtIdx]);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
currentPoints = this._resortPoints(currentPoints, currentPoints[stopPtIdx], currentPoints[startPtIdx]);
|
|
||||||
}
|
|
||||||
|
|
||||||
resultPoints.push(...currentPoints);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (this._data.type === 'polyline') {
|
|
||||||
let startPtIdx = this._data.start;
|
|
||||||
let stopPtIdx = $(instance.node).index();
|
|
||||||
|
|
||||||
if (startPtIdx === stopPtIdx) {
|
|
||||||
resultPoints.push(...correctPoints.slice(1, -1).reverse());
|
|
||||||
resultPoints.push(...currentPoints);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (startPtIdx > stopPtIdx) {
|
|
||||||
if (startPtIdx < currentPoints.length - 1) {
|
|
||||||
resultPoints.push(...currentPoints.slice(startPtIdx + 1).reverse());
|
|
||||||
}
|
|
||||||
resultPoints.push(...correctPoints.slice(0, -1));
|
|
||||||
if (stopPtIdx > 0) {
|
|
||||||
resultPoints.push(...currentPoints.slice(0, stopPtIdx).reverse());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (startPtIdx > 0) {
|
|
||||||
resultPoints.push(...currentPoints.slice(0, startPtIdx));
|
|
||||||
}
|
|
||||||
resultPoints.push(...correctPoints.slice(0, -1));
|
|
||||||
if (stopPtIdx < currentPoints.length) {
|
|
||||||
resultPoints.push(...currentPoints.slice(stopPtIdx + 1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
resultPoints.push(...currentPoints);
|
|
||||||
resultPoints.push(...correctPoints.slice(1, -1).reverse());
|
|
||||||
}
|
|
||||||
|
|
||||||
this._correctLine.draw('cancel');
|
|
||||||
this._controller.finish(PolyShapeModel.convertNumberArrayToString(resultPoints));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_endEdit() {
|
|
||||||
for (let uiPoint of this._originalShapePoints) {
|
|
||||||
uiPoint.off();
|
|
||||||
uiPoint.remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
this._originalShapePoints = [];
|
|
||||||
this._originalShapePointsGroup.remove();
|
|
||||||
this._originalShapePointsGroup = null;
|
|
||||||
this._originalShape.remove();
|
|
||||||
this._originalShape = null;
|
|
||||||
this._correctLine.off('drawstart');
|
|
||||||
this._correctLine.off('drawpoint');
|
|
||||||
this._correctLine.draw('cancel');
|
|
||||||
this._correctLine.remove();
|
|
||||||
this._correctLine = null;
|
|
||||||
this._data = null;
|
|
||||||
|
|
||||||
this._frameContent.off('mousemove.polyshapeEditor');
|
|
||||||
this._frameContent.off('mousedown.polyshapeEditor');
|
|
||||||
this._frameContent.off('contextmenu.polyshapeEditor');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
onPolyshapeEditorUpdate(model) {
|
|
||||||
if (model.active && !this._data) {
|
|
||||||
this._data = model.data;
|
|
||||||
this._startEdit();
|
|
||||||
}
|
|
||||||
else if (!model.active) {
|
|
||||||
this._endEdit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onPlayerUpdate(player) {
|
|
||||||
let scale = player.geometry.scale;
|
|
||||||
if (this._scale != scale) {
|
|
||||||
this._scale = scale;
|
|
||||||
|
|
||||||
let strokeWidth = this._data && this._data.type === 'points' ? 0 : STROKE_WIDTH / this._scale;
|
|
||||||
let pointRadius = POINT_RADIUS / this._scale;
|
|
||||||
|
|
||||||
if (this._originalShape) {
|
|
||||||
this._originalShape.attr('stroke-width', strokeWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this._correctLine) {
|
|
||||||
this._correctLine.attr('stroke-width', strokeWidth / 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let uiPoint of this._originalShapePoints) {
|
|
||||||
uiPoint.attr('stroke-width', strokeWidth);
|
|
||||||
uiPoint.radius(pointRadius);
|
|
||||||
}
|
|
||||||
|
|
||||||
this._rescaleDrawPoints();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Abort if frame have been changed
|
|
||||||
if (player.frames.current != this._frame && this._data) {
|
|
||||||
this._controller.cancel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue