-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/GAIB20/tugas-besar-grafkom-…
- Loading branch information
Showing
15 changed files
with
72 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,27 @@ | ||
# React + TypeScript + Vite | ||
# 2D Web Based CAD (Computer-Aided Design) | ||
Program berbasis website ini dibuat untuk menyelesaikan Tugas Besar 1 IF3260 Grafika Komputer. | ||
|
||
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. | ||
## Deskripsi program | ||
|
||
Currently, two official plugins are available: | ||
Sebuah program CAD 2 dimensi telah dikembangkan sebagai bagian dari Tugas Besar 1 dalam mata kuliah IF3260 Grafika Komputer untuk tahun ajaran 2023/2024. Program ini diakses melalui sebuah website dan memungkinkan pengguna untuk membuat gambar menggunakan bentuk dasar seperti garis, persegi, persegi panjang, dan poligon. Selain itu, pengguna dapat mengubah posisi, warna, sudut, serta melakukan transformasi seperti translasi dan rotasi pada bentuk-bentuk tersebut. Model gambar yang telah dibuat dapat disimpan sebagai file dengan format .txt sehingga dapat diakses dan ditampilkan kembali di kemudian hari. | ||
|
||
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh | ||
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh | ||
## Menjalankan program | ||
### Requirement | ||
- Install browser yang men-support WEBGL | ||
- Install [Visual Studio Code](https://code.visualstudio.com\) | ||
- Pada VS Code, install ekstensi <strong>Live Share</strong> | ||
- pastikan memiliki nodejs dan typescript | ||
|
||
## Expanding the ESLint configuration | ||
### How to Run | ||
1. Ketik npm install | ||
2. Ketik npm run dev | ||
3. Website siap digunakan | ||
|
||
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules: | ||
<a name="anggota-kelompok"></a> | ||
|
||
- Configure the top-level `parserOptions` property like this: | ||
|
||
```js | ||
export default { | ||
// other rules... | ||
parserOptions: { | ||
ecmaVersion: 'latest', | ||
sourceType: 'module', | ||
project: ['./tsconfig.json', './tsconfig.node.json'], | ||
tsconfigRootDir: __dirname, | ||
}, | ||
} | ||
``` | ||
|
||
- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked` | ||
- Optionally add `plugin:@typescript-eslint/stylistic-type-checked` | ||
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list | ||
## Anggota Kelompok | ||
| Nama | NIM | | ||
| --------------------------- | -------- | | ||
| M. Rizky Syaban | 13521119 | | ||
| Saddam Annais S. | 13521121 | | ||
| Mohammad Rifqi Farhansyah | 13521166 | |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { AbstractShape } from "../shape/AbstractShape"; | ||
|
||
export function handleResizeLine(e: Event, shape: AbstractShape) { | ||
const slider = e.target as HTMLInputElement; | ||
const factor = parseInt(slider.value)/100; | ||
|
||
for (let i = 2; i < 4; i++) { | ||
if (factor >= shape.scaleFactor) { | ||
shape.locationArr[i] += (factor - shape.scaleFactor) * 20; | ||
} else { | ||
shape.locationArr[i] -= (shape.scaleFactor - factor) * 20; | ||
} | ||
} | ||
shape.scaleFactor = factor; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[{"type":"square","locationArr":[0,0,0,442.39791412353514,442.39791412353514,442.39791412353514,442.39791412353514,442.39791412353514,442.39791412353514,0,0,0],"translationArr":[501,16],"rotation":[-0.7771459614569708,0.6293203910498375],"color":[0.12288376193331674,0.6819231851508494,0.02011855913211691,1,0.6521104635978234,0.6111882029223266,0.7297087313059905,1,0.9562523152926989,0.41884364431407883,0.08337718745655631,1,0.9562523152926989,0.41884364431407883,0.08337718745655631,1,0.14102820795085935,0.6772213709120947,0.8455593964078902,1,0.12288376193331674,0.6819231851508494,0.02011855913211691,1],"scaleFactor":0.96,"scaleFactorX":0,"scaleFactorY":0}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[{"type":"square","locationArr":[0,0,0,301.7979141235351,301.7979141235351,301.7979141235351,301.7979141235351,301.7979141235351,301.7979141235351,0,0,0],"translationArr":[559,0],"rotation":[0,1],"color":[0.8389958115996887,0.2798377285706082,0.2113661353782852,1,0.3993281235543953,0.7293999095556012,0.0033155513711602413,1,0.4965935671937616,0.8372034624540028,0.4454660245545332,1,0.4965935671937616,0.8372034624540028,0.4454660245545332,1,0.1689598034578934,0.5644299728822628,0.32510601357524305,1,0.8389958115996887,0.2798377285706082,0.2113661353782852,1],"scaleFactor":1.48,"scaleFactorX":0,"scaleFactorY":0},{"type":"rectangle","locationArr":[0,0,0,124.61458206176758,437.82916412353495,124.61458206176758,437.82916412353495,124.61458206176758,437.82916412353495,0,0,0],"translationArr":[112,191],"rotation":[0,1],"color":[0.2939279714971894,0.6626058452029446,0.5492123877757804,1,0.38679352693239033,0.6645943251194597,0.664968179125953,1,0.25972882024523547,0.8322793530951034,0.7571089671627917,1,0.25972882024523547,0.8322793530951034,0.7571089671627917,1,0.12035656443569964,0.8674796824582045,0.6577415954038102,1,0.2939279714971894,0.6626058452029446,0.5492123877757804,1],"scaleFactor":0,"scaleFactorX":9.43,"scaleFactorY":0}] |