Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix many issues with link, add pure java version #484

Merged
merged 3 commits into from Jan 12, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

124 changes: 124 additions & 0 deletions desktop/ConstraintLayoutInspector/.idea/uiDesigner.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified desktop/ConstraintLayoutInspector/Link.jar
Binary file not shown.
Expand Up @@ -16,18 +16,13 @@
package androidx.constraintLayout.desktop.constraintRendering.layout3d;


import androidx.constraintLayout.desktop.link.LayoutView;

import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferInt;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.prefs.Preferences;

import java.util.List;
import androidx.constraintLayout.desktop.link.*;

/**
* This is a simple test driver for the 3d engine
Expand Down Expand Up @@ -81,6 +76,7 @@ public static Layout.Widget getTestViews(BufferedImage img) {
return v;
}


private void savePref() {
Preferences prefs = Preferences.userNodeForPackage(CheckLayout3d.class);
final String ORIENTATION = "name_of_preference";
Expand Down Expand Up @@ -115,10 +111,11 @@ public static void create(Layout.Widget views, BufferedImage img) {
}


public static Layout.Widget get3dWidgets(ArrayList<LayoutView.Widget> widgets) {
public static Layout.Widget get3dWidgets(List<Widget> widgets) {

Layout.Widget rw = null;
for (LayoutView.Widget widget : widgets) {

for (Widget widget : widgets) {
float top = widget.getInterpolated().top;
float bottom = widget.getInterpolated().bottom;
float left = widget.getInterpolated().left;
Expand All @@ -133,7 +130,7 @@ public static Layout.Widget get3dWidgets(ArrayList<LayoutView.Widget> widgets) {
return null;
}
float z = 0;
for (LayoutView.Widget widget : widgets) {
for (Widget widget : widgets) {
float top = widget.getInterpolated().top;
float bottom = widget.getInterpolated().bottom;
float left = widget.getInterpolated().left;
Expand All @@ -151,12 +148,13 @@ public static Layout.Widget get3dWidgets(ArrayList<LayoutView.Widget> widgets) {
}

BufferedImage img;
public void update(ArrayList<LayoutView.Widget> widgets) {

public void update(List<Widget> widgets) {
myDisplay3D.updateTriData(new Layout(img, get3dWidgets(widgets)));
myDisplay3D.isImageInvalid = true;
myDisplay3D.repaint();
}
public static CheckLayout3d create3d(ArrayList<LayoutView.Widget> widgets) {
public static CheckLayout3d create3d(List<Widget> widgets) {
JFrame f = new JFrame("CheckTriangles");
CheckLayout3d p = new CheckLayout3d();
f.setContentPane(p);
Expand Down
@@ -0,0 +1,25 @@
/*
* Copyright 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package androidx.constraintLayout.desktop.link;

import androidx.constraintlayout.core.parser.CLElement;

public interface DesignSurfaceModification {
CLElement getElement(String name);

void updateElement(String name, CLElement content);
}