Gitlab CSE Unil
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
M. Chardon
ADIM
Commits
fab0d6d9
Commit
fab0d6d9
authored
Jan 18, 2017
by
M. Chardon
Browse files
enregistrement des déplacements des rectangles geomo
parent
e8f21dfe
Changes
1
Show whitespace changes
Inline
Side-by-side
adim_project/adim_app/static/_src/adim/tools/rectanglegeo.js
View file @
fab0d6d9
...
...
@@ -92,11 +92,11 @@ define(["paper", "tools/Shape.class","adim/category"], function (paper, Shape, C
setCategory
:
_setCategory
,
origin
:
origin
origin
:
origin
,
// Mouse Event
//
itemMouseDrag: itemMouseDrag,
//
itemMouseUp: itemMouseUp
itemMouseDrag
:
itemMouseDrag
,
itemMouseUp
:
itemMouseUp
// General attributes handlers
//setColor: _noop, //_setColor,
...
...
@@ -110,11 +110,10 @@ define(["paper", "tools/Shape.class","adim/category"], function (paper, Shape, C
};
// Add event listeners
//newRecGeo.onMouseDown = itemMouseDown;
//newRecGeo.onMouseDrag = itemMouseDrag; // --> in data.itemMouseDrag
//newRecGeo.onMouseUp = itemMouseUp;
if
(
eventListening
)
{
newRecGeo
.
onMouseDown
=
itemMouseDown
;
//newRecGeo.onKeyDown = itemKeyDown;
//newRecGeo.onKeyUp = itemKeyUp;
}
//newRecGeo.onPropertyChange = itemPropertyChange;
...
...
@@ -204,7 +203,56 @@ define(["paper", "tools/Shape.class","adim/category"], function (paper, Shape, C
_recGeoChanged
=
false
;
}
}
_editedSegmentIdx
=
_editedStriaLeftIdx
=
_editedStriaRightIdx
=
_editedStria
=
_editedSegmentXLimit
=
null
;
_editedSegmentIdx
=
_editedStriaLeftIdx
=
_editedStriaRightIdx
=
_editedRecGeo
=
_editedSegmentXLimit
=
null
;
}
function
itemMouseDown
(
event
)
{
var
hitItem
=
this
;
_editedRecGeo
=
this
;
var
hitResult
=
hitItem
.
hitTest
(
event
.
point
,
hitOptions
);
hitItem
.
layer
.
activate
();
paper
.
project
.
deselectAll
();
hitItem
.
selected
=
true
;
_events
.
annotationSelected
.
dispatch
(
hitItem
);
/*_editedSegmentIdx = _editedStriaLeftIdx = _editedStriaRightIdx = _editedSegmentXLimit = null;
if (hitResult.type === 'segment') {
_editedSegmentIdx = hitResult.segment.index;
_editedSegmentXLimit = _cutPosition + (
(_editedStria.segments[1-_editedSegmentIdx].point.x < _cutPosition ? 1 : -1) * _cutThreshold
);
} else {
_editedStriaLeftIdx = (_editedStria.getFirstSegment().point.x < _cutPosition) ? 0 : 1;
_editedStriaRightIdx = 1 - _editedStriaLeftIdx;
}*/
_redGeoChanged
=
false
;
_events
.
annotationSelected
.
dispatch
(
hitItem
);
}
function
itemMouseDrag
(
event
)
{
// Handle only event forwarded by tools
if
(
!
event
.
tool
)
return
;
_recGeoChanged
=
true
;
this
.
translate
(
event
.
delta
);
this
.
data
.
origin
.
from
.
x
+=
event
.
delta
.
x
;
this
.
data
.
origin
.
from
.
y
+=
event
.
delta
.
y
;
this
.
data
.
origin
.
to
.
x
+=
event
.
delta
.
x
;
this
.
data
.
origin
.
to
.
y
+=
event
.
delta
.
y
;
}
function
itemMouseUp
(
event
)
{
if
(
!
event
.
tool
)
// catches only tool's events
return
;
if
(
_recGeoChanged
)
{
_events
.
annotationChanged
.
dispatch
(
this
);
}
_recGeoChanged
=
false
;
}
function
cancelCreate
()
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment