mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-07 12:24:58 +10:00
Improved rendering performance and reduced lagging with complex projects while dragging components around
This commit is contained in:
@@ -1740,10 +1740,13 @@ public class Presenter implements IPlugInPort {
|
||||
}
|
||||
}
|
||||
|
||||
// Remove from area map.
|
||||
drawingManager.clearComponentAreaMap();
|
||||
// only the moved components need their areas re-tracked, rebuilding every area on each drag
|
||||
// step makes dragging slow in large projects
|
||||
for (IDIYComponent<?> c : controlPointMap.keySet()) {
|
||||
drawingManager.invalidateComponent(c);
|
||||
}
|
||||
drawingManager.clearContinuityArea();
|
||||
|
||||
|
||||
return new Point2D.Double(actualDx, actualDy);
|
||||
}
|
||||
|
||||
|
||||
@@ -605,6 +605,10 @@
|
||||
<changeType>IMPROVEMENT</changeType>
|
||||
<description>Include 'Potentiometer (Miniature)' and 'Trimmer Potentiometer' in Guitar Wiring Analyzer</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>IMPROVEMENT</changeType>
|
||||
<description>Improved rendering performance and reduced lagging with complex projects while dragging components around</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>IMPROVEMENT</changeType>
|
||||
<description>Improve performance of 'Project Explorer' pane</description>
|
||||
|
||||
+23
-6
@@ -435,27 +435,44 @@ public abstract class AbstractLeadedComponent<T> extends AbstractLabeledComponen
|
||||
}
|
||||
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
if (shouldShadeLeads()) {
|
||||
|
||||
// a long dashed or dotted lead strokes into hundreds of segments and building the tracked area
|
||||
// from them costs tens of milliseconds per repaint, so track the lead as one solid stroke
|
||||
// instead, which also keeps the gaps between dashes clickable
|
||||
boolean trackSolidLead = getStyle() != LineStyle.SOLID && !isCopperArea;
|
||||
if (trackSolidLead) {
|
||||
Stroke solidStroke = ObjectCache.getInstance().fetchStroke(thickness,
|
||||
getEndingStyle() == LineEndingStyle.Round ? BasicStroke.CAP_ROUND : BasicStroke.CAP_BUTT);
|
||||
g2d.setColor(Constants.TRANSPARENT_COLOR);
|
||||
g2d.fill(solidStroke.createStrokedShape(line));
|
||||
observer.stopTracking();
|
||||
}
|
||||
|
||||
if (shouldShadeLeads()) {
|
||||
Shape lineShape = stroke.createStrokedShape(line);
|
||||
|
||||
|
||||
g2d.setColor(getLeadColorForPainting(componentState));
|
||||
g2d.fill(lineShape);
|
||||
|
||||
|
||||
if (isCopperArea)
|
||||
observer.stopTrackingContinuityArea();
|
||||
|
||||
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1f));
|
||||
Color leadColor = getLeadColorForPainting(componentState);
|
||||
g2d.setColor(leadColor.darker());
|
||||
g2d.draw(lineShape);
|
||||
g2d.draw(lineShape);
|
||||
} else {
|
||||
g2d.setColor(getLeadColorForPainting(componentState));
|
||||
g2d.setStroke(stroke);
|
||||
g2d.draw(line);
|
||||
|
||||
|
||||
if (isCopperArea)
|
||||
observer.stopTrackingContinuityArea();
|
||||
}
|
||||
|
||||
if (trackSolidLead) {
|
||||
observer.startTracking();
|
||||
}
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user