Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-gantt-editor
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
project-open
intranet-gantt-editor
Commits
21b8bb3d
Commit
21b8bb3d
authored
Nov 09, 2016
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Fixed DnD configuration of milestones
- Fixed the display of resources behind a sprite
parent
cff96aab
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
20 deletions
+25
-20
GanttBarPanel.js
www/view/GanttBarPanel.js
+25
-20
No files found.
www/view/GanttBarPanel.js
View file @
21b8bb3d
...
...
@@ -41,13 +41,12 @@ Ext.define('GanttEditor.view.GanttBarPanel', {
// Default values for axis startDate and endDate
var
oneDayMiliseconds
=
24
*
3600
*
1000
;
me
.
axisEndX
=
2000
;
// Size of the time axis. Always starts with 0.
me
.
axisEndX
=
2000
;
// Size of the time axis. Always starts with 0.
me
.
axisStartDate
=
new
Date
(
me
.
reportStartTime
-
1.5
*
oneDayMiliseconds
);
me
.
axisEndDate
=
new
Date
(
me
.
reportEndTime
+
1.5
*
(
me
.
reportEndTime
-
me
.
reportStartTime
)
+
7
*
oneDayMiliseconds
);
// Set axis and scroll configuration if saved in the preference store
me
.
redrawSetScrolls
();
// !!!
// Catch the moment when the "view" of the Project grid
// is ready in order to draw the GanttBars for the first time.
...
...
@@ -378,7 +377,7 @@ Ext.define('GanttEditor.view.GanttBarPanel', {
if
(
me
.
debug
)
console
.
log
(
'PO.class.GanttDrawComponent.redraw: numNodes='
+
numNodes
);
me
.
surface
.
removeAll
();
me
.
surface
.
setSize
(
me
.
axisEndX
,
surfaceYSize
);
// Set the size of the drawing area
me
.
surface
.
setSize
(
me
.
axisEndX
,
surfaceYSize
);
// Set the size of the drawing area
me
.
drawAxisAuto
();
// Draw the top axis
// Iterate through all children of the root node and check if they are visible
...
...
@@ -472,7 +471,7 @@ Ext.define('GanttEditor.view.GanttBarPanel', {
var
drawn
=
null
;
// Task with zero length: Draw a milestone
if
(
!
drawn
&&
project
.
isMilestone
())
{
// either explicitely marked or zero duration
if
(
!
drawn
&&
project
.
isMilestone
())
{
// either explicitely marked or zero duration
drawn
=
"milestone"
;
var
m
=
h
/
2
;
// Half the size of the bar height
var
spriteBar
=
surface
.
add
({
...
...
@@ -494,7 +493,7 @@ Ext.define('GanttEditor.view.GanttBarPanel', {
}
// Draw a standard Gantt bar if the task is a leaf (has no children)
if
(
!
drawn
&&
!
project
.
hasChildNodes
())
{
// Parent tasks don't have DnD and look different
if
(
!
drawn
&&
!
project
.
hasChildNodes
())
{
// Parent tasks don't have DnD and look different
drawn
=
"bar"
;
// The main Gantt bar with Drag-and-Drop configuration
var
spriteBar
=
surface
.
add
({
...
...
@@ -527,8 +526,8 @@ Ext.define('GanttEditor.view.GanttBarPanel', {
if
(
me
.
debug
)
console
.
log
(
'PO.view.gantt.GanttBarPanel.drawProjectBar.spriteBarHandle.dragAction:'
);
var
baseBBox
=
panel
.
dndBaseSprite
.
getBBox
();
var
shadow
=
panel
.
dndShadowSprite
;
var
width
=
baseBBox
.
width
+
diff
[
0
];
if
(
width
<
0
)
width
=
0
;
var
width
=
baseBBox
.
width
+
diff
[
0
];
if
(
width
<
0
)
width
=
0
;
shadow
.
setAttributes
({
width
:
width
}).
show
(
true
);
},
dropAction
:
function
(
panel
,
e
,
diff
,
dndConfig
)
{
...
...
@@ -608,7 +607,7 @@ Ext.define('GanttEditor.view.GanttBarPanel', {
}).
show
(
true
);
}
if
(
!
drawn
)
{
alert
(
'GanttBarPanel.drawProjectBar: not drawn'
);
}
if
(
!
drawn
)
{
alert
(
'GanttBarPanel.drawProjectBar: not drawn'
);
}
// Convert assignment information into a string
// and write behind the Gantt bar
...
...
@@ -625,15 +624,21 @@ Ext.define('GanttEditor.view.GanttBarPanel', {
text
=
text
+
'['
+
assignee
.
percent
+
'%]'
;
}
});
var
axisText
=
surface
.
add
({
type
:
'text'
,
text
:
text
,
x
:
x
+
w
+
2
,
y
:
y
+
d
,
fill
:
'#000'
,
font
:
"10px Arial"
}).
show
(
true
);
var
xOffset
=
w
+
4
;
// Default: Start directly behind the bar
switch
(
drawn
)
{
case
'milestone'
:
xOffset
=
8
;
// Milestone: Ignore bar width, but add some extra space
}
var
axisText
=
surface
.
add
({
type
:
'text'
,
text
:
text
,
x
:
x
+
xOffset
,
y
:
y
+
d
,
fill
:
'#000'
,
font
:
"10px Arial"
}).
show
(
true
);
}
// Add a drag-and-drop configuration to all spriteBars (bar, supertask and milestone)
// in order to allow them to act as both source and target of inter-task dependencies.
spriteBar
.
dndConfig
=
{
// Drag-and-drop configuration
// Add a drag-and-drop configuration to all spriteBars (bar, supertask and milestone)
// in order to allow them to act as both source and target of inter-task dependencies.
spriteBar
.
dndConfig
=
{
// Drag-and-drop configuration
model
:
project
,
// Store the task information for the sprite
baseSprite
:
spriteBar
,
// "Base" sprite for the DnD action
dragAction
:
function
(
panel
,
e
,
diff
,
dndConfig
)
{
// Executed onMouseMove in AbstractGanttPanel
dragAction
:
function
(
panel
,
e
,
diff
,
dndConfig
)
{
// Executed onMouseMove in AbstractGanttPanel
var
shadow
=
panel
.
dndShadowSprite
;
// Sprite "shadow" (copy of baseSprite) to move around
var
linkSprite
=
panel
.
dndLinkSprite
;
if
(
diff
[
1
]
>
10
||
diff
[
1
]
<
-
10
)
{
...
...
@@ -643,18 +648,18 @@ Ext.define('GanttEditor.view.GanttBarPanel', {
linkSprite
.
setAttributes
(
{
x
:
point
[
0
],
y
:
point
[
1
]
-
5
},
true
);
}
else
{
shadow
.
show
(
true
);
shadow
.
setAttributes
({
translate
:
{
x
:
diff
[
0
],
y
:
0
}},
true
);
// Move shadow according to mouse position
shadow
.
setAttributes
({
translate
:
{
x
:
diff
[
0
],
y
:
0
}},
true
);
// Move shadow according to mouse position
linkSprite
.
hide
(
true
);
};
},
dropAction
:
function
(
panel
,
e
,
diff
,
dndConfig
)
{
// Executed onMouseUp in AbastractGanttPanel
dropAction
:
function
(
panel
,
e
,
diff
,
dndConfig
)
{
// Executed onMouseUp in AbastractGanttPanel
if
(
me
.
debug
)
console
.
log
(
'PO.view.gantt.GanttBarPanel.drawProjectBar.spriteBar.dropAction:'
);
panel
.
dndLinkSprite
.
destroy
();
// Hide Link graphic
panel
.
dndLinkSprite
.
destroy
();
// Hide Link graphic
var
point
=
me
.
getMousePoint
(
e
);
// Corrected mouse coordinates
var
baseSprite
=
panel
.
dndBaseSprite
;
// spriteBar to be affected by DnD
if
(
!
baseSprite
)
{
return
;
}
// Something went completely wrong...
var
baseSprite
=
panel
.
dndBaseSprite
;
// spriteBar to be affected by DnD
if
(
!
baseSprite
)
{
return
;
}
// Something went completely wrong...
var
dropSprite
=
panel
.
getSpriteForPoint
(
point
);
// Check where the user has dropped the shadow
if
(
baseSprite
==
dropSprite
)
{
dropSprite
=
null
;
}
// Dropped on same sprite? => normal drop
if
(
baseSprite
==
dropSprite
)
{
dropSprite
=
null
;
}
// Dropped on same sprite? => normal drop
if
(
0
==
Math
.
abs
(
diff
[
0
])
+
Math
.
abs
(
diff
[
1
]))
{
// Same point as before?
return
;
// Drag-start == drag-end or single-click
}
...
...
@@ -667,7 +672,7 @@ Ext.define('GanttEditor.view.GanttBarPanel', {
};
// if (me.debug) { if (me.debug) console.log('PO.view.gantt.GanttBarPanel.drawProjectBar: Finished'); }
// if (me.debug) { if (me.debug) console.log('PO.view.gantt.GanttBarPanel.drawProjectBar: Finished'); }
},
/**
...
...
Write
Preview
Markdown
is supported
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