Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
digilib-pivaj
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Daniel ANTELME
digilib-pivaj
Commits
9ed93264
Commit
9ed93264
authored
10 years ago
by
hertzhaft
Browse files
Options
Downloads
Patches
Plain Diff
seems we need not save editable state when drawing a shape
parent
6caf1ca6
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
webapp/src/main/webapp/jquery/jquery.digilib.vector.js
+15
-21
15 additions, 21 deletions
webapp/src/main/webapp/jquery/jquery.digilib.vector.js
with
15 additions
and
21 deletions
webapp/src/main/webapp/jquery/jquery.digilib.vector.js
+
15
−
21
View file @
9ed93264
...
...
@@ -629,7 +629,7 @@
var
pt
=
geom
.
position
(
evt
);
// setup shape
var
p
=
data
.
imgTrafo
.
invtransform
(
pt
);
var
vtx
idx
=
1
;
var
vtx
=
1
;
if
(
shapeType
===
'
Point
'
)
{
shape
.
geometry
.
coordinates
=
[[
p
.
x
,
p
.
y
]];
}
else
if
(
isSupported
(
data
,
shapeType
))
{
...
...
@@ -639,14 +639,12 @@
$overlayDiv
.
remove
();
return
false
;
}
// save editable state and set to non-editable
if
(
shape
.
properties
!=
null
)
{
shape
.
properties
.
_editable
=
shape
.
properties
.
editable
;
shape
.
properties
.
editable
=
false
;
shape
.
properties
.
screenpos
=
[
pt
];
}
else
{
// shape is not editable by default
if
(
shape
.
properties
==
null
)
{
shape
.
properties
=
{
'
editable
'
:
false
};
}
}
// save first mousedown position
shape
.
properties
.
screenpos
=
[
pt
];
// draw shape
renderShape
(
data
,
shape
,
layer
);
// vertex drag end handler
...
...
@@ -657,21 +655,21 @@
// single click adds next line to LineString/Polygon
unrenderShape
(
data
,
shape
);
// copy last vertex as starting point
coords
.
push
(
coords
[
vtx
idx
].
slice
());
vtx
idx
+=
1
;
coords
.
push
(
coords
[
vtx
].
slice
());
vtx
+=
1
;
// draw shape
renderShape
(
data
,
shape
,
layer
);
// execute vertex drag handler on next vertex
getVertexDragHandler
(
data
,
shape
,
vtx
idx
,
vertexDragDone
)(
evt
);
getVertexDragHandler
(
data
,
shape
,
vtx
,
vertexDragDone
)(
evt
);
return
false
;
}
else
if
(
evt
.
type
===
'
dblclick
'
)
{
// double click ends LineString/Polygon
// remove duplicate vertices (from mouseup)
var
rerender
=
false
;
while
(
coords
[
vtx
idx
][
0
]
===
coords
[
vtx
idx
-
1
][
0
]
&&
coords
[
vtx
idx
][
1
]
===
coords
[
vtx
idx
-
1
][
1
])
{
while
(
coords
[
vtx
][
0
]
===
coords
[
vtx
-
1
][
0
]
&&
coords
[
vtx
][
1
]
===
coords
[
vtx
-
1
][
1
])
{
coords
.
pop
();
vtx
idx
-=
1
;
vtx
-=
1
;
rerender
=
true
;
}
if
(
rerender
)
{
...
...
@@ -690,27 +688,23 @@
shapeDone
(
data
,
shape
);
}
else
{
// execute vertex drag handler on second vertex
getVertexDragHandler
(
data
,
shape
,
vtx
idx
,
vertexDragDone
)(
evt
);
getVertexDragHandler
(
data
,
shape
,
vtx
,
vertexDragDone
)(
evt
);
}
return
false
;
};
var
shapeDone
=
function
(
data
,
shape
)
{
// defining shape done
if
(
shape
.
properties
.
_editable
!=
null
)
{
// re-set editable
unrenderShape
(
data
,
shape
);
shape
.
properties
.
editable
=
shape
.
properties
.
_editable
;
delete
shape
.
properties
.
_editable
;
renderShape
(
data
,
shape
,
layer
);
}
// save shape
// save shape
layer
.
shapes
.
push
(
shape
);
$overlayDiv
.
remove
();
if
(
onComplete
!=
null
)
{
onComplete
(
data
,
shape
);
}
};
// start by clicking
$overlayDiv
.
one
(
'
mousedown.dlShape
'
,
shapeStart
);
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment