Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 6 additions & 102 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,104 +1,8 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
node_modules
*.log*
.nuxt
.nitro
.cache
.output
.env
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port
23 changes: 19 additions & 4 deletions src/App.vue → App.vue
Original file line number Diff line number Diff line change
@@ -1,21 +1,36 @@
<script setup lang="ts">

import { StarIcon } from '@heroicons/vue/24/solid'
// import { StarIcon } from '@heroicons/vue/24/solid'

import * as deployFit from './functions/deployFit'
import * as deployHeader from './functions/deployHeader'
import * as changeStretch from './functions/changeStretch'
import ExportFit from './components/exportFit.vue'


onMounted(() => {
const script = document.createElement("script");
script.type = "text/javascript";
script.src = "/fits.js";
document.body.appendChild(script);
})
onMounted(() => {
const script = document.createElement("script");
script.type = "stylesheet";
script.src = "/index.css";
document.body.appendChild(script);
})

</script>



<template>

<div id="nav" class="flex items-center justify-between h-24 px-4 mt-4">

<h1 class="font-bold text-[70px]">cosmoFits</h1>
<a href="https://github.com/codingTeach/cosmoFits" target="lang">
<StarIcon class="h-14 w-1h-14 text-yellow-400"></StarIcon>

</a>
</div>

Expand All @@ -36,7 +51,7 @@ import ExportFit from './components/exportFit.vue'
<option value='square'>Square</option>
<option value='sqrt'>Square root</option>
</select>
<label id='cursor_loc' class='monospaced'>[] </label>
<label id='cursor_loc' class='monospaced pt-3'>[] </label>

</div>
<div>
Expand Down
39 changes: 25 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,41 @@

# cosmoFits 🪐

## The cosmoFits project allows the reading and modification of .fts files
## The cosmoFits project allows the reading and modification of .fts files.

### Language:
- 🇬🇧 English
- 🇲🇽 [Español](./readme.es.md)
## Setup

Make sure to install the dependencies:

## Install
```bash
# yarn
yarn install

### Clone the project:
# npm
npm install

```
git clone https://github.com/codingTeach/cosmoFit
# pnpm
pnpm install --shamefully-hoist
```

Navigate to the project folder and install the dependencies:
## Development Server

```
cd cosmoFit && npm i
Start the development server on http://localhost:3000

```bash
npm run dev
```

### Run cosmoFits(dev) 🔥
## Production

```
npm run dev
Build the application for production:

```bash
npm run build
```

Locally preview production build:

```bash
npm run preview
```
30 changes: 15 additions & 15 deletions src/components/exportFit.vue → components/exportFit.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<script setup lang="ts" >
import { ref } from 'vue';
import { useFits } from "../store/store";
let image = ref<string>('')
const handleChange = () => {
image.value = useFits().imageBase64
image.value = ("data:image/jpeg;base64," + image.value);
return image.value
}
</script>
<template>
<a class="export" @click="handleChange" :href="image" download="">Export</a>
<script setup lang="ts" >
import { ref } from 'vue';
import { useFits } from "../store/store";

let image = ref<string>('')
const handleChange = () => {
image.value = useFits().imageBase64
image.value = ("data:image/jpeg;base64," + image.value);
return image.value
}

</script>

<template>
<a class="export" @click="handleChange" :href="image" download="">Export</a>
</template>
File renamed without changes.
30 changes: 28 additions & 2 deletions src/functions/deployFit.ts → functions/deployFit.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useFits } from "../store/store";
import {getId} from "./getId";


//@ts-ignore
Expand Down Expand Up @@ -36,8 +37,33 @@ const deployFit = (e) => {
useFits().imageBase64 = canvas.toDataURL('image/png').replace(/^data:image.+;base64,/, '')
//console.log(canvas.toDataURL('image/png').replace(/^data:image.+;base64,/, ''));


// fits.addMouseHandler(onMouse);
let last_mouse_loc: String;
const pad = (s: any, n: any) => {
s = s.toString();
let nadd = n - s.length;
for (let i = 0; i < nadd; i++)
s = "&nbsp;" + s;
return (s);
}

const showMouseLoc = () => {
let lid = getId('cursor_loc');

if (lid && last_mouse_loc) {

let pixel = fits.getPixelAtFITS(last_mouse_loc);
lid.innerHTML = "[" + pad(last_mouse_loc.x, 5) + ","
+ pad(last_mouse_loc.y, 5) + "] = "
+ pad(pixel.toFixed(1), 9);
}
}

const onMouse = (mouseloc: String) => {
last_mouse_loc = fits.image2FITS(mouseloc);
showMouseLoc();
}

fits.addMouseHandler(onMouse);
};

reader.readAsArrayBuffer(e.target.files[0]);
Expand Down
File renamed without changes.
5 changes: 5 additions & 0 deletions functions/getId.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const getId = (id: string) => {
return document.getElementById(id);
}

export { getId };
22 changes: 0 additions & 22 deletions index.html

This file was deleted.

12 changes: 12 additions & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { defineNuxtConfig } from 'nuxt'

// https://v3.nuxtjs.org/api/configuration/nuxt.config
export default defineNuxtConfig({
modules: [
'@unocss/nuxt',
'@pinia/nuxt',
],
css: [
'/public/index.css',
]
})
Loading