akiraux / libgtkcanvas Goto Github PK
View Code? Open in Web Editor NEWA Clutter based canvas written in Vala
License: GNU Lesser General Public License v3.0
A Clutter based canvas written in Vala
License: GNU Lesser General Public License v3.0
Granite is required by meson but isn't listed as a dependency in the readme.
I would love if no hard granite dependency is added to libgtkcanvas, or this library will be elementary only.
A soft dependency, will allow to use this library in projects not targeting elementary and will spread it usage.
I've implemented that like this:
If the object is rotated, by dragging the node, by a rotation
amount (in degrees, for this example), then the actual rotation would be equal to:
rotation - rotation % 15
For example, if the input rotation is 67°, then the applied rotation would be 67 - 67 % 15 = 67 - 7 = 60.
And that works fine. However, this isn't the default behavior in 99% of the software I've used, but rather, it's freehand rotation, until you press a key (most likely Ctrl
), and then the snapping is applied. And currently I don't know how to detect whether Ctrl
is pressed or not, so I can't finish this feature on my own (if I figure it out, I will send in a PR).
Currently all implementations are classes, but this will be a problem for external implementations of Items and Shapes, so I think they should be converted to Interfaces and actual classes convert (by renaming) them to default implementations.
Example:
public interface GtkCanvas.Item : Object, Actor {
public signal void selected (Clutter.ModifierType modifiers);
(.. convert to abstract or virtual methods)
}
/* Current GtkCanvas.CanvasItem could be renamed to GtkCanvas.GcItem */
Why?
Because I'm implementing GSVGtk with objects to draw SVG images and shapes, so libgtkcanvas can add classes derived from GSVGtk ones and implementing libgtkcanvas interfaces, so it will get SVG shapes for free.
Things to keep in mind:
I propose following directory/files structure:
ROOT
meson.build
src
All library VALA files
meson.build
demo
Window.vala
meson.build
data
meson.build
gtkcanvas.pc.in
No subdirectories in SRC and all files related to the library are there.
If you Agree, I'll continue a PR ASAP.
The math has been done at https://github.com/Philip-Scott/Spice-up/blob/master/src/Widgets/CanvasItems/CanvasItem.vala#L297.
but not sure if the order of the coords is different in clutter... (it shouldn't be though(
This kind of libraries, is useful for many other type of projects, so making it LGPL will help to be adopted by open-source and proprietary software.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.