Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
hamoid committed Oct 24, 2024
1 parent c7e7960 commit ce5a6af
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 18 deletions.
8 changes: 4 additions & 4 deletions docs/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ source "https://rubygems.org"
#
# This will help ensure the proper Jekyll version is running.

gem "jekyll", "~> 4.3.3"
gem "jekyll", "~> 4.3.4"
gem "json"
gem "just-the-docs"

Expand All @@ -17,19 +17,19 @@ gem "just-the-docs"
# gem "github-pages", group: :jekyll_plugins
# If you have any plugins, put them here!
group :jekyll_plugins do
gem "jekyll-feed", "~> 0.12"
gem "jekyll-feed", "~> 0.17.0"
gem 'jekyll-sitemap'
end

# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem
# and associated library.
platforms :mingw, :x64_mingw, :mswin, :jruby do
gem "tzinfo", "~> 1.2"
gem "tzinfo", "~> 2.0.6"
gem "tzinfo-data"
end

# Performance-booster for watching directories on Windows
gem "wdm", "~> 0.1.1", :platforms => [:mingw, :x64_mingw, :mswin]
gem "wdm", "~> 0.2.0", :platforms => [:mingw, :x64_mingw, :mswin]

gem "jekyll-remote-theme"

Expand Down
26 changes: 13 additions & 13 deletions docs/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,18 @@ GEM
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
colorator (1.1.0)
concurrent-ruby (1.2.3)
concurrent-ruby (1.3.4)
em-websocket (0.5.3)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0)
eventmachine (1.2.7)
ffi (1.16.3)
ffi (1.17.0-x86_64-linux-gnu)
forwardable-extended (2.6.0)
google-protobuf (3.25.3-x86_64-linux)
http_parser.rb (0.8.0)
i18n (1.14.3)
i18n (1.14.5)
concurrent-ruby (~> 1.0)
racc (~> 1.7)
jekyll (4.3.3)
jekyll (4.3.4)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
Expand Down Expand Up @@ -67,17 +66,18 @@ GEM
pathutil (0.16.2)
forwardable-extended (~> 2.6)
public_suffix (5.0.4)
racc (1.7.3)
rake (13.1.0)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
rb-inotify (0.11.1)
ffi (~> 1.0)
rexml (3.2.6)
rouge (4.2.0)
rexml (3.3.6)
strscan
rouge (4.2.1)
rubyzip (2.3.2)
safe_yaml (1.0.5)
sass-embedded (1.69.5-x86_64-linux-gnu)
google-protobuf (~> 3.23)
strscan (3.1.0)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
unicode-display_width (2.5.0)
Expand All @@ -87,16 +87,16 @@ PLATFORMS
x86_64-linux

DEPENDENCIES
jekyll (~> 4.3.3)
jekyll-feed (~> 0.12)
jekyll (~> 4.3.4)
jekyll-feed (~> 0.17.0)
jekyll-include-cache
jekyll-remote-theme
jekyll-sitemap
json
just-the-docs
tzinfo (~> 1.2)
tzinfo (~> 2.0.6)
tzinfo-data
wdm (~> 0.1.1)
wdm (~> 0.2.0)

BUNDLED WITH
2.4.13
35 changes: 34 additions & 1 deletion docs/interaction/fileDrops.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
layout: default
title: File Drops
parent: Interaction
last_modified_at: 2024.09.06 17:25:36 +0200
last_modified_at: 2024.10.24 11:08:44 +0200
nav_order: 120
has_children: false
---
Expand All @@ -22,5 +22,38 @@ fun main() = application {
}
}
```

The following program displays `PNG`, `JPG` or `TIF` images
dropped onto its window. If several files are dropped at once,
it displays the first of them that is an image.

```kotlin
fun main() = application {
program {
// Create a dummy image
var img = drawImage(16, 16) {}

window.drop.listen { dropped ->
val firstImage = dropped.files.firstOrNull {
File(it).extension.lowercase() in listOf("png", "jpg", "tif")
}

if (firstImage != null) {
// Call .destroy() to avoid leaking memory
img.destroy()

// Then load a new image into img
img = loadImage(firstImage)
}
}
extend {
drawer.imageFit(img, drawer.bounds, fitMethod = FitMethod.Contain)
}
}
}
```

By using `drawer.imageFit` the image is centered
and made to fit the available window size.

[edit on GitHub](https://github.com/openrndr/openrndr-guide/blob/main/src/main/kotlin/docs/40_Interaction/C120_FileDrops.kt){: .btn .btn-github }

0 comments on commit ce5a6af

Please sign in to comment.