Skip to content

Commit

Permalink
fix default grid size (#262)
Browse files Browse the repository at this point in the history
  • Loading branch information
madil4 authored Sep 8, 2023
1 parent 6735daf commit 7b3f7ca
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
20 changes: 10 additions & 10 deletions src/App/App.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const Default: StoryObj<Args> = {
args: {
script: `import { analyzing } from 'https://unpkg.com/awatif';
export const nodes = [[50, 50, 0], [80, 50, 0], [50, 50, 30]];
export const nodes = [[8, 12.5, 0], [15, 12.5, 0], [8, 12.5, 8]];;
export const elements = [[0, 1], [1, 2]]
export const assignments = [
Expand Down Expand Up @@ -50,7 +50,7 @@ export const UndeformedAndGridSize: StoryObj<Args> = {
args: {
script: `import { analyzing } from 'https://unpkg.com/awatif';
export const nodes = [[50, 50, 0], [80, 50, 0], [50, 50, 30]];;
export const nodes = [[8, 12.5, 0], [15, 12.5, 0], [8, 12.5, 8]];;;
export const elements = [[0, 1], [1, 2]]
export const assignments = [
Expand Down Expand Up @@ -82,7 +82,7 @@ export const analysisResults = analyzing(nodes, elements, assignments);
export const settings = {
deformedShape: false,
gridSize: 80
gridSize: 40
}`,
},
};
Expand All @@ -93,24 +93,24 @@ export const ParametersAndResults: StoryObj<Args> = {
export const parameters = {
xPosition: {
value: 80,
value: 15,
min: 1,
max: 100,
max: 20,
step: 1
},
zPosition: {
value: 0,
min: 0,
max: 100,
max: 10,
step: 1
}
}
export const onParameterChange = (parameters) => {
const nodes = [
[50, 50, 0],
[parameters.xPosition.value, 50, parameters.zPosition.value],
[50, 50, 30]];
[8, 12.5, 0],
[parameters.xPosition.value, 12.5, parameters.zPosition.value],
[8, 12.5, 8]];
const elements = [[0, 1], [1, 2]]
const assignments = [
Expand Down Expand Up @@ -153,7 +153,7 @@ export const settings = {

export const IndicesAndDisplayScale: StoryObj<Args> = {
args: {
script: `export const nodes = [[50, 50, 0], [80, 50, 0], [50, 50, 30]];
script: `export const nodes = [[8, 12.5, 0], [15, 12.5, 0], [8, 12.5, 8]];;
export const elements = [[0, 1], [1, 2]];
export const settings = {
Expand Down
2 changes: 1 addition & 1 deletion src/App/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function App(props: AppProps) {
});
const defaultScript = `import { analyzing } from 'https://unpkg.com/awatif';
export const nodes = [[50, 50, 0], [80, 50, 0], [50, 50, 30]];
export const nodes = [[8, 12.5, 0], [15, 12.5, 0], [8, 12.5, 8]];;
export const elements = [[0, 1], [1, 2]]
export const assignments = [
Expand Down
4 changes: 2 additions & 2 deletions src/Viewer/objects/ElementResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function ElementResult(props: ElementResultProps) {
const start = new THREE.Vector3(...convertAxesToAwatif(props.start));
const end = new THREE.Vector3(...convertAxesToAwatif(props.end));

const size = 4;
const size = 0.5;
const geometry = new THREE.PlaneGeometry(start.distanceTo(end), size);
const material = new THREE.MeshBasicMaterial({
color: props.result > 0 ? 0x005ce6 : 0xe62e00, // second 0xe62e00
Expand Down Expand Up @@ -66,7 +66,7 @@ export function ElementResult(props: ElementResultProps) {
plane.position.set(...start.toArray());
const lineLength = start.clone().sub(end).length();
plane.translateX(-lineLength / 2);
plane.translateY(size / 2 + 0.05 * size);
plane.translateY(size / 2);

// text
const textPosition = start.clone().add(end).multiplyScalar(0.5).toArray();
Expand Down

0 comments on commit 7b3f7ca

Please sign in to comment.