use of org.signal.imageeditor.core.SelectableRenderer in project Signal-Android by WhisperSystems.
the class EditorElementHierarchy method setOrUpdateSelectionThumbsForElement.
void setOrUpdateSelectionThumbsForElement(@NonNull EditorElement element, @Nullable Matrix overlayMappingMatrix) {
if (selectedElement != element) {
removeAllSelectionArtifacts();
if (element.getRenderer() instanceof SelectableRenderer) {
selectedElement = element;
} else {
selectedElement = null;
}
if (selectedElement == null)
return;
selection.addElement(createSelectionBox());
selection.addElement(createScaleControlThumb(element));
selection.addElement(createRotateControlThumb(element));
}
if (overlayMappingMatrix != null) {
Matrix selectionMatrix = selection.getLocalMatrix();
if (selectedElement.getRenderer() instanceof SelectableRenderer) {
SelectableRenderer renderer = (SelectableRenderer) selectedElement.getRenderer();
RectF bounds = new RectF();
renderer.getSelectionBounds(bounds);
selectionMatrix.setRectToRect(Bounds.FULL_BOUNDS, bounds, Matrix.ScaleToFit.FILL);
}
selectionMatrix.postConcat(overlayMappingMatrix);
}
}
use of org.signal.imageeditor.core.SelectableRenderer in project Signal-Android by signalapp.
the class EditorElementHierarchy method setOrUpdateSelectionThumbsForElement.
void setOrUpdateSelectionThumbsForElement(@NonNull EditorElement element, @Nullable Matrix overlayMappingMatrix) {
if (selectedElement != element) {
removeAllSelectionArtifacts();
if (element.getRenderer() instanceof SelectableRenderer) {
selectedElement = element;
} else {
selectedElement = null;
}
if (selectedElement == null)
return;
selection.addElement(createSelectionBox());
selection.addElement(createScaleControlThumb(element));
selection.addElement(createRotateControlThumb(element));
}
if (overlayMappingMatrix != null) {
Matrix selectionMatrix = selection.getLocalMatrix();
if (selectedElement.getRenderer() instanceof SelectableRenderer) {
SelectableRenderer renderer = (SelectableRenderer) selectedElement.getRenderer();
RectF bounds = new RectF();
renderer.getSelectionBounds(bounds);
selectionMatrix.setRectToRect(Bounds.FULL_BOUNDS, bounds, Matrix.ScaleToFit.FILL);
}
selectionMatrix.postConcat(overlayMappingMatrix);
}
}
Aggregations