Git Product home page Git Product logo

dimitrov-adrian / directus-extension-svgmap-picker-interface Goto Github PK

View Code? Open in Web Editor NEW
31.0 4.0 1.0 1.19 MB

Select a value from a SVG Map box

Home Page: https://www.npmjs.com/package/directus-extension-svgmap-picker-interface

License: GNU General Public License v3.0

TypeScript 9.00% Vue 33.47% JavaScript 57.52%
directus directus-extension directus-extension-interface svg-map image-map image-map-picker

directus-extension-svgmap-picker-interface's Introduction

This extension is under development, it may take breaking changes.

SVG Map Picker

Selecting a value from a SVG Map box.

Basically it's intended to be a select-dropdown or checkboxes replacement, where is required to pick a value from predefined list, and is nice to have good visual feedback.

Example usages could be:

  • Regional maps (where region code or ID is required to emit, instead of GEO location)
  • Automotive parts categories
  • Human body parts

... etc

Installation

In your Directus installation root

npm install directus-extension-svgmap-picker-interface

Restart directus

How to use

  1. Create new standard field with String or Numeric type
  2. For interface select SVG Map Picker
  3. Setup the selector to match all targeted elements
  4. Put your SVG image as a XML document in the SVG field

FAQ

What type of SVG I can use?

You can use whatever SVGs you like, it is just necessery to have good way to select items (class names are good way to go) and have data-value attribute with desired values.

Can I use custom styling for hover and active states?

Yes, just use :hover pseudo class for hovering effect and .active class name for current selected item.

How to use as M2O interface?

Just setup and ensure the data-value is set to coresponding allowed ID of target collection.

Can I bundle my own SVG in order to reduce manual work?

Yes, you could benefit from the reusability and custom Directus extensions, so you could create your own packed version. Just take in mind that you still need to have this extension installed, even using custom bundles.

About how to do that, check the premade demo bundles on demo maps. Every of these is ready to be placed in your ./extensions/interfaces

Example

Selector: .choice

SVG:

<svg width="250" height="50" xmlns="http://www.w3.org/2000/svg">

	<!-- Custom styling using :hover and .active classes -->

	<style>
		.choice:hover path {
			fill-opacity: .9;
		}
		.choice:hover path {
			fill-opacity: .75;
		}
		.choice.active path {
			stroke: black;
			stroke-width: 2;
			fill-opacity: 1;
		}
	</style>

	<!-- Define selectable blocks -->

	<g data-value="bue_pill" class="choice" title="The blue pill">
		<path d="M130 26c0-11 9-20 20-20h72c11 0 20 9 20 20s-9 20-20 20h-72c-11 0-20-9-20-20z" fill="#426373"/>
		<text font-size="20" y="34" x="151" fill="#B1FFFF">Blue Pill</text>
	</g>

	<g data-value="red_pill" class="choice" title="The red pill">
		<path d="M7 26C7 15 16 6 27 6h72c11 0 20 9 20 20s-9 20-20 20H27C16 46 7 37 7 26z" fill="#805064"/>
		<text font-size="20" y="34" x="29" fill="#FFAFCC">Red Pill</text>
	</g>

</svg>

Credits

directus-extension-svgmap-picker-interface's People

Contributors

dimitrov-adrian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

devxjs

directus-extension-svgmap-picker-interface's Issues

Employees in building

Will it be possible to search for region or human body parts. Not only by clicking, but by searching... I am thinking about building each floor of the building and marking each floor where the employee is sitting or where the room is. What do you think, is it possible?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.